我有以下代码
import nltk
from nltk.corpus.reader import TaggedCorpusReader
corpus_root = 'C:/Python27'
reader = TaggedCorpusReader(corpus_root, 'test.txt')
print reader.words()
print reader.tagged_words()
问题是结果在每个单词中给出了'无'的值。
[('And', 'None'), ('now', 'None')..
当我有这个代码时
import nltk
text = nltk.word_tokenize("And now for something completely different")
nltk.pos_tag(text)
结果是对的......
[('And', 'CC'), ('now', 'RB'), ('for', 'IN'), ('something', 'NN'), ('completely', 'RB'), ('different', 'JJ')]
出了什么问题?