[ 
https://issues.apache.org/jira/browse/OPENNLP-1385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17624401#comment-17624401
 ] 

ASF GitHub Bot commented on OPENNLP-1385:
-----------------------------------------

atarora commented on code in PR #428:
URL: https://github.com/apache/opennlp/pull/428#discussion_r1005583302


##########
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:
   Makes sense ! done , Thank you !





> Fix discrepancy in tokenizer documentation
> ------------------------------------------
>
>                 Key: OPENNLP-1385
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1385
>             Project: OpenNLP
>          Issue Type: Task
>          Components: Documentation, Tokenizer
>    Affects Versions: 1.9.4, 2.0.0
>            Reporter: Jeff Zemerick
>            Assignee: Atita Arora
>            Priority: Major
>
> In the tokenizer documentation in the user guide, the usage of the tool shows 
> a cutoff option:
>         -cutoff num
>                 minimal number of times a feature must be seen, ignored if 
> -params is used.
> However, this option is not present in the usage when running the CLI:
> {quote}Arguments description:
>         -factory factoryName
>                 A sub-class of TokenizerFactory where to get implementation 
> and resources.
>         -abbDict path
>                 abbreviation dictionary in XML format.
>         -alphaNumOpt isAlphaNumOpt
>                 Optimization flag to skip alpha numeric tokens for further 
> tokenization
>         -params paramsFile
>                 training parameters file.
>         -lang language
>                 language which is being processed.
>         -model modelFile
>                 output model file.
>         -data sampleData
>                 data to be used, usually a file name.
>         -encoding charsetName
>                 encoding for reading and writing text, if absent the system 
> default is used.
> {quote}
> The CLI does not recognize cutoff as an option so it is likely the 
> documentation is incorrect but a review of the code should probably be done 
> first to be sure.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to