uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: Is it possible to define dynamically typed annotations?
Date Sat, 15 Dec 2018 18:15:15 GMT
I guess the question is why have a new type?  The answer to that could motivate
what properties the solution should have.

What you propose is fine, but in some ways is not a new type, in that it doesn't
seem to have many of the properties UIMA types have. 

    If that is OK in your application, then that's fine. 

    If not, please say more about what properties of types you want to have,
    that this approach might not satisfy.

Here's some examples of what having types provides:

1) a type hierarchy - subtypes have features inherited from super types.

2) a way to have "indexes" which provide access to a type (and its subtypes)
instances in the CAS.

3) a way to have getters / setters, with special versions for "array" types that
give access to elements

4) for some types, a way to "order" them in the CAS.  For instance, if a type is
a subtype of "Annotation", it gets (via inheritance) a begin and end "feature",
and there's a built-in index that is sorted, making use of these features (and
also making use of "type priority" ordering).

Note that if you don't need this for your types, then they should *not* be
subtypes of Annotation.

5) a way to serialize / deserialize (in several formats) for storage and
transmission (for instance, when some annotators in a pipeline are remote

Your suggestion to have a general Map<String,Object> might be an issue for
serialization / deserialization.


On 12/15/2018 7:20 AM, Alain Désilets wrote:
> Is it possible to create dynamically typed annotations in UIMA? In other
> words, would it be possible for users of my system to create a new type of
> annotation without having to recompile the Java code?
> I need this functionality so that non-dev users can define new types of
> Named Entities and train a model that can recognize them without having to
> recompile the code.
> I suspect the answer is no, because all annotation types correspond to a
> Java class. True, those classes are defined in an XML file, but in order to
> use them you have to generate the Java code from the XML and recompile your
> code.
> If UIMA does not yet have something that supports dynamic annotations, I
> will have to implement one myself. What I have in mind is to define a
> sub-class of Annotation called say, DynamicallTypedAnnotation, which would
> have two new member variables:
>     String typeName = null;
>     Map<String,Object> attributes = new HashMap<String,Object>();
> The 'typeName' variable would correspond to the type of the annotation (ex:
> "Room Number" for an annotation that captures the number of a room) and the
> 'attributes' variable would allow storage of arbitrary information about
> the annotation.
> Does that make sense?
> Thx

View raw message