from nltk.corpus.reader import TaggedCorpusReader
from nltk.tag import tnt
import pickle
#trainer
reader = TaggedCorpusReader('.', 'latin_training_set.pos')
train_sents = reader.tagged_sents()
#tester
test_reader = TaggedCorpusReader('.', 'latin_testing_set.pos')
test_sents = reader.tagged_sents()
tnt_tagger = tnt.TnT()
tnt_tagger.train(train_sents)
with open('latin_tnt_tagger.pickle', 'wb') as f:
pickle.dump(tnt_tagger, f)
tnt_tagger.evaluate(test_sents)