Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing annotations in UIMA

Tags:

java

uima

Is there a way in UIMA to access the annotations from the tokens like the same way they do in their CAS debugger GUI?. You can of course access all the annotations from the index repository, but i want to loop on the tokens, and get all associated annotations to every token.

The reason for that is simply, I want to want to check some annotations and discard the others and in such way it is much easier. Any help is appreciated :)

like image 908
Shady Hussein Avatar asked Jan 29 '13 15:01

Shady Hussein


2 Answers

I'm a uimaFIT developer.

If you want to find all annotations within the boundaries of another annotation, you may prefer the shorter and faster variant

JCasUtil.selectCovered(referenceAnnotation, <T extends ANNOTATION>);

Mind that it is not a good idea creating a "dummy" annotation with the desired offsets and then search within its boundaries, because this immediately allocates memory in the CAS which and is not garbage-collected unless the complete CAS is collected.

like image 109
rec Avatar answered Sep 28 '22 18:09

rec


After searching and asking the developers of cTAKES( Apache clinical Text Analysis and Knowledge Extraction System ). you can use the following library "uimafit" which can be found on http://code.google.com/p/uimafit/ . The following code can be used

List list = JCasUtil.selectCovered(jcas, <T extends Annotation>, startIndex, endIndex);

This will return all the between the 2 indices.

Hope that will help

like image 32
Shady Hussein Avatar answered Sep 28 '22 18:09

Shady Hussein