You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by co...@apache.org on 2012/02/13 18:52:12 UTC

svn commit: r1243623 - in /incubator/opennlp/trunk/opennlp-tools/src: main/java/opennlp/tools/postag/POSTaggerME.java test/java/opennlp/tools/postag/POSTaggerFactoryTest.java

Author: colen
Date: Mon Feb 13 17:52:12 2012
New Revision: 1243623

URL: http://svn.apache.org/viewvc?rev=1243623&view=rev
Log:
OPENNLP-429: Refactored train method in POSTaggerME

Modified:
    incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java
    incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/postag/POSTaggerFactoryTest.java

Modified: incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?rev=1243623&r1=1243622&r2=1243623&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java Mon Feb 13 17:52:12 2012
@@ -321,8 +321,7 @@ public class POSTaggerME implements POST
   
   public static POSModel train(String languageCode,
       ObjectStream<POSSample> samples, TrainingParameters trainParams,
-      POSTaggerFactory posFactory, POSDictionary tagDictionary,
-      Dictionary ngramDictionary) throws IOException {
+      POSTaggerFactory posFactory) throws IOException {
     
     POSContextGenerator contextGenerator = posFactory.getPOSContextGenerator();
     
@@ -345,16 +344,23 @@ public class POSTaggerME implements POST
     return new POSModel(languageCode, posModel, manifestInfoEntries, posFactory);
   }
 
+  /**
+   * @deprecated use
+   *             {@link #train(String, ObjectStream, TrainingParameters, POSTaggerFactory)}
+   *             instead and pass in a {@link POSTaggerFactory}.
+   */
   public static POSModel train(String languageCode, ObjectStream<POSSample> samples, TrainingParameters trainParams, 
       POSDictionary tagDictionary, Dictionary ngramDictionary) throws IOException {
     
     return train(languageCode, samples, trainParams, new POSTaggerFactory(
-        ngramDictionary, tagDictionary), tagDictionary, ngramDictionary);
+        ngramDictionary, tagDictionary));
   }
   
   /**
-   * @deprecated use {@link #train(String, ObjectStream, TrainingParameters, POSDictionary, Dictionary)}
-   * instead and pass in a TrainingParameters object.
+   * @deprecated use
+   *             {@link #train(String, ObjectStream, TrainingParameters, POSTaggerFactory)}
+   *             instead and pass in a {@link POSTaggerFactory} and a
+   *             {@link TrainingParameters}.
    */
   @Deprecated
   public static POSModel train(String languageCode, ObjectStream<POSSample> samples, ModelType modelType, POSDictionary tagDictionary,

Modified: incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/postag/POSTaggerFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/postag/POSTaggerFactoryTest.java?rev=1243623&r1=1243622&r2=1243623&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/postag/POSTaggerFactoryTest.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/postag/POSTaggerFactoryTest.java Mon Feb 13 17:52:12 2012
@@ -51,7 +51,7 @@ public class POSTaggerFactoryTest {
   static POSModel trainPOSModel(ModelType type, POSTaggerFactory factory)
       throws IOException {
     return POSTaggerME.train("en", createSampleStream(),
-        TrainingParameters.defaultParams(), factory, null, null);
+        TrainingParameters.defaultParams(), factory);
   }
 
   @Test