At first I tried training the tagger on tagged sentences, but unlike with Brown, the nps chat corpus doesn't seem to take the tagged_sents() method. So then I tried training on tagged words and Python returned the error message:
> Traceback (most recent call last): File "<pyshell#55>", line 1, in
> <module>
> unigram_tagger = nltk.UnigramTagger(training_set) File
> "C:\Python26\lib\site-packages\nltk\tag\sequential.py", line 287, in
> __init__
> backoff, cutoff, verbose) File
> "C:\Python26\lib\site-packages\nltk\tag\sequential.py", line 270, in
> __init__
> self._train(train, cuto开发者_运维技巧ff, verbose) File
> "C:\Python26\lib\site-packages\nltk\tag\sequential.py", line 181, in
> _train
> tokens, tags = zip(*sentence) ValueError: need more than 1 value
> to unpack
I suspect the issue has something to do with the fact that I'm trying to train the tagger on tagged words rather than sentences, but what's the solution to this if nps chat doesn't take the tagged_sents method? And why doesn't it accept that method? Please advise.
精彩评论