每当我为解析任务创建StanfordCoreNLP时,
StanfordCoreNLP('stanford-corenlp-full-2020-04-20', lang='en')
我得到这个伐木
Initializing native server...
java -Xmx4g -cp "/stanford-corenlp-full-2020-04-20/*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9032
Server shell PID: 11991
The server is available.
的应用
在应用解析器self.nlp_src.parse(sentence)
时,我得到了以下表单的另一个日志记录:
{'properties': "{'annotators': 'pos,parse', 'outputFormat': 'json'}", 'pipelineLanguage': 'en'}
最后,如前所述,我在斯坦福coreNLP中使用解析器的过程中出现了这个错误。
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=9032): Max retries exceeded with url: /?properties=%7B%27annotators%27%3A+%27pos%2Cparse%27%2C+%27outputFormat%27%3A+%27json%27%7D&pipelineLanguage=en (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe04121d6d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
发布于 2020-04-30 23:38:33
嗨,如果您想在Python中使用斯坦福CoreNLP,我建议您使用我们官方的package节,可以在这里获得:https://stanfordnlp.github.io/stanza/
如果您想使用Python访问斯坦福CoreNLP,那么Stanza需要在本地机器上启动一个Java服务器进程。这不需要连接到互联网或任何外部网络。Java服务器进程正在本地机器上运行,Python进程正在与其通信。
这里有一个关于如何在Python中启动Java服务器的详细说明:https://stanfordnlp.github.io/stanza/corenlp_client.html#overview
节本身具有部分词性、依赖分析和命名实体识别,这些都是完全原生的Python,不涉及任何类型的服务器。这里有更多详细信息:https://stanfordnlp.github.io/stanza/installation_usage.html
https://stackoverflow.com/questions/61533983
复制相似问题