Examples of MaxentModel


Examples of opennlp.tools.ml.model.MaxentModel

          TrainingParameters mlParams, DoccatFactory factory)
          throws IOException {

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

    MaxentModel model = TrainUtil.train(
            new DocumentCategorizerEventStream(samples, factory.getFeatureGenerators()),
            mlParams.getSettings(), manifestInfoEntries);

    return new DoccatModel(languageCode, model, manifestInfoEntries, factory);
  }
View Full Code Here

Examples of opennlp.tools.ml.model.MaxentModel

      modelFileName = args[ai++];
      dataFileName = args[ai++];

      ModelApplier predictor = null;
      try {
        MaxentModel m = new GenericModelReader(new File(modelFileName)).getModel();
        predictor = new ModelApplier(m);
      } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
      }
View Full Code Here

Examples of opennlp.tools.ml.model.MaxentModel

    ObjectStream<Event> eventStream = new TokSpanEventStream(samples,
        factory.isUseAlphaNumericOptmization(),
        factory.getAlphaNumericPattern(), factory.getContextGenerator());

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

    return new TokenizerModel(maxentModel, manifestInfoEntries,
        factory);
  }
View Full Code Here

Examples of opennlp.tools.ml.model.MaxentModel

    ObjectStream<Event> eventStream = new TokSpanEventStream(samples,
        useAlphaNumericOptimization, factory.getAlphanumeric(languageCode),
        factory.createTokenContextGenerator(languageCode,
            getAbbreviations(abbreviations)));

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

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

Examples of opennlp.tools.ml.model.MaxentModel

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

    MaxentModel sentModel = TrainUtil.train(eventStream,
        mlParams.getSettings(), manifestInfoEntries);

    return new SentenceModel(languageCode, sentModel, manifestInfoEntries,
        sdFactory);
  }
View Full Code Here

Examples of opennlp.tools.ml.model.MaxentModel

    assertEquals("person", names1[2].getType());
    assertTrue(!hasOtherAsOutcome(nameFinderModel));
  }

  private boolean hasOtherAsOutcome(TokenNameFinderModel nameFinderModel) {
    MaxentModel model = nameFinderModel.getNameFinderModel();
    for (int i = 0; i < model.getNumOutcomes(); i++) {
        String outcome = model.getOutcome(i);
        if (outcome.equals(NameFinderME.OTHER)) {
          return true;
        }
      }
    return false;
View Full Code Here

Examples of opennlp.tools.ml.model.MaxentModel

*/
public class PerceptronPrepAttachTest {

  @Test
  public void testPerceptronOnPrepAttachData() throws IOException {
    MaxentModel model =
        new PerceptronTrainer().trainModel(400,
        new TwoPassDataIndexer(createTrainingStream(), 1, false), 1);

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

Examples of opennlp.tools.ml.model.MaxentModel

    Map<String, String> trainParams = new HashMap<String, String>();
    trainParams.put(AbstractTrainer.ALGORITHM_PARAM, PerceptronTrainer.PERCEPTRON_VALUE);
    trainParams.put(AbstractTrainer.CUTOFF_PARAM, Integer.toString(1));
    trainParams.put("UseSkippedAveraging", Boolean.toString(true));

    MaxentModel model = TrainUtil.train(createTrainingStream(), trainParams, null);

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

Examples of opennlp.tools.ml.model.MaxentModel

    trainParams.put(AbstractTrainer.ALGORITHM_PARAM, PerceptronTrainer.PERCEPTRON_VALUE);
    trainParams.put(AbstractTrainer.CUTOFF_PARAM, Integer.toString(1));
    trainParams.put(AbstractTrainer.ITERATIONS_PARAM, Integer.toString(500));
    trainParams.put("Tolerance", Double.toString(0.0001d));

    MaxentModel model = TrainUtil.train(createTrainingStream(), trainParams, null);

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

Examples of opennlp.tools.ml.model.MaxentModel

    trainParams.put(AbstractTrainer.ALGORITHM_PARAM, PerceptronTrainer.PERCEPTRON_VALUE);
    trainParams.put(AbstractTrainer.CUTOFF_PARAM, Integer.toString(1));
    trainParams.put(AbstractTrainer.ITERATIONS_PARAM, Integer.toString(500));
    trainParams.put("StepSizeDecrease", Double.toString(0.06d));

    MaxentModel model = TrainUtil.train(createTrainingStream(), trainParams, null);

    testModel(model, 0.7791532557563754);
  }
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.