Java CoreNLP:句子分析失败,可能是因为内存不足

Java CoreNLP:句子分析失败,可能是因为内存不足,java,nlp,out-of-memory,stanford-nlp,Java,Nlp,Out Of Memory,Stanford Nlp,在运行斯坦福大学的CoreNLP 3.7.0时,我发现: WARNING: Parsing of sentence failed, possibly because of out of memory. Will ignore and continue: Just a year ago , the public outrage was over Sovaldi , a new hepatitis C drug being sold by Gilead Sciences for $ 1,000

在运行斯坦福大学的CoreNLP 3.7.0时,我发现:

WARNING: Parsing of sentence failed, possibly because of out of memory.
Will ignore and continue: Just a year ago , the public outrage was over 
Sovaldi , a new hepatitis C drug being sold by Gilead Sciences for 
$ 1,000 a pill , or $ 84,000 for a course of treatment . 
我以前见过这种情况,但那是因为句子分裂混乱,给出了一个很长的句子。我现在看到的案例,就像上面的一个,有合理的大小,正确的句子分割


为什么会发生这种情况,我应该怎么做才能解决它?

虽然这并不是为什么会发生这种情况的答案,但我通过使用64位JRE和增加可用堆来解决这个问题。我不确定您使用的是什么环境和IDE,但要在Windows上的Eclipse中实现这一点,您必须做三件事:

  • (选择Windows脱机/64位)
  • 在Eclipse中,单击Window..Preferences..Java..Installed JRE,然后确保选中了新安装的JRE(您可能需要先点击搜索才能找到它)
  • 右键单击Java项目,单击属性..运行/调试设置,选择您感兴趣的启动配置,然后单击编辑。在“参数”选项卡上,在“虚拟机参数”下输入
    -Xmx30G
这将最大堆设置为30Gb(我不确定它是否受到物理内存的限制,因为我没有那么多),您的项目应该再次运行。请注意,它以前遇到的问题可能会处理得相当缓慢