stanford-corenlp中的默认线程数是多少

时间:2018-08-01 14:41:46

标签: multithreading stanford-nlp

stanford-corenlp中的默认线程数是多少?具体来说,是命名实体提取器,然后是信息提取器。另外,我都想将单个线程用于调试目的,该如何设置?

谢谢!

1 个答案:

答案 0 :(得分:2)

默认为1个线程。

有两种方法可以在多线程模式下运行Stanford CoreNLP。

1。)每个线程处理一个单独的文档

2。)每个线程处理一个单独的句子

假设您有4个核心。

如果您希望每个线程处理一个单独的文档,请使用-threads 4选项(假设您要使用4)。

因此您可以运行以下命令:

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

多个注释器可以并行处理句子。这是将命名实体处理器设置为使用多个线程的示例。

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

以下注释器可以同时处理多个句子:

name       example configuration

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

请注意,尽管ner注释器可以在多线程模式下运行,但是它使用了几个不能运行的子注释器。因此,您实际上只能使统计模型并行运行。模式匹配规则模块不能在多线程模式下运行。

相关问题