// build
System.err.println("Training builder");
ObjectStream<Event> bes = new ParserEventStream(parseSamples, rules,
ParserEventTypeEnum.BUILD, mdict);
Map<String, String> buildReportMap = new HashMap<String, String>();
MaxentModel 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");
ObjectStream<Event> kes = new ParserEventStream(parseSamples, rules,
ParserEventTypeEnum.CHECK);
Map<String, String> checkReportMap = new HashMap<String, String>();
MaxentModel 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");
ObjectStream<Event> attachEvents = new ParserEventStream(parseSamples, rules,
ParserEventTypeEnum.ATTACH);
Map<String, String> attachReportMap = new HashMap<String, String>();
MaxentModel 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,