Examples of AbstractModel


Examples of opennlp.model.AbstractModel

public class MaxentPrepAttachTest {

  @Test
  public void testMaxentOnPrepAttachData() throws IOException {
    AbstractModel model =
        new GISTrainer(true).trainModel(100,
        new TwoPassDataIndexer(createTrainingStream(), 1), 1);

    testModel(model, 0.7997028967566229);
  }
View Full Code Here

Examples of opennlp.model.AbstractModel

    testModel(model, 0.7997028967566229);
  }
 
  @Test
  public void testMaxentOnPrepAttachData2Threads() throws IOException {
    AbstractModel model =
        new GISTrainer(true).trainModel(100,
            new TwoPassDataIndexer(createTrainingStream(), 1),
            new UniformPrior(), 1, 2);
   
    testModel(model, 0.7997028967566229);
View Full Code Here

Examples of opennlp.model.AbstractModel

    trainParams.put(TrainUtil.ALGORITHM_PARAM, TrainUtil.MAXENT_VALUE);
    trainParams.put(TrainUtil.DATA_INDEXER_PARAM,
        TrainUtil.DATA_INDEXER_TWO_PASS_VALUE);
    trainParams.put(TrainUtil.CUTOFF_PARAM, Integer.toString(1));
   
    AbstractModel model = TrainUtil.train(createTrainingStream(), trainParams, null);
   
    testModel(model, 0.7997028967566229);
  }
View Full Code Here

Examples of opennlp.model.AbstractModel

  public void testMaxentOnPrepAttachDataWithParamsDefault() throws IOException {
   
    Map<String, String> trainParams = new HashMap<String, String>();
    trainParams.put(TrainUtil.ALGORITHM_PARAM, TrainUtil.MAXENT_VALUE);
   
    AbstractModel model = TrainUtil.train(createTrainingStream(), trainParams, null);
   
    testModel(model, 0.8086159940579352 );
  }
View Full Code Here

Examples of opennlp.model.AbstractModel

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

    AbstractModel maxentModel = TrainUtil.train(eventStream,
        mlParams.getSettings(), manifestInfoEntries);

    return new TokenizerModel(languageCode, maxentModel, abbreviations,
        useAlphaNumericOptimization, manifestInfoEntries);
  }
View Full Code Here

Examples of opennlp.model.AbstractModel

       TrainingParameters mlParams, FeatureGenerator... featureGenerators)
   throws IOException {
    
     Map<String, String> manifestInfoEntries = new HashMap<String, String>();
    
     AbstractModel model = TrainUtil.train(
         new DocumentCategorizerEventStream(samples, featureGenerators),
         mlParams.getSettings(), manifestInfoEntries);
      
     return new DoccatModel(languageCode, model, manifestInfoEntries);
   }
View Full Code Here

Examples of opennlp.model.AbstractModel

        }
        else {
          es = new RealBasicEventStream(new PlainTextByLineDataStream(datafr));
        }
        GIS.SMOOTHING_OBSERVATION = SMOOTHING_OBSERVATION;
        AbstractModel model;
        if (type.equals("maxent")) {
       
          if (!real) {
            model = GIS.trainModel(es,USE_SMOOTHING);
          }
View Full Code Here

Examples of opennlp.model.AbstractModel

   * This particular example would of course be useful when you generally want
   * to create models which take up less space (.bin.gz), but want to be able to
   * inspect a few of them as plain text files.
   */
  public static void main(String[] args) throws IOException {
    AbstractModel m = new SuffixSensitiveGISModelReader(new File(args[0]))
        .getModel();
    new SuffixSensitiveGISModelWriter(m, new File(args[1])).persist();
  }
View Full Code Here

Examples of opennlp.model.AbstractModel

     if (generator != null)
       featureGenerator = generator;
     else
       featureGenerator = createFeatureGenerator();
    
     AbstractModel nameFinderModel;
    
     if (!TrainUtil.isSequenceTraining(trainParams.getSettings())) {
       EventStream eventStream = new NameFinderEventStream(samples, type,
           new DefaultNameContextGenerator(featureGenerator));
      
View Full Code Here

Examples of opennlp.model.AbstractModel

      // TODO: Maybe that should be part of the ChunkingParser ...
      // Training build
      System.out.println("Training check model");
      opennlp.model.EventStream bes = new ParserEventStream(parseSamples,
          originalModel.getHeadRules(), ParserEventTypeEnum.CHECK, mdict);
      AbstractModel checkModel = Parser.train(bes,
          parameters.getIterations(), parameters.getCutoff());
     
      parseSamples.close();
     
      return originalModel.updateCheckModel(checkModel);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.