uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <eckar...@tk.informatik.tu-darmstadt.de>
Subject Re: AW: Annotation/Feature creation, changing types
Date Wed, 07 Dec 2011 08:20:26 GMT
You cannot modify the type system of a CAS once the CAS has been created. For that reason,
UIMA creates a merged type system of all types referenced in any pipeline component before
creating the first CAS to pass through the pipeline. It is not possible to add types piece
by piece to the type system of an instantiated CAS. 

Cheers,

-- Richard

Am 07.12.2011 um 07:26 schrieb Armin.Wegner@bka.bund.de:

> Hi Tomas,
> 
> you can get rid of the Java classes for annotation types by using CAS instead of JCas.
This is a little less comfortable than with JCas. But you still need to have a type system.
With CAS you can generate new types at runtime. This is very nice for testing with JUnit.
But I don't think that you can do it from within an annotator. Has anyone tried to do this?
> 
> Regards,
> 
> Armin
> 
> -----Urspr√ľngliche Nachricht-----
> Von: Thilo Goetz [mailto:twgoetz@gmx.de] 
> Gesendet: Dienstag, 6. Dezember 2011 22:04
> An: user@uima.apache.org
> Betreff: Re: Annotation/Feature creation, changing types
> 
> On 06/12/11 20:47, Tomas By wrote:
>> Hi all,
>> 
>> I am wondering if it is possible to (for example) first create an 
>> annotation or a feature that has no type, and then set the type in a second step.
>> 
>> From looking at the docs, it seems there is no obvious way to do this.
> 
> Correct, there is no way to do this.  Every FS must have a type, and you must specify
that type when you create the FS.
> 
>> 
>> I want this for two reasons: (1) I have a lexicon lookup module that 
>> reads annotation and attribute (ie feature) types as part of the data, 
>> and (2) I want to not have to recompile this module every time the 
>> UIMA type system changes. Put another way, I want the lexicon lookup 
>> module to be totally independent of the type system. If the user 
>> provides lexicon data that is not compatible with the type system, 
>> then that should (I suppose) trigger an error at module initialization.
>> 
>> So suppose my data looks like this:
>> 
>> "word" ANNOTATIONTYPE [ MYTYPE = VALUE, ... ] ...
>> 
>> Then for every occurrence of "word" in the text, the module adds an 
>> annotation of the type ANNOTATIONTYPE with the given attributes.
>> 
>> At the moment, I have a long conditional that looks like this:
>> 
>> | if (atp.equals(\"MYTYPE\")) {
>> |   a.setMytype(value);
>> | }
>> 
>> That is, I have a hard-coded, type-system-specific mapping from 
>> strings that are names of types, to the UIMA Java objects of the same name.
>> 
>> Is there any way to do this in a more general way so that it is 
>> independent of the type system?
> 
> 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.
> 
> You can do the usual trick and emulate a map by, for example, having two parallel arrays,
one with the feature names and the other one with the values.  A bit cumbersome, but doable
if that satisfies your requirement.
> 
> You would make all structures of the same annotation type.
> 
> Does that make sense?
> 
> --Thilo
> 
>> 
>> /Tomas

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universität Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckartde@tk.informatik.tu-darmstadt.de 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
------------------------------------------------------------------- 





Mime
View raw message