Stanford CoreNLP を使用して回避しようとしています。相互参照ツールで何が起こっているのかを理解するために、Web からいくつかのコードを使用しました。プロジェクトを Eclipse で実行しようとしましたが、メモリ不足の例外が発生し続けます。ヒープサイズを増やしてみましたが、違いはありません。なぜこれが起こり続けるのかについてのアイデアはありますか?これはコード固有の問題ですか? CoreNLP を使用する方向性は素晴らしいでしょう。
編集 - コードが追加されました
import edu.stanford.nlp.dcoref.CorefChain;
import edu.stanford.nlp.dcoref.CorefCoreAnnotations;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
public class testmain {
public static void main(String[] args) {
String text = "Viki is a smart boy. He knows a lot of things.";
Annotation document = new Annotation(text);
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, parse, dcoref");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
pipeline.annotate(document);
Map<Integer, CorefChain> graph = document.get(CorefCoreAnnotations.CorefChainAnnotation.class);
Iterator<Integer> itr = graph.keySet().iterator();
while (itr.hasNext()) {
String key = itr.next().toString();
String value = graph.get(key).toString();
System.out.println(key + " " + value);
}
}
}