0

我正在尝试从 core-nlp 测试共指解析系统。从Running coreference resolution on raw text 开始,我了解为“dcoref 系统”设置一般属性。

我想根据模块的延迟在共同参考系统 [确定性、统计性、神经性] 之间进行选择。命令行用法对我来说很清楚,如何将此选项用作 API?

目前,我正在运行默认代码:

public static void main(String[] args) throws Exception {
    Annotation document = new Annotation("Barack Obama was born in Hawaii.  He is the president. Obama was elected in 2008.");
    Properties props = new Properties();
    props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,parse,mention,coref");
    StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
    pipeline.annotate(document);
    System.out.println("---");
    System.out.println("coref chains");
    for (CorefChain cc : document.get(CorefCoreAnnotations.CorefChainAnnotation.class).values()) {
      System.out.println("\t" + cc);
    }
    for (CoreMap sentence : document.get(CoreAnnotations.SentencesAnnotation.class)) {
      System.out.println("---");
      System.out.println("mentions");
      for (Mention m : sentence.get(CorefCoreAnnotations.CorefMentionsAnnotation.class)) {
        System.out.println("\t" + m);
       }
    }
4

1 回答 1

2

会的,在挖掘之后corefProperties.class我发现了需要更改的属性。

 props.setProperty("coref.language", "en");
 props.setProperty("coref.algorithm", "statistical");//"statistical" : "neural"

但是,更令人惊讶的是,执行上面的示例测试文本。Statistical method大约需要:45 秒,Neural大约需要 30 秒。(英特尔 i5 @2.00Ghz,8GB 内存)。我在这里错过了什么吗?

于 2017-01-30T09:42:23.123 回答