nltk.parse.stanford。NLTK无法找到stanford-parser .jar!在nltk3.2.5中设置CLASSPATH环境变量
from nltk.parse.stanford import *
# CoreNLPServer = CoreNLPServer(path_to_jar="/home/fonttian/NLP/stanford/")
# dep_parser=StanfordDependencyParser(model_path="/home/fonttian/NLP/stanford/stanford-chinese-corenlp-2017-06-09-models/edu/stanford/nlp/models/lexparser/chinesePCFG.ser.gz")
====>
dep_parser=StanfordDependencyParser(model_path="edu/stanford/nlp/models
/lexparser/chinesePCFG.ser.gz “) 文件” /home/fonttian/anaconda3/lib/python3.6/site- 包/ NLTK /解析/ stanford.py “线路52,在初始化 键=拉姆达model_path:os.path.dirname(model_path) 文件” /home/fonttian/anaconda3/lib/python3.6/site- 包/nltk/internals.py“,第716行,在find_jar_iter中 raise Looku PERROR( '\ n \ n%S \ n%S \ n%s' 的%(DIV,味精,DIV)) LookupError:
============================
NLTK was unable to find stanford-parser\.jar! Set the CLASSPATH
environment variable.
For more information, on stanford-parser\.jar, see:
<https://nlp.stanford.edu/software/lex-parser.shtml>
===============================
请参阅https://stackoverflow.com/q/46734119/610569 – alvas