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 2012/10/02 17:34:30 UTC

svn commit: r1392975 - in /opennlp/trunk/opennlp-maxent/src: main/java/opennlp/model/RealValueFileEventStream.java test/java/opennlp/maxent/quasinewton/LogLikelihoodFunctionTest.java

Author: joern
Date: Tue Oct  2 15:34:29 2012
New Revision: 1392975

URL: http://svn.apache.org/viewvc?rev=1392975&view=rev
Log:
OPENNLP-338 Specified UTF-8 as encoding to read sample files.

Modified:
    opennlp/trunk/opennlp-maxent/src/main/java/opennlp/model/RealValueFileEventStream.java
    opennlp/trunk/opennlp-maxent/src/test/java/opennlp/maxent/quasinewton/LogLikelihoodFunctionTest.java

Modified: opennlp/trunk/opennlp-maxent/src/main/java/opennlp/model/RealValueFileEventStream.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-maxent/src/main/java/opennlp/model/RealValueFileEventStream.java?rev=1392975&r1=1392974&r2=1392975&view=diff
==============================================================================
--- opennlp/trunk/opennlp-maxent/src/main/java/opennlp/model/RealValueFileEventStream.java (original)
+++ opennlp/trunk/opennlp-maxent/src/main/java/opennlp/model/RealValueFileEventStream.java Tue Oct  2 15:34:29 2012
@@ -30,6 +30,10 @@ public class RealValueFileEventStream ex
     super(fileName);
   }
 
+  public RealValueFileEventStream(String fileName, String encoding) throws IOException {
+    super(fileName, encoding);
+  }
+  
   public RealValueFileEventStream(File file) throws IOException {
     super(file);
   }

Modified: opennlp/trunk/opennlp-maxent/src/test/java/opennlp/maxent/quasinewton/LogLikelihoodFunctionTest.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-maxent/src/test/java/opennlp/maxent/quasinewton/LogLikelihoodFunctionTest.java?rev=1392975&r1=1392974&r2=1392975&view=diff
==============================================================================
--- opennlp/trunk/opennlp-maxent/src/test/java/opennlp/maxent/quasinewton/LogLikelihoodFunctionTest.java (original)
+++ opennlp/trunk/opennlp-maxent/src/test/java/opennlp/maxent/quasinewton/LogLikelihoodFunctionTest.java Tue Oct  2 15:34:29 2012
@@ -35,7 +35,7 @@ public class LogLikelihoodFunctionTest {
   @Test
   public void testDomainDimensionSanity() throws IOException {
     // given
-    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");  
+    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");  
     DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
     LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer);
     // when
@@ -47,7 +47,7 @@ public class LogLikelihoodFunctionTest {
   @Test
   public void testInitialSanity() throws IOException {
     // given
-    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");  
+    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");  
     DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
     LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer);
     // when
@@ -61,7 +61,7 @@ public class LogLikelihoodFunctionTest {
   @Test
   public void testGradientSanity() throws IOException {
     // given
-    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");  
+    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");  
     DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
     LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer);
     // when
@@ -74,7 +74,7 @@ public class LogLikelihoodFunctionTest {
   @Test
   public void testValueAtInitialPoint() throws IOException {
     // given
-    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");
+    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
     DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
     LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer);
     // when
@@ -87,7 +87,7 @@ public class LogLikelihoodFunctionTest {
   @Test
   public void testValueAtNonInitialPoint01() throws IOException {
     // given
-    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");
+    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
     DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
     LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer);
     // when
@@ -101,7 +101,7 @@ public class LogLikelihoodFunctionTest {
   @Test
   public void testValueAtNonInitialPoint02() throws IOException {
     // given
-    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");
+    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
     DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
     LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer);
     // when
@@ -115,7 +115,7 @@ public class LogLikelihoodFunctionTest {
   @Test 
   public void testGradientAtInitialPoint() throws IOException {
     // given
-    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");
+    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
     DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
     LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer);
     // when
@@ -131,7 +131,7 @@ public class LogLikelihoodFunctionTest {
   @Test
   public void testGradientAtNonInitialPoint() throws IOException {
     // given
-    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");
+    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
     DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
     LogLikelihoodFunction objectFunction = new LogLikelihoodFunction(testDataIndexer);
     // when