What is the default number of threads in stanford-

2019-07-30 14:50发布

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条回答
Summer. ? 凉城
2楼-- · 2019-07-30 15:27

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.

查看更多
登录 后发表回答