from estnltk.syntax.parsers import VISLCG3Parser from estnltk.names import LAYER_VISLCG3 from estnltk import Text t=Text(open("referaadid.txt").read()) parser = VISLCG3Parser() initial_output = parser.parse_text(t, return_type='vislcg3') uus=[ s if s.find("#")==-1 else s[0:s.find("#")] for s in initial_output] print("\n".join(uus), file=open("referaadid_visl.txt", "w"))