nltk3.2.5中的nltk.parse.stanford。
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/modelsinit key=lambda model_path: os.path.dirname(model_path) File“/home/fonttian/anaconda3 3/lib/python3.6/site- packages/nltk/parse/stanford.py",第716行,在find_jar_iter LookupError中(‘\n\n%s\n%s’% (div,msg,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>
===============================发布于 2017-09-26 04:51:37
您需要将斯坦福解析器的jars和模型添加到CLASSPATH:
我觉得这应该能解决你的问题。
发布于 2019-11-07 08:20:45
请从以下网址下载:
斯坦福/斯坦福-parser.jar.zip
http://www.java2s.com/Code/Jar/s/Downloadstanfordparserjar.htm
stanford-parser-3.5.2-models.jar
http://central.maven.org/maven2/edu/stanford/nlp/stanford-parser/3.5.2/
并在代码中指向文件路径。
https://stackoverflow.com/questions/46407837
复制相似问题