【问题标题】:Gate - extracting individual annotated text from annotation setGate - 从注释集中提取单个注释文本
【发布时间】:2014-02-08 15:27:10
【问题描述】:

我正在尝试提取由默认 ANNIE 处理资源生成的注释集的各个文本值。

当我遍历注解集时,每个条目只给出注解引用的开始和结束位置,但没有给出 .value() 方法。是否有一种简单的方法来获取值,或者我是否需要使用 FileWriter 或类似的方法来直接从我正在使用注释的开始和结束位置处理的语料库中提取值?

annotTypesRequired.add("Location");

Set<Annotation> organization = new HashSet<Annotation>(
                defaultAnnotSet.get(annotTypesRequired));

【问题讨论】:

  • 类似:gate.AnnotationSet entityAS = (gate.AnnotationSet)bindings.get("entity"); gate.Annotation entityAnn = (gate.Annotation)entityAS.iterator().next(); gate.FeatureMap features = Factory.newFeatureMap(); features.put("type", entityAnn.getType());outputAS.add(entityAnn.getStartNode(), entityAnn.getEndNode(), "Entity“, features);

标签: java filewriter gate


【解决方案1】:

如果“值”是指注释所涵盖的文本,则可以使用

gate.Utils.stringFor(document, annotation)

为此,您显然需要引用注解所属的 gate.Document 以及 Annotation 对象本身 - 注解通常不会直接存储其覆盖的字符串,它们只是存储指向文档的偏移量内容。

【讨论】:

  • 方法 gate.Utils.stringFor 对我来说非常有用,可以访问 Lookup 注释的 meta-property @string
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-12-11
  • 1970-01-01
  • 1970-01-01
  • 2015-05-29
  • 1970-01-01
  • 1970-01-01
  • 2012-11-24
相关资源
最近更新 更多