当前位置: 动力学知识库 > 问答 > 编程问答 >

Is it possible to create a hierarchy of annotations with UIMA?

问题描述:

I would like to be able to get a common feature from different annotation types. Is it possible to create sub-classes of the annotations and then get them by the super-class?

This is the way I am doing it at the moment but I would like to be able to get a general super-class of annotation rather than a specific one.

TypeSystem typeSystem = jcas.getTypeSystem();

Type type = typeSystem.getType("com.example.SpecificAnnotation");

AnnotationIndex<Annotation> annotationIndex = jcas.getAnnotationIndex(type);

Annotation annotation = annotationIndex.iterator().next();

String value = annotation.getFeatureValueAsString(type.getFeatureByBaseName("value"));

网友答案:

You can create an annotation type X with the common features. Then you can create additional annotation types which inherit from your type X instead of inheriting from Annotation.

分享给朋友:
您可能感兴趣的文章:
随机阅读: