我正在尝试让Stanford CoreNLP作为服务器正常运行(虽然问题可能影响非服务器使用),但不断收到此错误:
"ERROR CoreNLP - Failure to load language specific properties".
它仍然有效,但可能没有它需要的一切才能运作良好.
我从基础下载开始.当我看到上面的错误时,我下载并放置在CoreNLP目录中的英文模型jar和english-kbp模型jar.这两个是巨大的,似乎不对应基本下载中的任何内容.但是,在重新启动服务器后,我仍然遇到上述错误.我也尝试过添加
-serverProperties StanfordCoreNLP-english.properties
到命令行,但这会给出一个错误,说它无法读取属性文件.
任何人都知道我错过了什么?
我在corenlp服务器上使用pycorenlp。我可以以字符串格式获取解析树。但是我可以像NLTK库这样的树来获取它吗?
from pycorenlp import StanfordCoreNLP
import pprint
import nltk
nlp = StanfordCoreNLP('http://localhost:9000')
text = ('Purgrug Vobter and Juklog Qligjar vruled into the Battlefield. Vobter was about to Hellfire. Juklog Qligjar started kiblaring.')
output = nlp.annotate(text, properties={
'annotators': 'tokenize,ssplit,pos,depparse,parse',
'outputFormat': 'json'
})
print [s['parse'] for s in output['sentences']]
Run Code Online (Sandbox Code Playgroud)
输出:
[u'(ROOT\r\n (S\r\n (NP (NNP Purgrug) (NNP Vobter)\r\n (CC and)\r\n (NNP Juklog) (NNP Qligjar))\r\n (VP (VBD vruled)\r\n (PP (IN into)\r\n (NP (DT the) (NN Battlefield))))\r\n (. .)))', u'(ROOT\r\n (S\r\n (NP (NNP Vobter))\r\n (VP …Run Code Online (Sandbox Code Playgroud)