【发布时间】:2012-03-28 14:56:47
【问题描述】:
我一直在尝试在我的 Windows 系统上设置 hunpos,但遇到了一些问题。
我得到的错误是
File "C:\Users\a\Desktop\x.py", line 25, in <module>
ht = HunposTagger('english.model')
File "C:\Python27-32\lib\site-packages\nltk-2.0.1rc4-py2.7-win32.egg\nltk\tag\hunpos.py", line 84, in __init__
verbose=verbose)
File "C:\Python27-32\lib\site-packages\nltk-2.0.1rc4-py2.7-win32.egg\nltk\internals.py", line 526, in find_binary
url, verbose)
File "C:\Python27-32\lib\site-packages\nltk-2.0.1rc4-py2.7-win32.egg\nltk\internals.py", line 510, in find_file
raise LookupError('\n\n%s\n%s\n%s' % (div, msg, div))
LookupError: ===========================================================================
NLTK was unable to find the hunpos-tag file!
Use software specific configuration paramaters or set the HUNPOS environment variable.
Searched in:
- C:\Users\a\
- .
- /usr/bin
- /usr/local/bin
- /opt/local/bin
- /Applications/bin
- C:\Users\a/bin
- C:\Users\a/Applications/bin
我猜在 nltk 的 internals.py 中有一个错误,但不知道如何修复它。我在 hunpos.py 中将 os.getcwd() 添加到 hunpos_paths 但没有帮助。
有人知道为什么会这样吗?
谢谢
【问题讨论】:
-
这是一个非常好的错误消息。他们所说的这个 HUNPOS env var 是什么?你设置了吗?
-
它在 hunpos.py
self._hunpos_bin = find_binary(...env_vars=('HUNPOS', 'HUNPOS_HOME'), searchpath=hunpos_paths...)我也在我的环境变量中设置了HUNPOS。 -
我实际上更改了 internals.py 以打印
filename而不是name如此处所述https://github.com/nltk/nltk/issues/217 -
>>> config_hunpos-tag('C:\Users\a\') Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'config_hunpos_tag' is not defined