from nltk.corpus import cess_esp as cess
from nltk import UnigramTagger as ut
from nltk import BigramTagger as bt
cess_sents = cess.tagged_sents()
uni_tag = ut(cess_sents)
sentence = 'Hola , esta foo bar .'
uni_tag.tag(sentence.split(' '))
train = int(len(cess_sents) * 90 / 100)
bi_tag = bt(cess_sents[:train])
bi_tag.evaluate(cess_sents[train + 1:])
bi_tag.tag(sentence.split(' '))
NLTK Tagging spanish words using a corpus