繁体   English   中英

如何在Stanford CoreNLP中选择共指解析系统

[英]How to choose Coreference resolution system in Stanford CoreNLP

我正在尝试从core-nlp测试共指解析系统。 通过对原始文本运行共指解析 ,可以理解为'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);
       }
    }

W'll,挖出后corefProperties.class我发现需要修改的属性。

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

但是,更令人惊讶的是执行上述示例测试文本。 Statistical method大约需要45秒,而Neural Statistical method大约需要30秒。 (Intel i5 @ 2.00Ghz,8GB内存)。 我在这里想念什么吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM