import stanza #stanza.download('et') nlp = stanza.Pipeline(lang='et') doc = nlp(open('romaanid/todejaoigus.txt').read()) valjund = open('romaanid/todejaoigus_m.txt', 'w') margendid = '\n'.join([f'{word.id}\t{word.text}\t{word.lemma}\t{word.upos}\t{word.xpos}' for sent in doc.sentences for word in sent.words]) valjund.write(margendid) valjund.close()