我正在尝试让 CoreNLP 访问 CorefChains。我的意图是像“他,她,......”这样的词将被他们最好的提及所取代,但我无法访问 CorefChains(它们始终为空)。
public static void main (String [] args) {
Properties props = new Properties();
props.put("annotators", "tokenize,ssplit,pos,lemma,ner,parse,dcoref");
props.put("dcoref.score", true);
StanfordCoreNLP corefPipeline = new StanfordCoreNLP(props);
String text = "Barack Obama was born in Hawaii. He is the president. Obama was elected in 2008.";
Annotation document = new Annotation(text);
corefPipeline.annotate(document);
// Chains is always null
Map<Integer, CorefChain> chains = document.get(CorefCoreAnnotations.CorefChainAnnotation.class);
}