@Override public void process(JCas jcas) throws AnalysisEngineProcessException { try { File tempFile = createInputFile(jcas); File prediction = runPrediction(tempFile); List<TextClassificationOutcome> outcomes = getOutcomeAnnotations(jcas); List<String> writtenPredictions = FileUtils.readLines(prediction, "utf-8"); checkErrorConditionNumberOfOutcomesEqualsNumberOfPredictions(outcomes, writtenPredictions); for (int i = 0; i < outcomes.size(); i++) { if (isRegression()) { String val = writtenPredictions.get(i); outcomes.get(i).setOutcome(val); } else { String val = writtenPredictions.get(i).replaceAll("\\.0", ""); String pred = integer2OutcomeMapping.get(val); outcomes.get(i).setOutcome(pred); } } } catch (Exception e) { throw new AnalysisEngineProcessException(e); } }
@Override public void process(JCas aJCas) throws AnalysisEngineProcessException { try { File tempFile = createInputFile(aJCas); File prediction = runPrediction(tempFile); List<TextClassificationOutcome> outcomes = getOutcomeAnnotations(aJCas); List<String> writtenPredictions = FileUtils.readLines(prediction, UTF_8); checkErrorConditionNumberOfOutcomesEqualsNumberOfPredictions(outcomes, writtenPredictions); for (int i = 0; i < outcomes.size(); i++) { if (isRegression()) { String val = writtenPredictions.get(i); outcomes.get(i).setOutcome(val); } else { String val = writtenPredictions.get(i).replaceAll("\\.0", ""); String pred = integer2OutcomeMapping.get(val); outcomes.get(i).setOutcome(pred); } } } catch (Exception e) { throw new AnalysisEngineProcessException(e); } }