小编Isa*_*ein的帖子

使用Stanford CoreNLP - Java堆空间

我正在尝试使用Stanford CoreNLP管道的coreference模块,但最终我在Java中遇到了OutOfMemory错误.我已经增加了堆大小(通过Run-> Run Configurations-> Eclipse中的VM Arguments)并将它们设置为-Xmx3g -Xms1g.我甚至尝试过-Xmx12g -Xms4g,但这也无济于事.我在64位计算机上使用带有Java 1.6的OS X 10.8.5上的Eclipse Juno.有谁知道我还能尝试什么?

我正在使用网站上的示例代码(http://nlp.stanford.edu/software/corenlp.shtml):

Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);

String text = "Stanford University is located in California. It is a great university";

Annotation document = new Annotation(text);

pipeline.annotate(document);

List<CoreMap> sentences = document.get(SentencesAnnotation.class);

for(CoreMap sentence: sentences) {
  for (CoreLabel token: sentence.get(TokensAnnotation.class)) {
    String word = token.get(TextAnnotation.class);
    String pos = token.get(PartOfSpeechAnnotation.class);
    String ne = token.get(NamedEntityTagAnnotation.class);       
  }

  Tree …
Run Code Online (Sandbox Code Playgroud)

java eclipse out-of-memory stanford-nlp

7
推荐指数
1
解决办法
3273
查看次数

标签 统计

eclipse ×1

java ×1

out-of-memory ×1

stanford-nlp ×1