uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ingo Thon <ist...@gmx.de>
Subject storing meta data with annotations
Date Sat, 17 Nov 2012 23:00:33 GMT
Dear List,


I've a rather simple problem I can not find a clean solution at the  moment.

What I want to achieve is that I can store meta-data with an annotation.
Metadata refers here to all the information about how the annotation was 
generated, like
- qualifiedName of the AnalaysisEngine which added the annotion  
/UserAE/RoomNumber
- confidence the annotator has in the hypothesis 0.3
- number of characters between a hint (room) and the value (200A.1.1), 
e.g., room is  200A.1.1

Some of the information might be added by specialized components which 
solely alter the media-data.

From the java side I want to use methods like
void setMetaData(Annotation a,Key k,String s);
void setMetaData(Annotation a,Key k,float f);
void setMetaData(Annotation a,Key k,int i);

String getMetaData(Annotation a,Key k,String s); //last value just to 
express that I'm expecting a string
float getMetaData(Annotation a,Key k,float f);
int getMetaData(Annotation a,Key k,int i);
The idea is that if I try to do something like
setMetaData(a,"akey","astring");
setMetaData(a,"akey",0.3);
I get an exception similar for trying to read a string value as float or 
int value


As you can probably imagine the Problem is that I want to avoid
to store everything in a String and parse the numbers from that String.
In my eyes this rules out the usage of for example StringLists or 
StringArrays

I guess in this situation it is recommendable to use an FSList instead 
of an FSArray as the numbers of elements can change.

But that is basically where I got stuck. Especially the "type checking" is something which
I can not get solved

Can someone provide me code snippets how to achieve this?

Ingo
Mime
View raw message