uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Armin.Weg...@bka.bund.de>
Subject AW: Annotation/Feature creation, changing types
Date Wed, 07 Dec 2011 06:44:32 GMT
Hello Tomas,

try this in your annotator:

// cas is a CAS, not a JCas
final Type type = cas.getTypeSystem().getType(X);
// This is your X, a fully qualified name for one of the types in your type system.
// If type equals null, there is no type with this name in the type system. You may throw
an exception, e. g. a selfbuild UnknownUimaTypeException.
// Add an annotation of this type to the CAS.
cas.addFsIndexes(cas.createAnnotation(type, begin, end));

Regards,

Armin


-----Urspr√ľngliche Nachricht-----
Von: Tomas By [mailto:tby@cmu.edu] 
Gesendet: Mittwoch, 7. Dezember 2011 07:21
An: user@uima.apache.org
Betreff: Re: Annotation/Feature creation, changing types

Hi,

Thanks for the reply.

On Wed, December 7, 2011 12:04 am, Thilo Goetz wrote:
> On 06/12/11 20:47, Tomas By wrote:
>> So suppose my data looks like this:
>>
>> "word" ANNOTATIONTYPE [ MYTYPE = VALUE, ... ] ...
>
> Not in any way that still makes use of the UIMA data structures.  UIMA 
> is statically typed, so there's really no way to dynamically add 
> features at runtime.

Well, I do not actually need to add any types/features. The app has a type system, and the
user provides data for the lexicon lookup.

If those things do not match then that is an error condition.

The problem is that the way it works now I will have to recompile the lexicon lookup module
when the application type system changes, which seems unnecessary. The lex module should be
general and work with any type system.

What I need is a way to have a string "X", and be able to create an annotation or attribute
with the type X, for any value of X. If X happens to not be defined in the current type system
then it is just an error.

/Tomas




Mime
View raw message