You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2016/12/26 13:34:00 UTC

[06/50] [abbrv] opennlp git commit: Revert "Remove deprecated API from the Parser"

Revert "Remove deprecated API from the Parser"

That should not have been merged, caused compile errors.

This reverts commit 9c140512d9caadda9ea469b679766870304ce947.


Project: http://git-wip-us.apache.org/repos/asf/opennlp/repo
Commit: http://git-wip-us.apache.org/repos/asf/opennlp/commit/d62cc416
Tree: http://git-wip-us.apache.org/repos/asf/opennlp/tree/d62cc416
Diff: http://git-wip-us.apache.org/repos/asf/opennlp/diff/d62cc416

Branch: refs/heads/889
Commit: d62cc416b5fb6db89b624c3b5203711ad597ebe4
Parents: 9c14051
Author: J�rn Kottmann <jo...@apache.org>
Authored: Wed Dec 14 00:39:34 2016 +0100
Committer: J�rn Kottmann <jo...@apache.org>
Committed: Wed Dec 14 00:39:34 2016 +0100

----------------------------------------------------------------------
 .../opennlp/tools/parser/chunking/Parser.java   | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/opennlp/blob/d62cc416/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java b/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java
index 77a030f..044477b 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java
@@ -248,6 +248,15 @@ public class Parser extends AbstractBottomUpParser {
     return newParses;
   }
 
+  /**
+   * @deprecated Please do not use anymore, use the ObjectStream train methods instead! This method
+   * will be removed soon.
+   */
+  @Deprecated
+  public static AbstractModel train(ObjectStream<Event> es, int iterations, int cut) throws java.io.IOException {
+    return opennlp.tools.ml.maxent.GIS.trainModel(iterations, new TwoPassDataIndexer(es, cut));
+  }
+
   public static void mergeReportIntoManifest(Map<String, String> manifest,
       Map<String, String> report, String namespace) {
 
@@ -309,4 +318,27 @@ public class Parser extends AbstractBottomUpParser {
         posModel, chunkModel, (opennlp.tools.parser.HeadRules) rules,
         ParserType.CHUNKING, manifestInfoEntries);
   }
+
+  /**
+  * @deprecated use {@link #train(String, ObjectStream, HeadRules, TrainingParameters)}
+  * instead and pass in a TrainingParameters object.
+  */
+  @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);
+  }
 }