Package opennlp.model

Examples of opennlp.model.EventStream


    }
    String dataFileName = args[ai++];
    String modelFileName = args[ai];
    try {
      FileReader datafr = new FileReader(new File(dataFileName));
      EventStream es;
      if (!real) {
        es = new BasicEventStream(new PlainTextByLineDataStream(datafr), ",");
      } else {
        es = new RealBasicEventStream(new PlainTextByLineDataStream(datafr));
      }
View Full Code Here


   
    AbstractModel posModel;
   
    if (!TrainUtil.isSequenceTraining(trainParams.getSettings())) {
     
      EventStream es = new POSSampleEventStream(samples, contextGenerator);
     
      posModel = TrainUtil.train(es, trainParams.getSettings(), manifestInfoEntries);
    }
    else {
      POSSampleSequenceStream ss = new POSSampleSequenceStream(samples, contextGenerator);
View Full Code Here

  public static TokenizerModel train(ObjectStream<TokenSample> samples, TokenizerFactory factory,
      TrainingParameters mlParams) throws IOException {

    Map<String, String> manifestInfoEntries = new HashMap<String, String>();

    EventStream eventStream = new TokSpanEventStream(samples,
        factory.isUseAlphaNumericOptmization(),
        factory.getAlphaNumericPattern(), factory.getContextGenerator());

    AbstractModel maxentModel = TrainUtil.train(eventStream,
        mlParams.getSettings(), manifestInfoEntries);
View Full Code Here

      throws IOException {
    Factory factory = new Factory();

    Map<String, String> manifestInfoEntries = new HashMap<String, String>();

    EventStream eventStream = new TokSpanEventStream(samples,
        useAlphaNumericOptimization, factory.getAlphanumeric(languageCode),
        factory.createTokenContextGenerator(languageCode,
            getAbbreviations(abbreviations)));

    AbstractModel maxentModel = TrainUtil.train(eventStream,
View Full Code Here

       featureGenerator = createFeatureGenerator();

     AbstractModel nameFinderModel;

     if (!TrainUtil.isSequenceTraining(trainParams.getSettings())) {
       EventStream eventStream = new NameFinderEventStream(samples, type,
           new DefaultNameContextGenerator(featureGenerator));

       nameFinderModel = TrainUtil.train(eventStream, trainParams.getSettings(), manifestInfoEntries);
     }
     else {
View Full Code Here

  public static final void main(String[] args) throws java.io.IOException {
    if (args.length != 0) {
      System.err.println("Usage: NameFinderEventStream < training files");
      System.exit(1);
    }
    EventStream es = new NameFinderEventStream(new NameSampleDataStream(
        new PlainTextByLineStream(new java.io.InputStreamReader(System.in))));
    while (es.hasNext()) {
      System.out.println(es.next());
    }
  }
View Full Code Here

      TrainingParameters mlParams) throws IOException {

    Map<String, String> manifestInfoEntries = new HashMap<String, String>();

    // TODO: Fix the EventStream to throw exceptions when training goes wrong
    EventStream eventStream = new SDEventStream(samples,
        sdFactory.getSDContextGenerator(), sdFactory.getEndOfSentenceScanner());

    AbstractModel sentModel = TrainUtil.train(eventStream,
        mlParams.getSettings(), manifestInfoEntries);
View Full Code Here

      ModelUtil.addCutoffAndIterations(manifestInfoEntries, cutoff, iterations);
     
      Factory factory = new Factory();

      // TODO: Fix the EventStream to throw exceptions when training goes wrong
      EventStream eventStream = new SDEventStream(samples,
          factory.createSentenceContextGenerator(languageCode),
          factory.createEndOfSentenceScanner(languageCode));
     
      HashSumEventStream hses = new HashSumEventStream(eventStream);
      GISModel sentModel = GIS.trainModel(hses, iterations, cutoff);
View Full Code Here

      throws IOException {
   
    Map<String, String> manifestInfoEntries = new HashMap<String, String>();
    ModelUtil.addCutoffAndIterations(manifestInfoEntries, cutoff, iterations);
   
    EventStream es = new ChunkerEventStream(in, contextGenerator);
    HashSumEventStream hses = new HashSumEventStream(es);
   
    AbstractModel maxentModel = opennlp.maxent.GIS.trainModel(iterations,
        new TwoPassDataIndexer(hses, cutoff));
   
View Full Code Here

     if (generator != null)
       featureGenerator = generator;
     else
       featureGenerator = createFeatureGenerator();
    
     EventStream eventStream = new NameFinderEventStream(samples, type,
         new DefaultNameContextGenerator(featureGenerator));
     HashSumEventStream hses = new HashSumEventStream(eventStream);
     AbstractModel nameFinderModel = GIS.trainModel(iterations, new TwoPassDataIndexer(hses, cutoff));
    
     manifestInfoEntries.put(BaseModel.TRAINING_EVENTHASH_PROPERTY,
View Full Code Here

TOP

Related Classes of opennlp.model.EventStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.