This is an automated email from the ASF dual-hosted git repository.

tommaso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/opennlp-sandbox.git


The following commit(s) were added to refs/heads/master by this push:
     new 4bde702  OPENNLP-1009 - switch to opennlp-tools 1.8.3 release
4bde702 is described below

commit 4bde702a02a05489a6d3e90c5121aaca05697e7e
Author: Tommaso Teofili <[email protected]>
AuthorDate: Tue Nov 7 15:17:08 2017 +0100

    OPENNLP-1009 - switch to opennlp-tools 1.8.3 release
---
 opennlp-dl/pom.xml                                 |  7 ++++++-
 .../main/java/opennlp/tools/dl/NeuralDocCat.java   | 24 ----------------------
 .../java/opennlp/tools/dl/NeuralDocCatTrainer.java |  4 ++--
 .../java/opennlp/tools/dl/NeuralDocCatTest.java    |  5 +++--
 4 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/opennlp-dl/pom.xml b/opennlp-dl/pom.xml
index cfa37b6..cfb1a1b 100644
--- a/opennlp-dl/pom.xml
+++ b/opennlp-dl/pom.xml
@@ -33,7 +33,7 @@
       <dependency>
           <groupId>org.apache.opennlp</groupId>
           <artifactId>opennlp-tools</artifactId>
-          <version>1.7.2</version>
+          <version>1.8.3</version>
       </dependency>
 
       <dependency>
@@ -67,6 +67,11 @@
       <artifactId>args4j</artifactId>
       <version>2.33</version>
     </dependency>
+      <dependency>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-collections4</artifactId>
+          <version>4.1</version>
+      </dependency>
   </dependencies>
   <build>
     <plugins>
diff --git a/opennlp-dl/src/main/java/opennlp/tools/dl/NeuralDocCat.java 
b/opennlp-dl/src/main/java/opennlp/tools/dl/NeuralDocCat.java
index 53bf530..299a742 100644
--- a/opennlp-dl/src/main/java/opennlp/tools/dl/NeuralDocCat.java
+++ b/opennlp-dl/src/main/java/opennlp/tools/dl/NeuralDocCat.java
@@ -122,30 +122,6 @@ public class NeuralDocCat implements DocumentCategorizer {
         throw new NotImplementedException("Not implemented");
     }
 
-    @Override
-    @Deprecated
-    public double[] categorize(String documentText) {
-        throw new UnsupportedOperationException("Use the other categorize(..) 
method that accepts tokenized text");
-    }
-
-    @Override
-    @Deprecated
-    public Map<String, Double> scoreMap(String text) {
-        throw new UnsupportedOperationException("Use the other scoreMap(..) 
method that accepts tokenized text");
-    }
-
-    @Override
-    @Deprecated
-    public SortedMap<Double, Set<String>> sortedScoreMap(String text) {
-        throw new UnsupportedOperationException("Use the other 
sortedScoreMap(..) method that accepts tokenized text");
-    }
-    @Override
-    @Deprecated
-    public double[] categorize(String documentText, Map<String, Object> 
extraInformation) {
-        throw new UnsupportedOperationException("Use the other categorize(..) 
method that accepts tokenized text");
-    }
-
-
     public static void main(String[] argss) throws CmdLineException, 
IOException {
         class Args {
 
diff --git a/opennlp-dl/src/main/java/opennlp/tools/dl/NeuralDocCatTrainer.java 
b/opennlp-dl/src/main/java/opennlp/tools/dl/NeuralDocCatTrainer.java
index 4099b65..9ce3a3f 100644
--- a/opennlp-dl/src/main/java/opennlp/tools/dl/NeuralDocCatTrainer.java
+++ b/opennlp-dl/src/main/java/opennlp/tools/dl/NeuralDocCatTrainer.java
@@ -17,6 +17,7 @@ import org.kohsuke.args4j.spi.StringArrayOptionHandler;
 import org.nd4j.linalg.activations.Activation;
 import org.nd4j.linalg.api.ndarray.INDArray;
 import org.nd4j.linalg.dataset.DataSet;
+import org.nd4j.linalg.learning.config.RmsProp;
 import org.nd4j.linalg.lossfunctions.LossFunctions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -134,8 +135,7 @@ public class NeuralDocCatTrainer {
         //TODO: the below network params should be configurable from CLI or 
settings file
         //Set up network configuration
         MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
-                .updater(Updater.RMSPROP) // ADAM 
.adamMeanDecay(0.9).adamVarDecay(0.999)
-                .rmsDecay(0.9)
+                .updater(new RmsProp(0.9)) // ADAM 
.adamMeanDecay(0.9).adamVarDecay(0.999)
                 .regularization(true).l2(1e-5)
                 .weightInit(WeightInit.XAVIER)
                 
.gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue)
diff --git a/opennlp-dl/src/test/java/opennlp/tools/dl/NeuralDocCatTest.java 
b/opennlp-dl/src/test/java/opennlp/tools/dl/NeuralDocCatTest.java
index cda1090..9d0cb83 100644
--- a/opennlp-dl/src/test/java/opennlp/tools/dl/NeuralDocCatTest.java
+++ b/opennlp-dl/src/test/java/opennlp/tools/dl/NeuralDocCatTest.java
@@ -43,13 +43,14 @@ public class NeuralDocCatTest {
     args.trainDir = getClass().getResource("/ltweets").getFile();
     NeuralDocCatTrainer trainer = new NeuralDocCatTrainer(args);
     trainer.train();
-    trainer.saveModel(modelPathPrefix + ".zip");
+    String modelPath = modelPathPrefix + ".zip";
+    trainer.saveModel(modelPath);
 
     /* TODO : this fails with:
      * java.lang.AssertionError
      * at opennlp.tools.dl.GlobalVectors.<init>(GlobalVectors.java:92)
      */
-    NeuralDocCatModel neuralDocCatModel = 
NeuralDocCatModel.loadModel(modelPathPrefix + ".zip");
+    NeuralDocCatModel neuralDocCatModel = 
NeuralDocCatModel.loadModel(modelPath);
     assertNotNull(neuralDocCatModel);
 
     NeuralDocCat neuralDocCat = new 
NeuralDocCat(NeuralDocCatModel.loadModel(modelPathPrefix));

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to