Search in sources :

Example 1 with ExecutionException

use of gate.creole.ExecutionException in project gate-core by GateNLP.

the class CorpusBenchmarkTool method processDocument.

// evaluateMarkedClean
protected void processDocument(Document doc) {
    try {
        if (application instanceof CorpusController) {
            Corpus tempCorpus = Factory.newCorpus("temp");
            tempCorpus.add(doc);
            ((CorpusController) application).setCorpus(tempCorpus);
            application.execute();
            Factory.deleteResource(tempCorpus);
            tempCorpus = null;
        } else {
            Iterator<ProcessingResource> iter = application.getPRs().iterator();
            while (iter.hasNext()) iter.next().setParameterValue("document", doc);
            application.execute();
        }
    } catch (ResourceInstantiationException ex) {
        throw (RuntimeException) new RuntimeException("Error executing application: " + ex.getMessage()).initCause(ex);
    } catch (ExecutionException ex) {
        throw (RuntimeException) new RuntimeException("Error executing application: " + ex.getMessage()).initCause(ex);
    }
}
Also used : CorpusController(gate.CorpusController) ProcessingResource(gate.ProcessingResource) ExecutionException(gate.creole.ExecutionException) Corpus(gate.Corpus) ResourceInstantiationException(gate.creole.ResourceInstantiationException)

Aggregations

Corpus (gate.Corpus)1 CorpusController (gate.CorpusController)1 ProcessingResource (gate.ProcessingResource)1 ExecutionException (gate.creole.ExecutionException)1 ResourceInstantiationException (gate.creole.ResourceInstantiationException)1