You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Tomas By <tb...@cmu.edu> on 2011/12/06 20:47:47 UTC

Annotation/Feature creation, changing types

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.

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?

/Tomas



Re: AW: Annotation/Feature creation, changing types

Posted by Richard Eckart de Castilho <ec...@tk.informatik.tu-darmstadt.de>.
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
------------------------------------------------------------------- 





AW: Annotation/Feature creation, changing types

Posted by Ar...@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
> 
> 



Re: Annotation/Feature creation, changing types

Posted by Thilo Goetz <tw...@gmx.de>.
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
> 
> 


Re: AW: Annotation/Feature creation, changing types

Posted by Thilo Goetz <tw...@gmx.de>.
Forgot to add a link to the docs:
http://uima.apache.org/d/uimaj-2.3.1/references.html#ugr.ref.cas

On 07/12/11 14:07, 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
>>
>>
>>
> 


Re: AW: Annotation/Feature creation, changing types

Posted by Thilo Goetz <tw...@gmx.de>.
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
> 
> 
> 


Re: AW: Annotation/Feature creation, changing types

Posted by Tomas By <tb...@cmu.edu>.
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
>>
>>
>>
>>
>
>
>



AW: Annotation/Feature creation, changing types

Posted by Ar...@bka.bund.de.
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




Re: AW: Annotation/Feature creation, changing types

Posted by Tomas By <to...@qatar.cmu.edu>.
Armin,

I am happy to report that this works fine.

The last call should be "addFsToIndexes" (typo I guess).

/Tomas



On Wed, December 7, 2011 9:44 am, Armin.Wegner@bka.bund.de wrote:
> try this in your annotator:
>
> final Type type = cas.getTypeSystem().getType(X);
> cas.addFsIndexes(cas.createAnnotation(type,begin,end));



Re: Annotation/Feature creation, changing types

Posted by fr...@gmail.com.
ah sorry this is it ? 
> 
> final Type type = cas.getTypeSystem().getType(X);
> cas.addFsIndexes(cas.createAnnotation(type, begin, end)
> 


ok i try it right now :)  

