How about something like:

First, get an iterator over tokens, using the base AnnotationIndex (e.g. index = aCAS.getAnnotationIndex(your-token-type). Then, I presume you will have some kind of a loop that iterates some inner code for each token. In the inner code, you want to have an iterator over annotations, that are contained within the begin / end span of the token (is that correct?). You can use a subiterator for that. See http://uima.apache.org/d/uimaj-2.4.0/references.html#ugr.ref.cas.index.annotation_index

There is a flag (strict / non-strict) that, if strict says that the returned annotation lies within the span of the controlling annotation; non-strict says only that the beginning of the returned annotation falls within the span.

Does this help?

-Marshall

On 2/21/2012 1:44 PM, Himanshu Gahlot wrote:
Hi,

Is there a straightforward way to iterate over all the annotation types of
a token ? For example, if a token has been annotated as a "location",
"organization", "food-related entity", "subject-of-a-sentence", etc. (in
addition to being annotated as a token, of course), then is there a way to
fetch all the annotations for this token without iterating over each
individual type of annotation and comparing the position of this token in
every annotation ? Am I missing something obvious ?

Thanks,
Himanshu Gahlot
Software Engineer
T 415.344.1336
235 2nd St, San Francisco, CA 94105

[image: Cbs]

Reply via email to