if (tag || all) {
System.err.println("Training tagger");
System.err.println("Loading Dictionary");
Dictionary tridict = new Dictionary(dictFile.toString());
opennlp.maxent.EventStream tes = new ParserEventStream(new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(inFile)), rules, EventTypeEnum.TAG,tridict);
GISModel tagModel = train(tes, iterations, cutoff);
System.out.println("Saving the tagger model as: " + tagFile);
new opennlp.maxent.io.SuffixSensitiveGISModelWriter(tagModel, tagFile).persist();
}
if (chunk || all) {
System.err.println("Training chunker");
opennlp.maxent.EventStream ces = new ParserEventStream(new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(inFile)), rules, EventTypeEnum.CHUNK);
GISModel chunkModel = train(ces, iterations, cutoff);
System.out.println("Saving the chunker model as: " + chunkFile);
new opennlp.maxent.io.SuffixSensitiveGISModelWriter(chunkModel, chunkFile).persist();
}
if (build || all) {
System.err.println("Loading Dictionary");
Dictionary tridict = new Dictionary(dictFile.toString());
System.err.println("Training builder");
opennlp.maxent.EventStream bes = new ParserEventStream(new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(inFile)), rules, EventTypeEnum.BUILD,tridict);
GISModel buildModel = train(bes, iterations, cutoff);
System.out.println("Saving the build model as: " + buildFile);
new opennlp.maxent.io.SuffixSensitiveGISModelWriter(buildModel, buildFile).persist();
}
if (check || all) {
System.err.println("Training checker");
opennlp.maxent.EventStream kes = new ParserEventStream(new opennlp.maxent.PlainTextByLineDataStream(new java.io.FileReader(inFile)), rules, EventTypeEnum.CHECK);
GISModel checkModel = train(kes, iterations, cutoff);
System.out.println("Saving the check model as: " + checkFile);
new opennlp.maxent.io.SuffixSensitiveGISModelWriter(checkModel, checkFile).persist();
}
}