Package opennlp.model

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


        }
        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

   * 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

     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

      // 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

    String lang = args[1];
    String packageName = args[2];
    String modelName = args[3];

    AbstractModel chunkerModel = new GenericModelReader(
        new BinaryFileDataReader(new FileInputStream(modelName))).getModel();

    ChunkerModel packageModel = new ChunkerModel(lang, chunkerModel);
    packageModel.serialize(new FileOutputStream(packageName));
  }
View Full Code Here

   
    POSContextGenerator contextGenerator = new DefaultPOSContextGenerator(ngramDictionary);
   
    Map<String, String> manifestInfoEntries = new HashMap<String, String>();
   
    AbstractModel posModel;
   
    if (!TrainUtil.isSequenceTraining(trainParams.getSettings())) {
     
      EventStream es = new POSSampleEventStream(samples, contextGenerator);
     
View Full Code Here

   
    Map<String, String> manifestInfoEntries = new HashMap<String, String>();
   
    EventStream es = new ChunkerEventStream(in, contextGenerator);
   
    AbstractModel maxentModel = TrainUtil.train(es, mlParams.getSettings(), manifestInfoEntries);
   
    return new ChunkerModel(lang, maxentModel, manifestInfoEntries);
  }
View Full Code Here

      // TODO: training individual models should be in the chunking parser, not here
      // Training build
      System.out.println("Training builder");
      opennlp.model.EventStream bes = new ParserEventStream(parseSamples,
          originalModel.getHeadRules(), ParserEventTypeEnum.BUILD, mdict);
      AbstractModel buildModel = Parser.train(bes,
          parameters.getIterations(), parameters.getCutoff());
     
      parseSamples.close();
     
      return originalModel.updateBuildModel(buildModel);
View Full Code Here

   * @param modelFile
   * @throws IOException
   */
  @Deprecated
  public static void trainMaxentModel(EventStream evc, File modelFile) throws IOException {
    AbstractModel model = trainMaxentModel(evc, 100,5);
    new SuffixSensitiveGISModelWriter(model, modelFile).persist();
  }
View Full Code Here

TOP

Related Classes of opennlp.model.AbstractModel

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.