/** * Trains a new model * * @param es * @param iterations * @param cut * @return the new model * @throws IOException */ @Deprecated public static AbstractModel trainMaxentModel(EventStream es, int iterations, int cut) throws IOException { return opennlp.maxent.GIS.trainModel(iterations, new TwoPassDataIndexer(es, cut)); }
tmp.deleteOnExit(); Writer osw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmp),"UTF8")); int numEvents = computeEventCounts(eventStream, osw, predicateIndex, cutoff); System.out.println("done. " + numEvents + " events"); eventsToCompare = index(numEvents, fes, predicateIndex); } finally { fes.close(); System.out.print("Collecting events... "); sortAndMerge(eventsToCompare,sort); System.out.println("Done indexing.");
eventStore.write(FileEventStream.toLine(ev)); String[] ec = ev.getContext(); update(ec,predicateSet,counter,cutoff);
outcomeLabels = toIndexedStringArray(omap); predLabels = toIndexedStringArray(predicateIndex); return eventsToCompare;
outcomeLabels = toIndexedStringArray(omap); predLabels = toIndexedStringArray(predicateIndex); return eventsToCompare;
public static AbstractModel trainPerceptronModel(EventStream es, int iterations, int cut, boolean useAverage) throws IOException { return new opennlp.perceptron.PerceptronTrainer().trainModel(iterations, new TwoPassDataIndexer(es, cut, false), cut, useAverage); }
tmp.deleteOnExit(); Writer osw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmp),"UTF8")); int numEvents = computeEventCounts(eventStream, osw, predicateIndex, cutoff); System.out.println("done. " + numEvents + " events"); eventsToCompare = index(numEvents, fes, predicateIndex); } finally { fes.close(); System.out.print("Collecting events... "); sortAndMerge(eventsToCompare,sort); System.out.println("Done indexing.");
eventStore.write(FileEventStream.toLine(ev)); String[] ec = ev.getContext(); update(ec,predicateSet,counter,cutoff);
GISModel model = GIS.trainModel(100, new TwoPassDataIndexer(es, 3));//<co id="atc.train.do"/> new DoccatModel("en", model).serialize(new FileOutputStream(outFile));
indexer = new TwoPassDataIndexer(hses, cutoff, sortAndMerge);
indexer = new TwoPassDataIndexer(hses, cutoff, sortAndMerge);
/** * * @param samples * @param tagDictionary * @param ngramDictionary * @param cutoff * * @throws IOException its throws if an {@link IOException} is thrown * during IO operations on a temp file which is created during training occur. */ public static POSModel train(String languageCode, ObjectStream<POSSample> samples, POSDictionary tagDictionary, Dictionary ngramDictionary, int cutoff, int iterations) throws IOException { GISModel posModel = opennlp.maxent.GIS.trainModel(iterations, new TwoPassDataIndexer(new POSSampleEventStream(samples, new DefaultPOSContextGenerator(ngramDictionary)), cutoff)); return new POSModel(languageCode, posModel, tagDictionary, ngramDictionary); }