jzonthemtn commented on code in PR #428:
URL: https://github.com/apache/opennlp/pull/428#discussion_r1005023932
##########
opennlp-tools/src/main/java/opennlp/tools/util/TrainingParameters.java:
##########
@@ -448,8 +451,24 @@ public static TrainingParameters defaultParams() {
TrainingParameters mlParams = new TrainingParameters();
mlParams.put(TrainingParameters.ALGORITHM_PARAM, "MAXENT");
mlParams.put(TrainingParameters.TRAINER_TYPE_PARAM,
EventTrainer.EVENT_VALUE);
- mlParams.put(TrainingParameters.ITERATIONS_PARAM, 100);
- mlParams.put(TrainingParameters.CUTOFF_PARAM, 5);
+ mlParams.put(TrainingParameters.ITERATIONS_PARAM,
ITERATIONS_DEFAULT_VALUE);
+ mlParams.put(TrainingParameters.CUTOFF_PARAM, CUTOFF_DEFAULT_VALUE);
+
+ return mlParams;
+ }
+
+ public static TrainingParameters setParams(String[] args) {
+ TrainingParameters mlParams = new TrainingParameters();
+ mlParams.put(TrainingParameters.ALGORITHM_PARAM, "MAXENT");
+ mlParams.put(TrainingParameters.TRAINER_TYPE_PARAM,
EventTrainer.EVENT_VALUE);
+ mlParams.put(TrainingParameters.ITERATIONS_PARAM,
+ null != CmdLineUtil.getIntParameter("-" +
TrainingParameters.ITERATIONS_PARAM.toLowerCase(), args) ?
+ CmdLineUtil.getIntParameter("-" +
TrainingParameters.ITERATIONS_PARAM.toLowerCase(), args) :
+
defaultParams().getIntParameter(TrainingParameters.ITERATIONS_PARAM,ITERATIONS_DEFAULT_VALUE));
Review Comment:
Can this line be simplified to just be the constant
`ITERATIONS_DEFAULT_VALUE`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]