【问题标题】:Get text of Annotations获取注释文本
【发布时间】:2019-05-03 09:58:03
【问题描述】:

我正在研究 GATE embeded 中的信息提取。我已尝试使用以下代码从注释中获取文本:

AnnotationSet annotationSet = doc.getAnnotations().get("Person");  
DocumentContent   personStr = annotationSet .getContent();

但是 get.Content 在注解类型中是无法工作的。 那么我们如何才能得到带注释的文本。 提前致谢

【问题讨论】:

    标签: java gate


    【解决方案1】:

    @ashingel 的回答是对的,只是加了代码sn-p,怎么用:

    AnnotationSet annotationSet = doc.getAnnotations().get("Person");  
    for (Annotation annotation : annotationSet) {
        String personStr = gate.Utils.stringFor(doc, annotation);
        System.out.println(personStr);
    }
    

    【讨论】:

      【解决方案2】:

      我认为 gate.Utils.stringFor(doc, personAnnotation) 就是你要找的。其中personAnnotation 是来自您的annotationSet 的单个注释。

      【讨论】:

        猜你喜欢
        • 2015-04-11
        • 1970-01-01
        • 2020-12-30
        • 1970-01-01
        • 1970-01-01
        • 2012-07-15
        • 2010-11-24
        • 1970-01-01
        相关资源
        最近更新 更多