Package opennlp.tools.util

Examples of opennlp.tools.util.TrainingParameters


    if (params.getMisclassified()) {
      missclassifiedListener = new POSEvaluationErrorListener();
    }
   
    if (mlParams == null) {
      mlParams = new TrainingParameters();
      mlParams.put(TrainingParameters.ALGORITHM_PARAM, "MAXENT");
      mlParams.put(TrainingParameters.ITERATIONS_PARAM,
          Integer.toString(params.getIterations()));
      mlParams.put(TrainingParameters.CUTOFF_PARAM,
          Integer.toString(params.getCutoff()));
View Full Code Here


   */
  @Deprecated
  public static POSModel train(String languageCode, ObjectStream<POSSample> samples, ModelType modelType, POSDictionary tagDictionary,
      Dictionary ngramDictionary, int cutoff, int iterations) throws IOException {

    TrainingParameters params = new TrainingParameters();
   
    params.put(TrainingParameters.ALGORITHM_PARAM, modelType.toString());
    params.put(TrainingParameters.ITERATIONS_PARAM, Integer.toString(iterations));
    params.put(TrainingParameters.CUTOFF_PARAM, Integer.toString(cutoff));
   
    return train(languageCode, samples, params, tagDictionary, ngramDictionary);
  }
View Full Code Here

   * @param cutoff
   *
   * @return
   */
  public static TrainingParameters createTrainingParameters(int iterations, int cutoff) {
    TrainingParameters mlParams = new TrainingParameters();
    mlParams.put(TrainingParameters.ALGORITHM_PARAM, "MAXENT");
    mlParams.put(TrainingParameters.ITERATIONS_PARAM, Integer.toString(iterations));
    mlParams.put(TrainingParameters.CUTOFF_PARAM, Integer.toString(cutoff));
   
    return mlParams;
  }
View Full Code Here

   * @return A dictionary object.
   */
  public static Dictionary buildDictionary(ObjectStream<Parse> data, HeadRules rules, int cutoff)
      throws IOException {
   
    TrainingParameters params = new TrainingParameters();
    params.put("dict", TrainingParameters.CUTOFF_PARAM, Integer.toString(cutoff));
   
    return buildDictionary(data, rules, params);
  }
View Full Code Here

  */
  @Deprecated
  public static ParserModel train(String languageCode, ObjectStream<Parse> parseSamples, HeadRules rules, int iterations, int cut)
      throws IOException {
   
    TrainingParameters params = new TrainingParameters();
    params.put("dict", TrainingParameters.CUTOFF_PARAM, Integer.toString(cut));

    params.put("tagger", TrainingParameters.CUTOFF_PARAM, Integer.toString(cut));
    params.put("tagger", TrainingParameters.ITERATIONS_PARAM, Integer.toString(iterations));
    params.put("chunker", TrainingParameters.CUTOFF_PARAM, Integer.toString(cut));
    params.put("chunker", TrainingParameters.ITERATIONS_PARAM, Integer.toString(iterations));
    params.put("check", TrainingParameters.CUTOFF_PARAM, Integer.toString(cut));
    params.put("check", TrainingParameters.ITERATIONS_PARAM, Integer.toString(iterations));
    params.put("build", TrainingParameters.CUTOFF_PARAM, Integer.toString(cut));
    params.put("build", TrainingParameters.ITERATIONS_PARAM, Integer.toString(iterations));

    return train(languageCode, parseSamples, rules, params);
  }
View Full Code Here

   * @param cutoff cutoff threshold
   *
   * @return training parameters instance
   */
  public static TrainingParameters createTrainingParameters(int iterations, int cutoff) {
    TrainingParameters mlParams = new TrainingParameters();
    mlParams.put(TrainingParameters.ALGORITHM_PARAM, TrainUtil.MAXENT_VALUE);
    mlParams.put(TrainingParameters.ITERATIONS_PARAM, Integer.toString(iterations));
    mlParams.put(TrainingParameters.CUTOFF_PARAM, Integer.toString(cutoff));
   
    return mlParams;
  }
View Full Code Here

        .getResource("opennlp/tools/namefind/AnnotatedSentences.txt").toURI()));

    ObjectStream<NameSample> sampleStream = new NameSampleDataStream(
        new PlainTextByLineStream(sampleDataIn.getChannel(), "ISO-8859-1"));

    TrainingParameters mlParams = ModelUtil.createTrainingParameters(70, 1);
    mlParams.put(TrainingParameters.ALGORITHM_PARAM,
        ModelType.MAXENT.toString());

    TokenNameFinderCrossValidator cv = new TokenNameFinderCrossValidator("en",
        TYPE, mlParams, null, null);
View Full Code Here

        .getResource("opennlp/tools/namefind/AnnotatedSentences.txt").toURI()));

    ObjectStream<NameSample> sampleStream = new NameSampleDataStream(
        new PlainTextByLineStream(sampleDataIn.getChannel(), "ISO-8859-1"));

    TrainingParameters mlParams = ModelUtil.createTrainingParameters(70, 1);
    mlParams.put(TrainingParameters.ALGORITHM_PARAM,
        ModelType.MAXENT.toString());
   
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    NameEvaluationErrorListener listener = new NameEvaluationErrorListener(out);
View Full Code Here

   */
  @Deprecated
  public static POSModel train(String languageCode, ObjectStream<POSSample> samples, ModelType modelType, POSDictionary tagDictionary,
      Dictionary ngramDictionary, int cutoff, int iterations) throws IOException {

    TrainingParameters params = new TrainingParameters();
   
    params.put(TrainingParameters.ALGORITHM_PARAM, modelType.toString());
    params.put(TrainingParameters.ITERATIONS_PARAM, Integer.toString(iterations));
    params.put(TrainingParameters.CUTOFF_PARAM, Integer.toString(cutoff));
   
    return train(languageCode, samples, params, tagDictionary, ngramDictionary);
  }
View Full Code Here

  public long getWordCount() {
    return wordAccuracy.count();
  }
 
  private static TrainingParameters create(ModelType type, int cutoff, int iterations) {
    TrainingParameters params = ModelUtil.createTrainingParameters(iterations, cutoff);
    params.put(TrainingParameters.ALGORITHM_PARAM, type.toString());
    return params;
  }
View Full Code Here

TOP

Related Classes of opennlp.tools.util.TrainingParameters

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.