Search in sources :

Example 1 with AnalysisComponent

use of org.apache.uima.analysis_component.AnalysisComponent in project dkpro-tc by dkpro.

the class TcAnnotator method callConversionEngine.

private void callConversionEngine(JCas aJCas) throws AnalysisEngineProcessException {
    String name = conversionAnnotator[0];
    Object[] parameters = new String[0];
    if (conversionAnnotator.length > 1) {
        parameters = new String[conversionAnnotator.length - 1];
        System.arraycopy(conversionAnnotator, 1, parameters, 0, conversionAnnotator.length - 1);
    }
    try {
        @SuppressWarnings("unchecked") Class<? extends AnalysisComponent> forName = (Class<? extends AnalysisComponent>) Class.forName(name);
        AnalysisEngine conversionEngine = AnalysisEngineFactory.createEngine(forName, parameters);
        conversionEngine.process(aJCas);
    } catch (Exception e) {
        throw new AnalysisEngineProcessException(e);
    }
    for (TextClassificationOutcome o : JCasUtil.select(aJCas, TextClassificationOutcome.class)) {
        o.removeFromIndexes();
    }
}
Also used : TextClassificationOutcome(org.dkpro.tc.api.type.TextClassificationOutcome) AnalysisComponent(org.apache.uima.analysis_component.AnalysisComponent) AnalysisEngineProcessException(org.apache.uima.analysis_engine.AnalysisEngineProcessException) ResourceInitializationException(org.apache.uima.resource.ResourceInitializationException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) AnalysisEngineProcessException(org.apache.uima.analysis_engine.AnalysisEngineProcessException) AnalysisEngine(org.apache.uima.analysis_engine.AnalysisEngine)

Aggregations

IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 AnalysisComponent (org.apache.uima.analysis_component.AnalysisComponent)1 AnalysisEngine (org.apache.uima.analysis_engine.AnalysisEngine)1 AnalysisEngineProcessException (org.apache.uima.analysis_engine.AnalysisEngineProcessException)1 ResourceInitializationException (org.apache.uima.resource.ResourceInitializationException)1 TextClassificationOutcome (org.dkpro.tc.api.type.TextClassificationOutcome)1