我按照以下链接中的说明(适用于以前版本的NLTK): Stanford Parser and NLTK
输入时出现以下错误:
sentences = parser.raw_parse_sents(("Hello, My name is Melroy.", "What is your name?"))
。
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2885, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-12-9af7b505d133>", line 1, in <module>
sentences = parser.raw_parse_sents(('hello,my name is melroy.','what is your name?'))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/parse/stanford.py", line 150, in raw_parse_sents
return self._parse_trees_output(self._execute(cmd, '\n'.join(sentences), verbose))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/parse/stanford.py", line 216, in _execute
stdout=PIPE, stderr=PIPE)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nltk/internals.py", line 134, in java
raise OSError('Java command failed : ' + str(cmd))
OSError: Java command failed : [u'/usr/bin/java', u'-mx1000m', '-cp', '/Users/su/Desktop/OJO/STANFORD_PARSE/stanford-parser-3.6.0-models.jar:/Users/su/Desktop/OJO/STANFORD_PARSE/ejml-0.23.jar:/Users/su/Desktop/OJO/STANFORD_PARSE/slf4j-api.jar:/Users/su/Desktop/OJO/STANFORD_PARSE/slf4j-simple.jar:/Users/su/Desktop/OJO/STANFORD_PARSE/stanford-parser-3.6.0-javadoc.jar:/Users/su/Desktop/OJO/STANFORD_PARSE/stanford-parser-3.6.0-models.jar:/Users/su/Desktop/OJO/STANFORD_PARSE/stanford-parser-3.6.0-sources.jar:/Users/su/Desktop/OJO/STANFORD_PARSE/stanford-parser.jar', u'edu.stanford.nlp.parser.lexparser.LexicalizedParser', u'-model', '/Users/su/Desktop/OJO/STANFORD_PARSE/stanford-parser-3.6.0-models/edu/stanford/nlp/models/lexparser', u'-sentences', u'newline', u'-outputFormat', u'penn', u'-encoding', u'utf8', '/var/folders/8j/ptm7g49n12g94wn8cn44frr40000gn/T/tmp7mHjA3']
有没有人能给出一个例子(逐步说明)斯坦福分析器究竟是如何配置和使用NLTK 3.6.0(Python 2)的?谢谢!