import stanza #stanza.download('et') nlp = stanza.Pipeline(lang='et') doc = nlp(open('fail.txt').read()) valjund = open('fail_m.txt', 'w') valjund.write('Id\tSona\tLemma\tUpos\tXpos\n') 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()