uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksandar Dimitrov <aleks.dimit...@gmail.com>
Subject Using OpenNLP type annotations with UIMAfit
Date Sun, 25 Jan 2015 21:59:45 GMT
Hi,

The UIMAfit manual (5.1) states that the preferred way to iterate over tokens in
the CAS is the following:

    // JCas version
    for (Token token : JCasUtil.select(jcas, Token.class)) {
      ...
    }

This assumes a Token.class is importable somewhere. But I'm using the OpenNLP
tools, which don't provide such a type. Instead, it seems to be generated at run
time during configuration steps, and is not accessible as a class in the AE (to
my knowledge.)

Additionally, when extending o.a.u.fit.component.JCasAnnotator_ImplBase instead
of o.a.u.component.JCasAnnotator_ImplBase, the method void typeSystemInit(TypeSytem)
is not provided, which makes instatiating the type system the same way OpenNLP
does it rather cumbersome (I generate an empty CAS with the typSystemDescription,
then get its TypSystem and provide the Type and Feature objects from this
TypeSystem instance as UIMAfit configuration parameters before deploying my AE.)

Even then, I can only use the less type-safe method of iterating over
annotations: for (AnnotationFS token : cas.getAnnotationIndex(tokenType)) where
tokenType is the Type instance I acquired from the TypeSystem either during
typeSystemInit() or during configuration with the above hack.

Is there some good way of solving this dilemma while still using UIMAfit's
classes? Obviously, I could go back to using just plain UIMA, but I quite like
UIMAfit's way of dealing with external resources! And I don't like the
type-system-through-cas hack.

I'm using opennlp-uima 1.5.3 and uima-fit 2.1.0, uima 2.6.0.

Cheers,
Aleks

Mime
View raw message