opennlp-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [1/2] opennlp git commit: Revert "Remove deprecated API from the Parser"
Date Tue, 13 Dec 2016 23:46:29 GMT
Repository: opennlp
Updated Branches:
  refs/heads/trunk 9c140512d -> 080656237


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/trunk
Commit: d62cc416b5fb6db89b624c3b5203711ad597ebe4
Parents: 9c14051
Author: Jörn Kottmann <joern@apache.org>
Authored: Wed Dec 14 00:39:34 2016 +0100
Committer: Jörn Kottmann <joern@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);
+  }
 }


Mime
View raw message