获取注释文字



我正在嵌入门中的信息提取。

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

但是,get.content无法在注释类型中工作。因此,我们如何获得注释的文本。预先感谢

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

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

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

最新更新