uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomas By" <...@cmu.edu>
Subject Re: AW: Annotation/Feature creation, changing types
Date Wed, 07 Dec 2011 13:25:06 GMT
Thilo; Armin,

Thanks, this looks good. Will try that.

I seem to remember trying to use cas.getTypeSystem but no being
successful for a reason I cannot now recall. createAnnotation OTOH
is precisely what I spent a good while looking for in the docs and
not finding.

/Tomas



On Wed, December 7, 2011 4:07 pm, Thilo Goetz wrote:
> On 07/12/11 07:44, Armin.Wegner@bka.bund.de 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: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