NLTK POS标记器要求我下载什么? [英] What is NLTK POS tagger asking me to download?
本文介绍了NLTK POS标记器要求我下载什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚开始使用词性标记器,但是我遇到了许多问题.
I just started using a part-of-speech tagger, and I am facing many problems.
我开始使用以下内容进行POS标记:
I started POS tagging with the following:
import nltk
text=nltk.word_tokenize("We are going out.Just you and me.")
当我要打印'text'
时,会发生以下情况:
When I want to print 'text'
, the following happens:
print nltk.pos_tag(text)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\Python26\lib\site-packages\nltk\tag\__init__.py", line 63, in pos_tag
tagger = nltk.data.load(_POS_TAGGER)
File "F:\Python26\lib\site-packages\nltk\data.py", line 594, in load
resource_val = pickle.load(_open(resource_url))
File "F:\Python26\lib\site-packages\nltk\data.py", line 673, in _open
return find(path).open()
File "F:\Python26\lib\site-packages\nltk\data.py", line 455, 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:
>>> nltk.download().
Searched in:
- 'C:\\Documents and Settings\\Administrator/nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
- 'F:\\Python26\\nltk_data'
- 'F:\\Python26\\lib\\nltk_data'
- 'C:\\Documents and Settings\\Administrator\\Application Data\\nltk_data'
我使用了nltk.download()
,但是没有用.
I used nltk.download()
but it did not work.
推荐答案
在Python中键入nltk.download()
时,会自动显示NLTK下载器界面.
单击模型,然后选择maxent_treebank_pos_.它会自动安装.
When you type nltk.download()
in Python, an NLTK Downloader interface gets displayed automatically.
Click on Models and choose maxent_treebank_pos_. It gets installed automatically.
import nltk
text=nltk.word_tokenize("We are going out.Just you and me.")
print nltk.pos_tag(text)
[('We', 'PRP'), ('are', 'VBP'), ('going', 'VBG'), ('out.Just', 'JJ'),
('you', 'PRP'), ('and', 'CC'), ('me', 'PRP'), ('.', '.')]
这篇关于NLTK POS标记器要求我下载什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文