try: cmd = "./"+platform+"/fst-compiler-utf8 -s smor.fst " + tmp_auto retcode = subprocess.call(cmd, shell = True) except OSError, e: print >> sys.stderr, "Compiling lexicon failed", e print cmd sys.exit(0) print lemma stmts = getGenerationStatements(pos, lemma) # stmts in eine temporaere Datei speichern fp = open(tmp_gen_stmts,"w") for s in stmts: fp.write(s+"\n") fp.close() try: cmd = "./"+platform+"/fst-infl "+tmp_auto+" "+tmp_gen_stmts+" > "+tmp_gen_res retcode = subprocess.call(cmd, shell = True) except OSError, e: print >> sys.stderr, "Compiling lexicon failed", e print cmd sys.exit(0) # getFlexTables darauf laufen lassen... flextable_output_file = "flextable-"+lemma+".html" fp = open(flextable_output_file,"w") getFlextables(tmp_gen_res, fp) fp.close() print "The inflection paradigm has been successfully created in "+flextable_output_file+" :-)"
from flextables import getFlextables fp = open("dummy","w") getFlextables("generation-results",fp) fp.close()