【发布时间】:2016-08-29 15:33:41
【问题描述】:
我正在尝试使用来自 NLTK 的 StanfordPOSTagger。我下载了 Stanford POS full tagger。我已经设置了
CLASSPATH=/home/waheeb/Stanford_Tools/stanford-postagger-full-2015-12-09 /stanford-postagger.jar
STANFORD_MODELS=home/waheeb/Stanford_Tools/stanford-postagger-full-2015-12-09/models
当我在 python 中输入以下内容时:
>>> from nltk.tag import StanfordPOSTagger
>>> st = StanfordPOSTagger('english-bidirectional-distsim.tagger')
我收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/waheeb/anaconda2/lib/python2.7/site-packages/nltk/tag /stanford.py", line 136, in __init__
super(StanfordPOSTagger, self).__init__(*args, **kwargs)
File "/home/waheeb/anaconda2/lib/python2.7/site-packages/nltk/tag/stanford.py", line 56, in __init__
env_vars=('STANFORD_MODELS',), verbose=verbose)
File "/home/waheeb/anaconda2/lib/python2.7/site-packages /nltk/internals.py", line 573, in find_file
file_names, url, verbose))
File "/home/waheeb/anaconda2/lib/python2.7/site-packages/nltk/internals.py", line 567, in find_file_iter
raise LookupError('\n\n%s\n%s\n%s' % (div, msg, div))
查找错误:
=========================================================================
NLTK was unable to find the english-bidirectional-distsim.tagger file!
Use software specific configuration paramaters or set the TANFORD_MODELS environment variable.
==========================================================================
为什么会这样??
【问题讨论】:
标签: python nlp nltk stanford-nlp pos-tagger