Nltk: 带有“ /”的句子的DependencyGraph或Stanford Parser API问题

创建于 2016-11-18  ·  31评论  ·  资料来源: nltk/nltk

用户报告说,在NLTK中使用Stanford的DependencyParser API时,此语句会抛出AssertionError

该影片以其对青少年梦想世界的所有见解以及通过网络文化进行的电子表达,对于寻求从其2 1/2小时的放映时间中汲取凝聚力的故事的任何人来说,这部影片丝毫不容小quarter。

码:

>>> from nltk.parse.stanford import StanfordDependencyParser                                                                                       >>> dep_parser=StanfordDependencyParser(model_path="edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz")                                        
>>> sent = 'for all of its insights into the dream world of teen life , and its electronic expression through cyber culture , the film gives no quarter to anyone seeking to pull a cohesive story out of its 2 1/2-hour running time . '
>>> dep_parser.raw_parse(sent)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/nltk/parse/stanford.py", line 132, in raw_parse
    return next(self.raw_parse_sents([sentence], verbose))
  File "/Library/Python/2.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/Python/2.7/site-packages/nltk/parse/stanford.py", line 91, in _parse_trees_output
    res.append(iter([self._make_tree('\n'.join(cur_lines))]))
  File "/Library/Python/2.7/site-packages/nltk/parse/stanford.py", line 339, in _make_tree
    return DependencyGraph(result, top_relation_label='root')
  File "/Library/Python/2.7/site-packages/nltk/parse/dependencygraph.py", line 84, in __init__
    top_relation_label=top_relation_label,
  File "/Library/Python/2.7/site-packages/nltk/parse/dependencygraph.py", line 328, in _parse
    assert cell_number == len(cells)
AssertionError

可能是DependencyGraph正在读取输出或斯坦福输出不一致。

有关NLTK + Stanford工具设置的更多详细信息,参见

bug dependency parsing pleaseverify

最有用的评论

@dimazest问题已解决。 感谢您一直以来的帮助和耐心!

所有31条评论

@alvations对此有任何更新吗?
谢谢

@ hoavt-54我认为有一种快速的方法可以使用#1249中的新界面来检查是斯坦福大学还是DependencyGraph代码引起问题。 今天我会有点忙,但是也许其他人可以检查一下并重新开始。

我可以看看,以某种方式我错过了这个问题。

@dimazest您好,我刚遇到此错误。 我该如何解决?

@tesslocl你的句子是什么? 您是否尝试过使用CoreNLP(nltk / parse / corenlp.py)?

我刚做的@dimazest遇到了另一个错误:

Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 386, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 382, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Admin\Anaconda3\lib\http\client.py", line 1198, in getresponse
    response.begin()
  File "C:\Users\Admin\Anaconda3\lib\http\client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Admin\Anaconda3\lib\http\client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\Admin\Anaconda3\lib\socket.py", line 576, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\adapters.py", line 423, in send
    timeout=timeout
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 649, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\packages\urllib3\util\retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\packages\urllib3\packages\six.py", line 686, in reraise
    raise value
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 388, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 308, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=9000): Read timed out. (read timeout=60)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\classifier\feature_extraction.py", line 473, in <module>
    print(feature_extraction(test_file_id))
  File "E:\classifier\feature_extraction.py", line 146, in feature_extraction
    for line in dep_parse:
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 279, in raw_parse_sents
    parsed_data = self.api_call(sentence, properties=default_properties)
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 247, in api_call
    timeout=60,
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\sessions.py", line 535, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Admin\Anaconda3\lib\site-packages\requests\adapters.py", line 499, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=9000): Read timed out. (read timeout=60)

我只更改了StanfordDependencyParser部分,其余代码保持不变。 我检查了文档,并认为CoreNLP中的方法相同,对吗? 解析似乎成功了,因为错误在我遍历解析结果的下一行。

您需要启动cornlp服务器,请尝试:

with CoreNLPServer(port=9000) as server:
    parser = CoreNLPParser(url=server.url)
    parser.parse(...)

我在手机上打字时,缺少文档和衬衫答复,对不起。

