Most applications and annotators will be just use some some "natural" way to iterate over the data in the feature structures in the FSStore.
For annotation feature structures this is the linear text order with some special sorting for annotations that start at the same position in the text.
For vocabulary feature structures a sort order based on lemma string and part of speech is the most accepted one.
Those "natural" indexes are predefined in the CAS and can be accessed using the functions described here.
For example to access tokens using the index over token annotations write:
Type tokType = cas.getTypeSystem().getType(TT::TYPE_NAME_TOKEN_ANNOTATION); ANIndex tokIdx = cas.getAnnotationIndex(tokType); ANIterator tokIter = tokIdx.iterator(); while(tokIter.isValid()) { AnnotationFS tokFS = tokIter.get(); // ... do some processing with tokFS ... tokIter.moveToNext(); }
Access to predefined indexes | |
virtual ANIndex | uima::CAS::getAnnotationIndex () |
get the index over all annotations. | |
virtual ANIndex | uima::CAS::getAnnotationIndex (Type const &crType) |
get the index over annotations of type crType . | |
virtual ANIndex const | uima::CAS::getAnnotationIndex (Type const &crType) const |
|
get the index over all annotations. The index is ordered where an annotation a1 is considered "less-than" another annotation a2 if the begin position of a1 is less then the begin position of a2, or, if they are equal, a1 is shorter than a2.
|
|
get the index over annotations of type The index is ordered where an annotation a1 is considered "less-than" another annotation a2 if the begin position of a1 is less then the begin position of a2, or, if they are equal, a1 is shorter than a2.
|
|
|