What is the default number of threads in stanford-corenlp

不想你离开。 提交于 2019-12-11 00:59:48

问题


What is the default number of threads in stanford-corenlp? Specifically, the named entity extractor, and then the information extractor. Also, I would like both to use a single thread for debugging purposes, how do I set this?

Thanks!


回答1:


Default is 1 thread.

There are two ways to run Stanford CoreNLP in a multi-threaded mode.

1.) each thread handles a separate document

2.) each thread handles a separate sentence

Suppose you have 4 cores.

If you want each thread to handle a separate document, use the -threads 4 option (assuming you want to use 4).

So you might run this command:

java -Xmx14g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,depparse,coref,kbp -threads 4 -fileList sample-files.txt -outputFormat text

Multiple annotators can process sentences in parallel. Here is an example of setting the named entity processor to use multiple threads.

java -Xmx14g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,depparse,coref,kbp -ner.nthreads 4 -fileList sample-filelist-16.txt -outputFormat text

The following annotators can work on multiple sentences at the same time:

name       example configuration

depparse   -depparse.nthreads 4
ner        -ner.nthreads 4
parse      -parse.nthreads 4

Note that while the ner annotator can run in multi-threaded mode, it uses several sub-annotators that cannot. So you are really only getting the statistical model run in parallel. The pattern matching rules modules do not operate in multi-threaded mode.



来源:https://stackoverflow.com/questions/51636158/what-is-the-default-number-of-threads-in-stanford-corenlp

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