On 07/12/11 07:44, [email protected] wrote:
> 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
> 

I agree with Armin, see also his other mail.  If that is your issue, you
can use the somewhat more cumbersome, but more flexible, CAS API.  It's
a meta API like, e.g., JDBC.  You can write code that will work with
any type system.  We use this API in our own generic tools, like the
CVD.

--Thilo

> 
> -----Ursprüngliche Nachricht-----
> Von: Tomas By [mailto:[email protected]] 
> Gesendet: Mittwoch, 7. Dezember 2011 07:21
> An: [email protected]
> 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
> 
> 
> 

Reply via email to