From f4bbbadf9d4d477209c8d54750d5a55312f52104 Mon Sep 17 00:00:00 2001 From: koji Date: Mon, 23 Oct 2017 18:16:37 +0900 Subject: [PATCH] OPENNLP-1150: TokenNameFinderTrainerTool should use ModelUtil.createDefaultTrainingParameters() when mlParams is null --- .../tools/cmdline/namefind/TokenNameFinderTrainerTool.java | 3 +-- .../src/main/java/opennlp/tools/util/TrainingParameters.java | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java b/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java index f3cef4881..095c83e84 100644 --- a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java +++ b/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java @@ -36,7 +36,6 @@ import opennlp.tools.namefind.TokenNameFinderModel; import opennlp.tools.util.InvalidFormatException; import opennlp.tools.util.SequenceCodec; -import opennlp.tools.util.TrainingParameters; import opennlp.tools.util.featuregen.GeneratorFactory; import opennlp.tools.util.model.ArtifactSerializer; import opennlp.tools.util.model.ModelUtil; @@ -115,7 +114,7 @@ public void run(String format, String[] args) { mlParams = CmdLineUtil.loadTrainingParameters(params.getParams(), true); if (mlParams == null) { - mlParams = new TrainingParameters(); + mlParams = ModelUtil.createDefaultTrainingParameters(); } File modelOutFile = params.getModel(); diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/TrainingParameters.java b/opennlp-tools/src/main/java/opennlp/tools/util/TrainingParameters.java index 6fc351c1f..a1dfd83f3 100644 --- a/opennlp-tools/src/main/java/opennlp/tools/util/TrainingParameters.java +++ b/opennlp-tools/src/main/java/opennlp/tools/util/TrainingParameters.java @@ -27,6 +27,7 @@ import java.util.Properties; import opennlp.tools.ml.EventTrainer; +import opennlp.tools.ml.maxent.GISTrainer; public class TrainingParameters { @@ -443,7 +444,7 @@ public boolean getBooleanParameter(String namespace, String key, boolean default public static TrainingParameters defaultParams() { TrainingParameters mlParams = new TrainingParameters(); - mlParams.put(TrainingParameters.ALGORITHM_PARAM, "MAXENT"); + mlParams.put(TrainingParameters.ALGORITHM_PARAM, GISTrainer.MAXENT_VALUE); mlParams.put(TrainingParameters.TRAINER_TYPE_PARAM, EventTrainer.EVENT_VALUE); mlParams.put(TrainingParameters.ITERATIONS_PARAM, 100); mlParams.put(TrainingParameters.CUTOFF_PARAM, 5);