-- 
francesco.tangari.inf@gmail.com
Inviato con Sparrow (http://www.sparrowmailapp.com/?sig)


Il giorno sabato 10 dicembre 2011, alle ore 15.58, francesco.tangari.inf@gmail.com ha scritto: 

> Please you can show me how to get the Matched Word with the pattern? please please just pastbin the code thank you .
> 
> -- 
> francesco.tangari.inf@gmail.com (mailto:francesco.tangari.inf@gmail.com)
> Inviato con Sparrow (http://www.sparrowmailapp.com/?sig)
> 
> 
> Il giorno sabato 10 dicembre 2011, alle ore 15.56, Tomas By ha scritto: 
> 
> > Armin,
> > 
> > I am happy to report that this works fine.
> > 
> > The last call should be "addFsToIndexes" (typo I guess).
> > 
> > /Tomas
> > 
> > 
> > 
> > On Wed, December 7, 2011 9:44 am, Armin.Wegner@bka.bund.de (mailto:Armin.Wegner@bka.bund.de) wrote:
> > > try this in your annotator:
> > > 
> > > final Type type = cas.getTypeSystem().getType(X);
> > > cas.addFsIndexes(cas.createAnnotation(type, begin, end));
> > > 
> > 
> > 
> > 
> > 
> 
> 


Re: Annotation/Feature creation, changing types

Posted by fr...@gmail.com.
Please you can show me how to get the Matched Word with the pattern? please please just pastbin the code thank you .

-- 
francesco.tangari.inf@gmail.com
Inviato con Sparrow (http://www.sparrowmailapp.com/?sig)


Il giorno sabato 10 dicembre 2011, alle ore 15.56, Tomas By ha scritto: 

> Armin,
> 
> I am happy to report that this works fine.
> 
> The last call should be "addFsToIndexes" (typo I guess).
> 
> /Tomas
> 
> 
> 
> On Wed, December 7, 2011 9:44 am, Armin.Wegner@bka.bund.de (mailto:Armin.Wegner@bka.bund.de) wrote:
> > try this in your annotator:
> > 
> > final Type type = cas.getTypeSystem().getType(X);
> > cas.addFsIndexes(cas.createAnnotation(type, begin, end));
> > 
> 
> 
> 



Re: Annotation/Feature creation, changing types

Posted by Tomas By <to...@qatar.cmu.edu>.
On Sat, December 10, 2011 5:58 pm, francesco.tangari.inf@gmail.com wrote:
> Please you can show me how to get the Matched Word with the pattern?

It's not really clear what exactly you are asking for.

Do you feel that you understand the concept of "annotation"?

If so, are there annotations in the right places after you run the
annotator?

Then your problem may be that you do not know how to access them.
Generally, you first get all annotations of the type you want, and then
iterate through them.

If there are not annotations in the right places, then maybe the pattern
is wrong. In that case, please post the pattern you are using (and an
example of the data).

Or perhaps you do not know how to inspect the cas? There are various
tools for that.

Please try to post a more specific query, or explain things better.

/Tomas



Re: Annotation/Feature creation, changing types

Posted by fr...@gmail.com.
first of all thx for the reply. the Annotator is this one http://pastebin.com/44EcubqC    very simple regular expression Annotator. And this is called by this http://pastebin.com/6vwuRvvt. But it dose not print the Matched "Word" , "text" , instead , it show me  the full Line that i read from file ( i don't want that). 


-- 
francesco.tangari.inf@gmail.com
Inviato con Sparrow (http://www.sparrowmailapp.com/?sig)


Il giorno sabato 10 dicembre 2011, alle ore 16.26, Tomas By ha scritto: 

> On Sat, December 10, 2011 5:58 pm, francesco.tangari.inf@gmail.com (mailto:francesco.tangari.inf@gmail.com) wrote:
> > Please you can show me how to get the Matched Word with the pattern?
> 
> 
> It's not really clear what exactly you are asking for.
> 
> Do you feel that you understand the concept of "annotation"?
> 
> If so, are there annotations in the right places after you run the
> annotator?
> 
> Then your problem may be that you do not know how to access them.
> Generally, you first get all annotations of the type you want, and then
> iterate through them.
> 
> If there are not annotations in the right places, then maybe the pattern
> is wrong. In that case, please post the pattern you are using (and an
> example of the data).
> 
> Or perhaps you do not know how to inspect the cas? There are various
> tools for that.
> 
> Please try to post a more specific query, or explain things better.
> 
> /Tomas 


Re: Annotation/Feature creation, changing types

Posted by Tomas By <tb...@cmu.edu>.
On Sat, December 10, 2011 5:58 pm, francesco.tangari.inf@gmail.com wrote:
> Please you can show me how to get the Matched Word with the pattern?

It's not really clear what exactly you are asking for.

Do you feel that you understand the concept of "annotation"?

If so, are there annotations in the right places after you run the
annotator?

Then your problem may be that you do not know how to access them.
Generally, you first get all annotations of the type you want, and then
iterate through them.

If there are not annotations in the right places, then maybe the pattern
is wrong. In that case, please post the pattern you are using (and an
example of the data).

Or perhaps you do not know how to inspect the cas? There are various
tools for that.

Please try to post a more specific query, or explain things better.

/Tomas



Re: AW: Annotation/Feature creation, changing types

Posted by Tomas By <tb...@cmu.edu>.
Armin,

I am happy to report that this works fine.

The last call should be "addFsToIndexes" (typo I guess).

/Tomas



On Wed, December 7, 2011 9:44 am, Armin.Wegner@bka.bund.de wrote:
> try this in your annotator:
>
> final Type type = cas.getTypeSystem().getType(X);
> cas.addFsIndexes(cas.createAnnotation(type, begin, end));



Re: Annotation/Feature creation, changing types

Posted by Tomas By <tb...@cmu.edu>.
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