ModelUtil.addCutoffAndIterations(manifestInfoEntries, cut, iterations);
// build
System.err.println("Training builder");
opennlp.model.EventStream bes = new ParserEventStream(parseSamples, rules, ParserEventTypeEnum.BUILD, mdict);
HashSumEventStream hsbes = new HashSumEventStream(bes);
AbstractModel buildModel = train(hsbes, iterations, cut);
manifestInfoEntries.put("Training-Builder-Eventhash",
hsbes.calculateHashSum().toString(16));
parseSamples.reset();
// tag
POSModel posModel = POSTaggerME.train(languageCode, new PosSampleStream(parseSamples),
ModelType.MAXENT, null, null, cut, iterations);
parseSamples.reset();
// chunk
ChunkerModel chunkModel = ChunkerME.train(languageCode,
new ChunkSampleStream(parseSamples), cut, iterations,
new ChunkContextGenerator());
parseSamples.reset();
// check
System.err.println("Training checker");
opennlp.model.EventStream kes = new ParserEventStream(parseSamples, rules, ParserEventTypeEnum.CHECK);
HashSumEventStream hskes = new HashSumEventStream(kes);
AbstractModel checkModel = train(hskes, iterations, cut);
manifestInfoEntries.put("Training-Checker-Eventhash",
hskes.calculateHashSum().toString(16));
// TODO: Remove cast for HeadRules
return new ParserModel(languageCode, buildModel, checkModel,
posModel, chunkModel, (opennlp.tools.parser.lang.en.HeadRules) rules,
ParserType.CHUNKING, manifestInfoEntries);