if (params.getDetailedF()) {
detailedFMeasureListener = new ChunkerDetailedFMeasureListener();
listeners.add(detailedFMeasureListener);
}
ChunkerCrossValidator validator;
try {
ChunkerFactory chunkerFactory = ChunkerFactory
.create(params.getFactory());
validator = new ChunkerCrossValidator(params.getLang(), mlParams,
chunkerFactory,
listeners.toArray(new ChunkerEvaluationMonitor[listeners.size()]));
validator.evaluate(sampleStream, params.getFolds());
}
catch (IOException e) {
throw new TerminateToolException(-1, "IO error while reading training data or indexing data: " +
e.getMessage(), e);
}
finally {
try {
sampleStream.close();
} catch (IOException e) {
// sorry that this can fail
}
}
if (detailedFMeasureListener == null) {
FMeasure result = validator.getFMeasure();
System.out.println(result.toString());
} else {
System.out.println(detailedFMeasureListener.toString());
}
}