Hi Michael,
I think it is exatly what I need.
If I have annotations [np [token1] [token2] [token3]], your method would
give me for all tokens the NP, right?
Best regards
Ekaterina
Michael Baessler schrieb:
Hi Ekaterina,
I had the similar problem when implementing the
RegularExpressionAnnotator - how to find the covering annotation of a
certain type for my current FS.
The code is checked in to the SVN at:
http://svn.apache.org/repos/asf/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java
The method is called:
findCoverFS(CAS aCAS, AnnotationFS annot, Type coverFsType)
If this is exactly what you need, we may can discuss to move this to the
core framework API.
Hope that helps.
-- Michael
Ekaterina Buyko wrote:
Hi all!
In UIMA 2.1 it is possible to create a sub-iterator in order to
iterate over annotations which are within the begin-end span of the
selected type.
For example:
AnnotationIndex sentenceIndex = (AnnotationIndex) aJCas
.getJFSIndexRepository().getAnnotationIndex(Sentence.type);
AnnotationIndex tokenIndex = (AnnotationIndex) aJCas
.getJFSIndexRepository().getAnnotationIndex(Token.type);
// iterate over Sentences
FSIterator sentenceIterator = sentenceIndex.iterator();
while (sentenceIterator.hasNext()) {
Sentence sentence = (Sentence) sentenceIterator.next();
// iterate over Tokens
FSIterator tokenIterator = tokenIndex.subiterator(sentence);
I would like to have a more extended functionality. I need to know the
annotations which are in the span of begin-end of the selected
annotation type. These annotations can overlap the span of the
selected type.
For example noun phrases. If I iterate over tokens, I would like to
know, if this token is inside a noun phrase or not. Now, I am working
with Hashtables. But I am looking for an other solution.
How could I solve this problem?
Bets regards
Ekaterina