我试图使用Hunpos tagger用于NLTK的POS标记而不是传统的pos_tag()
,但我在加载二进制文件english.model
或en_wsj.model
时遇到了一些问题。如何正确设置NLTK中的Hunpos tagger用于英文POS标记?
事实上,我在Linux Mint的,我把它们放在/usr/local/bin
,在HUNPOS
环境变量设置为这条道路,甚至试图以这个路径传递到__init__
nltk/tag/hunpos.py
的文件中使用的参数path_to_bin
,但是当它识别该文件,它会抛出此错误:
>>> ht = HunposTagger('en_wsj.model','/usr/local/bin/en_wsj.model')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/nltk-2.0.4-py2.7.egg/nltk/tag/hunpos.py", line 89, in __init__
shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
有没有人知道发生了什么?
一般来说,我更喜欢预编译的版本太多,但是当我3个月前试过要么没有工作或我需要在代码中进行一些小变化,我不记得他们中的哪一个。这就是为什么我试图编译标签。 – rafa