uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "LeHouillier, Frank D." <Frank.LeHouill...@gd-ais.com>
Subject RE: Type Priorities
Date Thu, 13 Mar 2008 18:53:40 GMT
Typos in my code example fixed:

public ArrayList<Abbreviation> getAbbreviations(Entity entity, 
JFSIndexRepository index) {

AnnotationIndex annotationIndex =
index.getAnnotationIndex(Abbreviation.type);
FSIterator iter = index.subiterator(entity);
while (iter.hasNext()) {
		abbrev.add(currAbbrev);
}
return abbrev;

}

-----Original Message-----
From: LeHouillier, Frank D. [mailto:Frank.LeHouillier@gd-ais.com] 
Sent: Thursday, March 13, 2008 2:47 PM
To: uima-user@incubator.apache.org
Subject: RE: Type Priorities

I can't see in your example why the using the subiterator doesn't work.
You should still be able to iterate through all the abbreviations that
are within the span of an entity, even if the entity is itself an
abbreviation, or am I wrong?

AnnotationIndex index =
JFSIndexRepository().getAnnotationIndex(Abbreviation.type);
FSIterator itr = index.subiterator(entity);
while (iter.hasNext()) {
		abbrev.add(currAbbrev);
}
return abbrev; 

How does the type priority even come into play?

-----Original Message-----
From: Katrin Tomanek [mailto:katrin.tomanek@uni-jena.de] 
Sent: Thursday, March 13, 2008 1:38 PM
To: uima-user@incubator.apache.org
Subject: Re: Type Priorities

Hi Thilo,

>> Actually, I am using the subiterator functionality and I need to have

>> type priorities to be set. But I don't want the user of a component
to 
>> be able to alter the type priorities by modifying the descriptors 
>> where type priorities typically are set.
> 
> is that necessary?  The user mustn't change the type system either,
> else the annotator will no longer work.  Wouldn't you say it's part
> of the contract that such metadata is not changed by the user?
well, yeah. Could see it that way. But if I know at time of writing the 
component which types it will use and how the priorities should look 
like, why should I risk to let the user violate that "contract" ?

But to come back to the true problem: I am asking about type priorities 
because I am using the subiterator. For me, type priorities are 
necessary when the types I am interested in are of exactly the same 
offset as the type with which I constrain my subiterator. So, the 
question for me is: shall I use the subiterator (and define priorities 
in the compoennts descriptor) or shall I write my own function(see 
below) doing what I want without the type priority problems:

----- SNIP --------
// gives me a list of all abbreviations which are "within" my entity
public ArrayList<Abbreviation> getAbbreviations(Entity entity, 
JFSIndexRepository index) {
ArrayList<Abbreviation> abbrev = new ArrayList<Abbreviation>();
int StartOffset = entity.getBegin();
int EndOffset = entity.getEnt();
Iterator iter = index.getAnnotationIndex(Abbreviation.type).iterator();
	Abbreviation currAbbrev = (Abbreviation) iter.next();
	if (currAbbrev.getBegin() >= startOffset && currAbbrev.getEnd()
<= 
endOffset) {
		abbrev.add(currAbbrev);
	}
}
return abbrev;
}
----- SNIP --------

Do you see an efficiency disadvantage when using the above function 
instead of the subiterator?

Katrin

Mime
View raw message