我修改了CoreNLP用于Coreference Resolution的几个文件。它似乎没有使用该列表。有没有人成功覆盖他们的基础dcoref词典?
以下是获取CorefChain的代码:
public class CorefChains {
StanfordCoreNLP pipeline;
public CorefChains() {
Properties props = new Properties();
props.put("dcoref.male","male.unigrams.txt");
props.put("dcoref.female","female.unigrams.txt");
props.put("dcoref.animate","animate.unigrams.txt");
props.put("dcoref.inanimate","inanimate.unigrams.txt");
props.put("dcoref.demonym","demonyms.txt");
props.put("dcoref.neutral","neutral.unigrams.txt");
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
this.pipeline = new StanfordCoreNLP(props);
}
public Map<Integer, CorefChain> getCoreferences(String str) {
Annotation document = new Annotation(str);
pipeline.annotate(document);
Map<Integer, CorefChain> graph = document.get(CorefChainAnnotation.class);
return graph;
}
}
(我也尝试在管道属性之后放置dcoref属性。)
这是Eclipse的调试器向我展示的内容(我从inanimatite.unigrams.txt,neutral.unigrams.txt和demonyms.txt中删除了Malta。我将它添加到female.unigrams.txt和animate.unigrams.txt)。