我正在尝试在NLTK中使用speech标签,并使用了以下命令:
>>> text = nltk.word_tokenize("And now for something completely different")
>>> nltk.pos_tag(text)
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
nltk.pos_tag(text)
File "C:\Python27\lib\site-packages\nltk\tag\__init__.py", line 99, in pos_tag
tagger = load(_POS_TAGGER)
File "C:\Python27\lib\site-packages\nltk\data.py", line 605, in load
resource_val = pickle.load(_open(resource_url))
File "C:\Python27\lib\site-packages\nltk\data.py", line 686, in _open
return find(path).open()
File "C:\Python27\lib\site-packages\nltk\data.py", line 467, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource 'taggers/maxent_treebank_pos_tagger/english.pickle' not
found. Please use the NLTK Downloader to obtain the resource:但是,我收到一条错误消息,其中显示:
engish.pickle not found.我已经下载了整个语料库,maxtent_treebank_pos_tagger中有english.pickle文件
我该怎么做才能让它正常工作呢?
发布于 2013-01-01 04:28:44
您的Python安装无法访问maxent或treemap。
首先,检查标记器是否确实存在:从命令行启动Python。
>>> import nltk
然后,您可以使用
>>> dir (nltk)
查看列表,看看maxent和treebank是否都在那里。
打字会更简单
>>> "maxent" in dir(nltk)
>>> True
>>> "treebank" in dir(nltk)
>>> True使用nltk.download() --> Models选项卡并检查treemap标记器是否显示为已安装。您还应该尝试再次下载标记器。

发布于 2015-07-31 13:18:49
如果你不想使用下载器gui,你可以在python或ipython shell中使用以下命令:
import nltk
nltk.download('punkt')
nltk.download('maxent_treebank_pos_tagger')发布于 2014-10-22 19:39:17
超过50个语料库和词汇资源,例如WordNet:http://www.nltk.org/nltk_data/是免费的。使用http://nltk.github.com/nltk_data/作为服务器索引,而不是googlecode谷歌代码401:需要授权
https://stackoverflow.com/questions/14089887
复制相似问题