.validateArguments(args, EvaluatorParams.class)) {
System.err.println(getHelp());
throw new TerminateToolException(1);
}
EvaluatorParams params = ArgumentParser.parse(args,
EvaluatorParams.class);
Charset encoding = params.getEncoding();
TokenizerModel model = new TokenizerModelLoader().load(params.getModel());
TokenizerEvaluationMonitor missclassifiedListener = null;
if (params.getMisclassified()) {
missclassifiedListener = new TokenEvaluationErrorListener();
}
TokenizerEvaluator evaluator = new TokenizerEvaluator(
new opennlp.tools.tokenize.TokenizerME(model), missclassifiedListener);
System.out.print("Evaluating ... ");
File testData = params.getData();
CmdLineUtil.checkInputFile("Test data", testData);
ObjectStream<TokenSample> sampleStream = TokenizerTrainerTool
.openSampleData("Test", testData, encoding);