斯坦福大学R coreNLP软件包的initCoreNLP()方法调用引发错误 [英] initCoreNLP() method call from the Stanford's R coreNLP package throws error
问题描述
我正在尝试使用coreNLP
软件包.我运行了以下命令,并遇到 GC超出开销限制错误.
I am trying to use the coreNLP
package. I ran the following commands and encounter the GC overhead limit exceeded error.
library(rJava)
downloadCoreNLP()
initCoreNLP()
错误是这样的:
从edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz中加载分类器... rJava中的错误::.jnew("edu.stanford.nlp.pipeline.StanfordCoreNLP ,基本名称(路径)): java.lang.OutOfMemoryError:超出了GC开销限制 包装过程中出错:无法打开连接
Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... Error in rJava::.jnew("edu.stanford.nlp.pipeline.StanfordCoreNLP", basename(path)) : java.lang.OutOfMemoryError: GC overhead limit exceeded Error during wrapup: cannot open the connection
我不太了解Java,有人可以帮我吗?
I don't know much of Java, can someone help me with this?
推荐答案
@indi I ran into the same problem (see R's coreNLP::initCoreNLP() throws java.lang.OutOfMemoryError) but was able to come up with a more repeatable solution than simply rebooting.
init命令的完整语法为
The full syntax for the init command is
initCoreNLP(libLoc, parameterFile, mem = "4g", annotators)
增加mem
并没有帮助我,但我意识到您和我都陷入了ner
注释器(命名为实体识别)中的一个分类器的困扰.由于我需要的只是词性标记,因此我将init命令替换为以下内容:
Increasing mem
did not help me, but I realized that you and I were both getting stuck with one of the classifiers in the ner
annotator (named entity recognition). Since all I needed was parts-of-speech tagging, I replaced the init command with the following:
initCoreNLP(mem = "8g", annotators = c("tokenize", "ssplit", "pos"))
这导致init命令在闪存中执行,并且没有内存问题.顺便说一句,我将mem
增加到8g只是因为我有那么多RAM.我确定我可以将其保留为默认的4g,这样就可以了.
This caused the init command to execute in a flash and with no memory problems. BTW, I increased mem
to 8g just because I have that much RAM. I'm sure I could have left it at the default 4g and it would have been fine.
我不知道您是否需要ner
注释器.如果不是,则显式列出annotators
参数.以下是可能值的列表: http://stanfordnlp.github.io/CoreNLP/annotators .html .只需选择完成工作所需的绝对要素即可.如果确实需要ner
,则再次找出所需的最小批注,并指定它们.
I don't know if you need the ner
annotator. If not, then explicitly list the annotators
argument. Here is a list of the possible values: http://stanfordnlp.github.io/CoreNLP/annotators.html. Just pick the ones you absolutely need to get your job done. If you do need ner
, then again figure out the minimal set of annotators you need and specify those.
所以,您(以及希望其他人)去了!
So there you (and hopefully others) go!
这篇关于斯坦福大学R coreNLP软件包的initCoreNLP()方法调用引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!