我想運行需要stanford postagger.jar的代碼。但我有此錯誤:ValueError:無法找到hazm庫-python的stanford-postagger.jar文件NLP
File "/usr/lib/python2.7/site-packages/nltk/internals.py", line 562, in find_jar
(name, path_to_jar))
ValueError: Could not find stanford-postagger.jar jar file at resources/stanford-postagger.jar
我如何解決這個錯誤?
編輯: 我從hazm模塊使用:
from hazm import POSTagger
tagger = POSTagger()
tagger.tag(word_tokenize('ما بسیار کتاب میخوانیم'))
和完整的結果:
Traceback (most recent call last):
File "pyt.py", line 8, in <module>
tagger = POSTagger()
File "/home/vahid/dev/hazm/hazm/POSTagger.py", line 14, in __init__
super(stanford.POSTagger, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/nltk/tag/stanford.py", line 42, in __init__
verbose=verbose)
File "/usr/lib/python2.7/site-packages/nltk/internals.py", line 562, in find_jar
(name, path_to_jar))
ValueError: Could not find stanford-postagger.jar jar file at resources/stanford-postagger.jar
h你有沒有得到錯誤?你的代碼是什麼? – alvas
@alvas,我編輯的問題 –