Solar-oznacevanje-zacasno/multiple_conllu_to_xml.py

20 lines
510 B
Python

from os import sys, path, listdir
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from conllu_to_xml import main as convert_one
import sys
folderin = sys.argv[1]
folderout = sys.argv[2]
for filename in sorted(list(listdir(folderin))):
if not filename.endswith('.txt'):
continue
convert_one(
"{}/{}".format(folderin, filename),
"{}/{}.xml".format(folderout, filename.split('.')[0]))
print "\r{}".format(filename),
sys.stdout.flush()