首页 > 解决方案 > 获取注释文本

问题描述

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

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

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

标签: javagate

解决方案


@ashingel 的回答是正确的,只是添加代码片段,如何使用它:

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

推荐阅读