// build
System.err.println("Training builder");
opennlp.model.EventStream bes = new ParserEventStream(parseSamples, rules,
ParserEventTypeEnum.BUILD, mdict);
Map<String, String> buildReportMap = new HashMap<String, String>();
AbstractModel buildModel = TrainUtil.train(bes, mlParams.getSettings("build"), buildReportMap);
opennlp.tools.parser.chunking.Parser.mergeReportIntoManifest(manifestInfoEntries, buildReportMap, "build");
parseSamples.reset();
// check
System.err.println("Training checker");
opennlp.model.EventStream kes = new ParserEventStream(parseSamples, rules,
ParserEventTypeEnum.CHECK);
Map<String, String> checkReportMap = new HashMap<String, String>();
AbstractModel checkModel = TrainUtil.train(kes, mlParams.getSettings("check"), checkReportMap);
opennlp.tools.parser.chunking.Parser.mergeReportIntoManifest(manifestInfoEntries, checkReportMap, "check");
parseSamples.reset();
// attach
System.err.println("Training attacher");
opennlp.model.EventStream attachEvents = new ParserEventStream(parseSamples, rules,
ParserEventTypeEnum.ATTACH);
Map<String, String> attachReportMap = new HashMap<String, String>();
AbstractModel attachModel = TrainUtil.train(attachEvents, mlParams.getSettings("attach"), attachReportMap);
opennlp.tools.parser.chunking.Parser.mergeReportIntoManifest(manifestInfoEntries, attachReportMap, "attach");
// TODO: Remove cast for HeadRules
return new ParserModel(languageCode, buildModel, checkModel,
attachModel, posModel, chunkModel,