是否可以在 GATE 中检索整个命名 AnnotationSets 列表?

Is it possible to retrieve the entire list of named AnnotationSets in GATE?

是否可以在 GATE 中检索注释集的整个列表?这行代码 returns 属于名为 "EMail";

的 AnnotationSet 的 GATE 文档的所有项目
AnnotationSet annSet = doc.getAnnotations().get("EMail");

现在,我如何才能知道所有的注释集名称而不是唯一的 "EMail"?

这不就是你问题的答案吗:

AnnotationSet annSet = doc.getAnnotations();

我认为您混合了两个不同的术语:注释集注释类型。小心这两个...

gate.Documentgate.AnnotationSet有几种方法可以使用:

  • gate.Document.getAnnotations()
    ...默认(无名称)注释集中的所有注释。
  • gate.Document.getAnnotations(String setName)
    ... 名称为 setName.
  • 的命名注释集中的所有注释
  • gate.AnnotationSet.get(String anntoationType)
    ...select 只有给定 anntoationType.
  • 的注释
  • gate.Document.getAnnotationSetNames()
    ...获取文档中所有命名标注集的名称
  • gate.AnnotationSet.getAllTypes()
    ...获取给定注释集中存在的注释的所有注释类型名称集。

在 javadoc 中查看更多详细信息:

Document doc;
// create/manipulate the document...

Set<String> names = doc.getAnnotationSetNames();
Map<String, AnnotationSet> namedAnnSets = doc.getNamedAnnotationSets();

// The default AS always exists
AnnotationSet defaultAS = doc.getAnnotations();

请注意,GATE 文档始终具有默认(未命名)注释集,该注释集不包含在名称集或命名集映射中。