ACRF.Template[] tmpls = parseModelFile (modelFile.value);
ACRFExtractorTrainer trainer = createTrainer (trainerOption.value);
ACRFEvaluator eval = createEvaluator (evalOption.value);
ExtractionEvaluator extractionEval = createExtractionEvaluator (extractionEvalOption.value);
Inferencer inf = createInferencer (inferencerOption.value);
Inferencer maxInf = createInferencer (maxInferencerOption.value);
trainer.setPipes (tokPipe, new TokenSequence2FeatureVectorSequence ())
.setDataSource (trainSource, testSource)
.setEvaluator (eval)
.setTemplates (tmpls)
.setInferencer (inf)
.setViterbiInferencer (maxInf)
.setCheckpointDirectory (outputPrefix.value)
.setNumCheckpointIterations (checkpointIterations.value)
.setCacheUnrolledGraphs (cacheUnrolledGraph.value)
.setUsePerTemplateTrain (perTemplateTrain.value)
.setPerTemplateIterations (pttIterations.value);
logger.info ("Starting training...");
ACRFExtractor extor = trainer.trainExtractor ();
timing.tick ("Training");
FileUtils.writeGzippedObject (new File (outputPrefix.value, "extor.ser.gz"), extor);
timing.tick ("Serializing");
InstanceList testing = trainer.getTestingData ();
if (testing != null) {
eval.test (extor.getAcrf (), testing, "Final results");
}
if ((extractionEval != null) && (testing != null)) {
Extraction extraction = extor.extract (testing);
extractionEval.evaluate (extraction);
timing.tick ("Evaluting");
}
System.out.println ("Total time (ms) = " + timing.elapsedTime ());
}