我正在使用python 3.5
。
我下载了斯坦福解析器并将其解压缩。我还正确设置了环境变量,并且设置得当。但是,当我运行一个句子并试图解析时,我收到了一个错误。
这是错误:
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
sp.parse("this is a sentence".split())
File "C:\Users\MAHESH\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\parse\api.py", line 45, in parse
return next(self.parse_sents([sent], *args, **kwargs))
File "C:\Users\MAHESH\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\parse\stanford.py", line 120, in parse_sents
cmd, '\n'.join(' '.join(sentence) for sentence in sentences), verbose))
File "C:\Users\MAHESH\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\parse\stanford.py", line 216, in _execute
stdout=PIPE, stderr=PIPE)
File "C:\Users\MAHESH\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\internals.py", line 134, in java
raise OSError('Java command failed : ' + str(cmd))
OSError: Java command failed : ['java.exe', '-mx1000m', '-cp', 'C:/Users/MAHESH/stanfordparser/stanford-parser-full-2015-04-20\\stanford-parser-3.5.2-models.jar;C:/Users/MAHESH/stanfordparser/stanford-parser-full-2015-04-20\\ejml-0.23.jar;C:/Users/MAHESH/stanfordparser/stanford-parser-full-2015-04-20\\stanford-parser-3.5.2-javadoc.jar;C:/Users/MAHESH/stanfordparser/stanford-parser-full-2015-04-20\\stanford-parser-3.5.2-models.jar;C:/Users/MAHESH/stanfordparser/stanford-parser-full-2015-04-20\\stanford-parser-3.5.2-sources.jar;C:/Users/MAHESH/stanfordparser/stanford-parser-full-2015-04-20\\stanford-parser.jar', 'edu.stanford.nlp.parser.lexparser.LexicalizedParser', '-model', 'edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz', '-sentences', 'newline', '-outputFormat', 'penn', '-tokenized', '-escaper', 'edu.stanford.nlp.process.PTBEscapingProcessor', '-encoding', 'utf8', 'C:\\Users\\MAHESH\\AppData\\Local\\Temp\\tmp1jcjvrl1']