Re: how to dynamically set a required annotation type from within a UIMAfit annotator?

2013-12-06 Thread Renaud Richardet
@Richard,
Thanks for your explanation; it seems that it would be quite a deep code
change, and in my usecase not worth the trouble.

@Thomas,
Thanks for sharing your project with us. However, I looked at UIMA-AS, and
found it too complicated for my taste.

My poor-man's solution will be to show a warning to the user when a
dynamic annotator gets instantiated.

Greetings, Renaud


Re: how to dynamically set a required annotation type from within a UIMAfit annotator?

2013-12-05 Thread Richard Eckart de Castilho
To my knowledge, the capabilities are part of the descriptor which must be 
available before the AE is initialized. You cannot retroactively change the
descriptor of a method from within its initialize() method.

It would be nice to have something like this, though. But that would also mean
switching any flow controllers which use this information from a static planning
to a dynamic planning approach.

How about filing a feature request against the UIMA framework?

-- Richard

On 05.12.2013, at 08:35, Renaud Richardet renaud.richar...@gmail.com wrote:

 I find it very convenient to add
 
 @TypeCapability(inputs = { TOKEN, SENTENCE, COOCCURRENCE })
 so that I can ensure that dependencies are met. But sometimes, the
 dependencies are dynamic (e.g. an input type capability is part of the
 config of an annotator, and is loaded dynamically, see code below).
 
 Is there a way to dynamically set a required annotation type from within a
 UIMAfit annotator? Something like:
 
@Override
 
public void initialize(UimaContext context)
 
throws ResourceInitializationException {
 
super.initialize(context);
 
try {
 
// loading annotation class dynamically
 
requiredAnnotation= (Class? extends Annotation) Class.forName(
 org.uima.MyRequiredAnnotation);
 
// adding it as TypeCapability's input
 
context.getMetadata().addCapabilityInput(requiredAnnotation);
 
} catch (Exception e) {
 
throw new ResourceInitializationException(e);
 
}
 
}
 
 
 Thanks, Renaud



Re: how to dynamically set a required annotation type from within a UIMAfit annotator?

2013-12-05 Thread Thomas Ginter
Renaud,

We (clinical NLP group at the University of Utah) have written a platform that 
sits on top of UIMA-AS that will allow you to dynamically assign and even 
generate types for annotation engines.  We have a whole family of annotators 
whose parameters are dynamic using this platform.  We are almost ready to 
release this as open source, though it is still probably another month or two 
out.  Until that time we are open to collaboration opportunities to wherein we 
give you access to the software and teach you how it is used.

Thanks,

Thomas Ginter
801-448-7676
thomas.gin...@utah.edu




On Dec 5, 2013, at 3:43 AM, Richard Eckart de Castilho r...@apache.org wrote:

 To my knowledge, the capabilities are part of the descriptor which must be 
 available before the AE is initialized. You cannot retroactively change the
 descriptor of a method from within its initialize() method.
 
 It would be nice to have something like this, though. But that would also mean
 switching any flow controllers which use this information from a static 
 planning
 to a dynamic planning approach.
 
 How about filing a feature request against the UIMA framework?
 
 -- Richard
 
 On 05.12.2013, at 08:35, Renaud Richardet renaud.richar...@gmail.com wrote:
 
 I find it very convenient to add
 
 @TypeCapability(inputs = { TOKEN, SENTENCE, COOCCURRENCE })
 so that I can ensure that dependencies are met. But sometimes, the
 dependencies are dynamic (e.g. an input type capability is part of the
 config of an annotator, and is loaded dynamically, see code below).
 
 Is there a way to dynamically set a required annotation type from within a
 UIMAfit annotator? Something like:
 
   @Override
 
   public void initialize(UimaContext context)
 
   throws ResourceInitializationException {
 
   super.initialize(context);
 
   try {
 
   // loading annotation class dynamically
 
   requiredAnnotation= (Class? extends Annotation) Class.forName(
 org.uima.MyRequiredAnnotation);
 
   // adding it as TypeCapability's input
 
   context.getMetadata().addCapabilityInput(requiredAnnotation);
 
   } catch (Exception e) {
 
   throw new ResourceInitializationException(e);
 
   }
 
   }
 
 
 Thanks, Renaud