dkpro / dkpro-tc

UIMA-based text classification framework built on top of DKPro Core and DKPro Lab.
https://dkpro.github.io/dkpro-tc/
Other
34 stars 19 forks source link

Allow passing an outcome converter to TcAnnotator #456

Closed reckart closed 6 years ago

reckart commented 6 years ago

Currently, to use TcAnnotator in a production environment, one has to wrap it in another UIMA component which delegates to the TcAnnotator in its process method and after running it picks up the TextClassificationOutcome annotations, creates the actually desired outcome annotations and then removes the outcomes.

In order to avoid the need for creating a wrapper UIMA component all the time, it might be a nice idea to pass the name of a converter class to TcAnnotator which would be called with the JCas as an argument after TcAnnotator completes its process method - thus the conversion can happen within the scope of the TcAnnotator.

Horsmann commented 6 years ago

@reckart One could also pass the name of the annotation directly with the field-name? I am not sure how the API looks for this but this would probably most straight forward? It was possible to reference the field of an annotation by a string-name, right?

reckart commented 6 years ago

I think the conversion process of outcome to actual annotation may be more complicated than the case that simply creating an instance of AnnotationFS and setting a field on it:

Horsmann commented 6 years ago

Ok. I uploaded a change. There is a test case in the example project in the package org.dkpro.tc.tcAnnotator that demonstrates / test using such a conversion annotator.

Horsmann commented 6 years ago

@reckart Is the current implementation what you had in mind?