Concurrent processing using Stanford CoreNLP (3.5.2)

柔情痞子 提交于 2019-11-30 20:49:10

Have you tried using the threads option? You can specify a number of threads for a single StanfordCoreNLP pipeline and then it will process sentences in parallel.

For example, if you want to process sentences on 8 cores, set the threads option to 8:

Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
props.put("threads", "8")
StanfordCoreNLP pipeline  = new StanfordCoreNLP(props);

Nevertheless I think your solution should also work and we'll check whether there is some concurrency bug, but using this option might solve your problem in the meantime.

peschü

I had the same problem and using a build from the latest github revision (today) solved the problem. So I think it is a CoreNLP issue that has been solved since 3.5.2.

See also CoreNLP on Apache Spark

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!