@dimazest非常感谢您的帮助和快速回复。 但是错误仍然存​​在:(

Traceback (most recent call last):
  File "E:\classifier\feature_extraction.py", line 474, in <module>
    print(feature_extraction(test_file_id))
  File "E:\classifier\feature_extraction.py", line 135, in feature_extraction
    with CoreNLPServer(port=9000) as server:
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 81, in __init__
    try_port(port)
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 35, in try_port
    sock.bind(('', port))
OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted

我尝试使用谷歌搜索,但不知道套接字如何工作...

您可以尝试其他端口:例如CoreNLPServer(port = 9001)或仅尝试CoreNLPServer(),然后应选择一个空闲端口。

@dimazest我尝试了9001到9010,并且还加上了空括号,这就是我每次都得到的:

Traceback (most recent call last):
  File "E:\classifier\feature_extraction.py", line 509, in <module>
    print(feature_extraction(test_file_id))
  File "E:\classifier\feature_extraction.py", line 136, in feature_extraction
    with CoreNLPServer() as server:
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 170, in __enter__
    self.start()
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 149, in start
    'Could not connect to the server.'
nltk.parse.corenlp.CoreNLPServerError: Could not connect to the server.

考虑到我在中国,我在运行VPN时一直保持打开状态,但还是没有运气。 我这可能是什么问题?

您是否有corenlp .jars? 您需要在本地运行corenlp服务器。

您能否运行此示例https://github.com/nltk/nltk/pull/1249#pullrequestreview -18096061

我在E:\classifier\stanford\stanford-corenlp-full-2016-10-31目录下有jar,我想这些是您所指的:

stanford-corenlp-3.7.0.jar
stanford-corenlp-3.7.0-javadoc.jar
stanford-corenlp-3.7.0-models.jar
stanford-corenlp-3.7.0-sources.jar

并且目录已设置为CLASSPATH环境变量。

我可以在Windows命令提示符下运行示例,这是输出:

Python 3.5.3 |Anaconda custom (64-bit)| (default, Feb 22 2017, 21:28:42) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from nltk.parse.corenlp import *
>>> global server
>>> server = CoreNLPServer()
>>> server.start()
>>> parser = CoreNLPParser(url='http://localhost:9000')
>>> sent = 'the quick brown fox jumps over the lazy dog'
>>> parser.raw_parse(sent)
<list_iterator object at 0x000001F0EFED69E8>
>>> fox_parsed = next(parser.raw_parse(sent))
>>> fox_parsed.pretty_print()
                     ROOT
                      |
                      NP
       _______________|_________
      |                         NP
      |                _________|___
      |               |             PP
      |               |     ________|___
      NP              NP   |            NP
  ____|__________     |    |     _______|____
 DT   JJ    JJ   NN  NNS   IN   DT      JJ   NN
 |    |     |    |    |    |    |       |    |
the quick brown fox jumps over the     lazy dog

当我运行此行server.start()弹出一个Windows安全警报,我一直认为这是防火墙的故障,因此我进入了防火墙设置,以允许Java(TM)Platform SE二进制文件通过防火墙。 我以为这可以解决问题,但是当我重新打开编辑器并运行代码时,我仍然遇到相同的错误:

Traceback (most recent call last):
  File "E:\classifier\feature_extraction.py", line 503, in <module>
    print(feature_extraction(test_file_id))
  File "E:\classifier\feature_extraction.py", line 130, in feature_extraction
    with CoreNLPServer() as server:
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 170, in __enter__
    self.start()
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 149, in start
    'Could not connect to the server.'
nltk.parse.corenlp.CoreNLPServerError: Could not connect to the server.

启动服务器后,可以在浏览器中访问http:// localhost :9000吗?

您也可以自己启动服务器,请参阅https://stanfordnlp.github.io/CoreNLP/corenlp-server.html

它正在运行,并且您可以通过浏览器访问它,您应该能够使用解析器:

parser = CoreNLPParser(url='http://localhost:9000')
# and so on

为了找到答案,我再次在命令提示符下运行示例,但是这次我遇到了熟悉的错误

Python 3.5.3 |Anaconda custom (64-bit)| (default, Feb 22 2017, 21:28:42) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from nltk.parse.corenlp import *
>>> global server
>>> server = CoreNLPServer()
>>> server.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 149, in start
    'Could not connect to the server.'
nltk.parse.corenlp.CoreNLPServerError: Could not connect to the server.
>>> server.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Admin\Anaconda3\lib\site-packages\nltk\parse\corenlp.py", line 149, in start
    'Could not connect to the server.'
nltk.parse.corenlp.CoreNLPServerError: Could not connect to the server.

...而且我不知道这之间发生了什么。 我没有更改任何配置。

我很早以前就想将这个项目移至Linux,但是在Linux上我一直收到NLTK was unable to find ***.jar! Set the CLASSPATH environment variable错误。 我在/etc/environment/etc/profile~/.bash_profile设置了CLASSPATH,甚至尝试将这些jar复制到$JAVA_HOME/lib/但问题仍然存在。 我应该再开一个问题吗?

您是否可以从终端(不是从python)启动corenlp服务器,请查看https://stanfordnlp.github.io/CoreNLP/corenlp-server.html了解更多详细信息?

# Run the server using all jars in the current directory (e.g., the CoreNLP home directory)
java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
E:\classifier\stanford\stanford-corenlp-full-2016-10-31>java -mx4g -cp "E:\classifier\stanford\stanford-corenlp-full-2016-10-31" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLPServer

E:\classifier\stanford\stanford-corenlp-full-2016-10-31>java -Xmx4g -cp "E:\classifier\stanford\stanford-corenlp-full-2016-10-31" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-chinese.properties -port 9000 -timeout 15000
Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLPServer

E:\classifier\stanford\stanford-corenlp-full-2016-10-31>java -mx4g -cp "E:\classifier\stanford\stanford-corenlp-full-2016-10-31" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -timeout 15000
Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLPServer

好像没有。 我做对了吗?

我终于让那些斯坦福模块在Linux上工作了。 使用相同的代码行,CoreNLP服务器似乎可以正常启动,但是在循环解析结果的那一行上,我遇到了其他错误。

Traceback (most recent call last):
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 356, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/home/tesslo/anaconda3/lib/python3.5/http/client.py", line 1107, in request
    self._send_request(method, url, body, headers)
  File "/home/tesslo/anaconda3/lib/python3.5/http/client.py", line 1152, in _send_request
    self.endheaders(body)
  File "/home/tesslo/anaconda3/lib/python3.5/http/client.py", line 1103, in endheaders
    self._send_output(message_body)
  File "/home/tesslo/anaconda3/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/home/tesslo/anaconda3/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x7f110a9c4940>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 438, in send
    timeout=timeout
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /?properties=%7B%22annotators%22%3A+%22tokenize%2Cpos%2Clemma%2Cssplit%2Cdepparse%22%2C+%22outputFormat%22%3A+%22json%22%2C+%22ssplit.isOneSentence%22%3A+%22true%22%7D (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f110a9c4940>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/media/tesslo/classifier/feature_extraction.py", line 503, in <module>
    print(feature_extraction(test_file_id))
  File "/media/tesslo/classifier/feature_extraction.py", line 142, in feature_extraction
    for line in dep_parse:
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/nltk/parse/corenlp.py", line 279, in raw_parse_sents
    parsed_data = self.api_call(sentence, properties=default_properties)
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/nltk/parse/corenlp.py", line 247, in api_call
    timeout=60,
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 565, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 518, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 639, in send
    r = adapter.send(request, **kwargs)
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 502, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /?properties=%7B%22annotators%22%3A+%22tokenize%2Cpos%2Clemma%2Cssplit%2Cdepparse%22%2C+%22outputFormat%22%3A+%22json%22%2C+%22ssplit.isOneSentence%22%3A+%22true%22%7D (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f110a9c4940>: Failed to establish a new connection: [Errno 111] Connection refused',))

FYI Linux和Windows共享相同的硬件。

好的,涉及两个步骤:
1)启动CoreNLP Java进程。 有两种方法,我建议您手动启动,即使用java -Xmx4g -cp ...命令。 你成功了吗? 您应该能够通过浏览器访问http:// localhost:9000来访问服务器。 您应该在控制台输出中看到正在使用哪个端口。
2)服务器运行后,您可以创建CoreNLP python客户端parser = CoreNLPParser(url='http://localhost:9000') 。 在您自己启动CoreNLP Java服务器时,您不需要在python会话中启动它(不要运行server = CoreNLPServer()

您发布的错误消息表明CoreNLP Java服务器未运行。

失败了:

tesslo<strong i="6">@TLU</strong>:/media/tesslo/classifier/stanford/stanford-corenlp-full-2016-10-31$ java -mx4g -cp "/media/tesslo/classifier/stanford/stanford-corenlp-full-2016-10-31" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLPServer
tesslo<strong i="7">@TLU</strong>:/media/tesslo/classifier/stanford/stanford-corenlp-full-2016-10-31$ java -Xmx4g -cp "/media/tesslo/classifier/stanford/stanford-corenlp-full-2016-10-31" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-chinese.properties -port 9000 -timeout 15000
Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLPServer
tesslo<strong i="8">@TLU</strong>:/media/tesslo/classifier/stanford/stanford-corenlp-full-2016-10-31$ java -mx4g -cp "/media/tesslo/classifier/stanford/stanford-corenlp-full-2016-10-31" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -timeout 15000
Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLPServer

并且http:// localhost :9000显示ERR_CONNECTION_REFUSED错误

您是否尝试将"*"作为类路径:j ava -mx4g -cp "*" ...

您好,似乎我也遇到了这个问题。 我的句子是:
“也许是2 21/2英尺长的电线?”,“它的质量比微型USB插入的充电器部分便宜……”
而且我试图弄清楚,似乎是'/'导致了此错误。

@caisinong您是否尝试过使用新的CoreNLP接口? 请参阅上面的评论。

@dimazest抱歉,延迟了。 我刚才做了:

tesslo<strong i="7">@TLU</strong>:/media/tesslo/classifier/stanford/stanford-corenlp-full-2016-10-31$ java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
[main] INFO CoreNLP - --- StanfordCoreNLPServer#main() called ---
[main] INFO CoreNLP - setting default constituency parser
[main] INFO CoreNLP - warning: cannot find edu/stanford/nlp/models/srparser/englishSR.ser.gz
[main] INFO CoreNLP - using: edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz instead
[main] INFO CoreNLP - to use shift reduce parser download English models jar from:
[main] INFO CoreNLP - http://stanfordnlp.github.io/CoreNLP/download.html
[main] INFO CoreNLP -     Threads: 2
[main] INFO CoreNLP - Starting server...
[main] INFO CoreNLP - StanfordCoreNLPServer listening at /0:0:0:0:0:0:0:0:9000

我现在可以访问http:// localhost :9000,但是回到编辑器,我仍然在启动服务器的行上看到此错误:

Traceback (most recent call last):
  File "/media/tesslo/classifier/feature_extraction.py", line 503, in <module>
    print(feature_extraction(test_file_id))
  File "/media/tesslo/classifier/feature_extraction.py", line 130, in feature_extraction
    with CoreNLPServer() as server:
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/nltk/parse/corenlp.py", line 170, in __enter__
    self.start()
  File "/home/tesslo/anaconda3/lib/python3.5/site-packages/nltk/parse/corenlp.py", line 149, in start
    'Could not connect to the server.'
nltk.parse.corenlp.CoreNLPServerError: Could not connect to the server.

一旦你手动启动的服务器,你并不需要在代码中启动服务器。

保持服务器运行并实例化解析器:

parser = CoreNLPParser(url='http://localhost:9000')

@dimazest问题已解决。 感谢您一直以来的帮助和耐心!

我也有类似的经历。 在代码中启动Stanford CorenNLP服务器很麻烦,只能用于测试目的。 也许我们应该以某种方式不向用户公开。

我很高兴一切正常。 实际上,服务器应该在Python代码之外启动。

通过新的CoreNLP API修补并解决了=)

@dimazest嗨......如果文本包含\/为解决Assertion Error是只使用核心NLP? 我正在使用stanford-parser-full-2017-06-09
用于分析的句子为Iraqi security forces drove Islamic State fighters from the centre of a town just south of the militants\' main stronghold of Mosul on Saturday and reached within a few km (miles) of an airport on the edge of the city, a senior commander said.

@ kavin26是,请使用nltk.parse.corenlp.CoreNLPParser

@alvations非常感谢:+1:

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

jeryini picture jeryini  ·  5评论

zdog234 picture zdog234  ·  3评论

ndvbd picture ndvbd  ·  4评论

Chris00 picture Chris00  ·  3评论

DavidNemeskey picture DavidNemeskey  ·  4评论