0

我使用以下命令在 Ubuntu 16.04 上启动了我的 Standford NLP 服务器(CoreNLP v 3.91, ):stanford-corenlp-full-2018-02-27.zip

java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000

过了一段时间,如果我对它扔了太多的句子,它就会爆炸。

java.util.concurrent.TimeoutException
        at java.util.concurrent.FutureTask.get(FutureTask.java:205)
        at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$CoreNLPHandler.handle (StanfordCoreNLPServer.java:866)

[pool-1-thread-6] INFO CoreNLP - [/127.0.0.1:34048] API call w/annotators tokenize,ssplit,pos,parse,depparse
But if you ask any feminist directly (and I have, one of my best friends is a woman's studies major and we have had MANY heated passionate arguments; i've spoken to her friends too), they will fully say that modern feminism is about having the choice, and while they completely disagree with women who take this choice, it is still their choice to make.
java.util.concurrent.TimeoutException
        at java.util.concurrent.FutureTask.get(FutureTask.java:205)
        at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$CoreNLPHandler.handle(StanfordCoreNLPServer.java:866)
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
        at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
        at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
        at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
[Thread-0] INFO CoreNLP - CoreNLP Server is shutting down.

不幸的是,这会杀死我的服务器。我的 python 脚本捕获了由服务器超时引起的异常,但是我怎样才能通过它,并继续使用服务器。我目前正在使用eval()上述命令重新启动服务器。

有没有更好的方法跳过这些崩溃?

编辑:这是一个示例,当我向它抛出太大的句子时,CoreNLP v 3.91 失败: 超时异常 注意一个很长的句子将如何导致超时异常,并且它会使服务器崩溃。

4

1 回答 1

0

您应该尝试获取最新的代码。当我向服务器提交一个很长的句子时,我得到了超时异常,但它并没有使服务器崩溃。

最新代码可以在 GitHub 上找到:https ://github.com/stanfordnlp/CoreNLP 最后一个稳定版本(3.9.1)在这里:https ://stanfordnlp.github.io/CoreNLP/

您还可以尝试设置“parse.maxlen = 100”(或更小的值)以防止注释非常长的句子。其他注释器可以选择不处理很长的句子,这通常是罪魁祸首。

于 2018-05-22T04:40:19.593 回答