uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eddie Epstein" <eaepst...@gmail.com>
Subject Re: question: how to get order of annotations created by previous annotators?
Date Tue, 15 Jan 2008 19:03:06 GMT
Hi SAITO,

An iterator created from a UIMA index covers the index type and all derived
subtypes. So, for example, the iterator created by the code:

Iterator annotIter = aJCas.getAnnotationIndex().iterator();

will return all FS derived from uima.tcas.Annotation. These FS are also
known as annotionFS or just annotations. The order that FS are returned by
the iterator will be based on the keys defined for this index: start
position ascending, end position descending, type priority. In this case,
the document annotation will always be first because its start position is
the first character and its end position is the last character.

For your scenario it would be useful to create a single parent type, say
Fix.type, that PrefixAnnot and SuffixAnnot types derive from. Then an
iterator for Fix.type would only return the two annotations of interest, in
document order, with longer annotations returned first in the case of common
start position.

Regards,
Eddie

On Jan 14, 2008 8:17 PM, SAITO, Isao Isaac <130s@1995.sfc.ne.jp> wrote:

> hi all,
>
> I am trying to develop an aggregate analysis engine.
> The annotator run at the end (called annotator-end) wants to get
> all annotations created by the previous annotators(annotators-prev),
> as same order in given document(data that can be acquired by
> JCas#getDocumentText()).
> Could anyone tell me how to do this?
>
> For example of what I want,
>  - 2 types of Annotation(PrefixAnnot, SuffixAnnot) are in use
>  - by annotators-prev, more than 1 annotations are created using
> Annotation above
>  - annotator-end wants to get a SuffixAnnot everytime after any
> PrefixAnnot comes
>
> In <code a> shown below, annotation instances can be acquired only
> with respect to the class and the order is not available as far as I
> know.
>
> Thanks,
>  Isaac
>
> <code a>
> FSIndex prefixIndex = aJCas.getAnnotationIndex(PrefixAnnot.type);
> Iterator prefixIter = prefixIndex.iterator();
> while (prefixIter.hasNext()) {
>  PrefixAnnot prefix = (PrefixAnnot)prefixIter.next();
> }
>
> FSIndex suffixIndex = aJCas.getAnnotationIndex(SuffixAnnot.type);
> Iterator suffixIter = suffixIndex.iterator();
> while (suffixIter.hasNext()) {
>  SuffixAnnot suffix = (SuffixAnnot)suffixIter.next();
> }
> </code a>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message