M1-Arborator-NaijaSUD/arborator/lib/conll.py
def sentences2emptyConllFile(infile, outfile):
	"""
	transforms a list of sentences into conll format without trees
	"""
	inf=codecs.open(infile,"r","utf-8")
	outf=codecs.open(outfile,"w","utf-8")
	counter=0
	for line in inf:
		line=line.strip()
		if line:
			for i,word in enumerate(line.split()):
				outf.write("\t".join([str(i+1),word,word,"_","_","_","-1","","_","_"])+"\n")
				## nr, t, lemma , tag, xpos, _, head, rel, _, _ = cells
			outf.write("\n")
			counter+=1
	inf.close()
	outf.close()
	print counter, "sentences"

	transforms a list of sentences into conll format without trees
	
transforms a list of sentences into conll format without trees
transforms a list of sentences into conll format without trees
def sentences2emptyConllFile(infile, outfile):
	inf=codecs.open(infile,"r","utf-8")
	outf=codecs.open(outfile,"w","utf-8")
	counter=0
	for line in inf:
		line=line.strip()
		if line:
			for i,word in enumerate(line.split()):
				outf.write("\t".join([str(i+1),word,word,"_","_","_","-1","","_","_"])+"\n")
			outf.write("\n")
			counter+=1
	inf.close()
	outf.close()
	print counter, "sentences"
def sentences2emptyConllFile ( infile , outfile ) : inf = codecs . open ( infile , "r" , "utf-8" ) outf = codecs . open ( outfile , "w" , "utf-8" ) counter = 0 for line in inf : line = line . strip ( ) if line : for i , word in enumerate ( line . split ( ) ) : outf . write ( "\t" . join ( [ str ( i + 1 ) , word , word , "_" , "_" , "_" , "-1" , "" , "_" , "_" ] ) + "\n" ) outf . write ( "\n" ) counter += 1 inf . close ( ) outf . close ( ) print counter , "sentences"
transforms a list of sentences into conll format without trees
transforms a list of sentences into conll format without trees
"""
	transforms a list of sentences into conll format without trees
	""" ## nr, t, lemma , tag, xpos, _, head, rel, _, _ = cells
infile
outfile