NLTK POS标签无法正常工作

时间:2013-01-24 17:15:32

标签: python-2.7 nltk pos-tagger

如果我试试这个:

import nltk
text = nltk.word_tokenize("And now for something completely different")
nltk.pos_tag(text)

输出:

Traceback (most recent call last):
File "C:/Python27/pos.py", line 3, in <module>
nltk.pos_tag(text)
File "C:\Python27\lib\site-packages\nltk-2.0.4-py2.7.egg\nltk\tag\__init__.py" ipos_tag
tagger = load(_POS_TAGGER)
File "C:\Python27\lib\site-packages\nltk-2.0.4-py2.7.egg\nltk\data.py", line 605,in 
resource_val = pickle.load(_open(resource_url))
ImportError: No module named numpy.core.multiarray

2 个答案:

答案 0 :(得分:10)

似乎保存的单词标记器需要numpy。您需要install it

答案 1 :(得分:3)

使用以下命令安装numpy:

sudo pip install -U numpy