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 2017/05/16 07:57:03 UTC

opennlp git commit: OPENNLP-1060: Fix computation of hash for the parser

Repository: opennlp
Updated Branches:
  refs/heads/master d7b3b96b2 -> c0880fb68


OPENNLP-1060: Fix computation of hash for the parser


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

Branch: refs/heads/master
Commit: c0880fb689ce188c7616de65a63444c8595a0549
Parents: d7b3b96
Author: Jörn Kottmann <jo...@apache.org>
Authored: Mon May 15 21:54:40 2017 +0200
Committer: Jörn Kottmann <jo...@apache.org>
Committed: Mon May 15 23:41:23 2017 +0200

----------------------------------------------------------------------
 .../test/java/opennlp/tools/eval/SourceForgeModelEval.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/opennlp/blob/c0880fb6/opennlp-tools/src/test/java/opennlp/tools/eval/SourceForgeModelEval.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/test/java/opennlp/tools/eval/SourceForgeModelEval.java b/opennlp-tools/src/test/java/opennlp/tools/eval/SourceForgeModelEval.java
index d3ea980..25b6f54 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/eval/SourceForgeModelEval.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/eval/SourceForgeModelEval.java
@@ -21,6 +21,7 @@ import java.io.File;
 import java.io.IOException;
 import java.math.BigInteger;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
@@ -339,14 +340,16 @@ public class SourceForgeModelEval {
       while ((line = lines.read()) != null) {
         Parse[] parse = ParserTool.parseLine(String.join(" ", line.getText()), parser, 1);
         if (parse.length > 0) {
-          digest.update(parse[0].toString().getBytes("UTF-8"));
+          StringBuffer sb = new StringBuffer();
+          parse[0].show(sb);
+          digest.update(sb.toString().getBytes(StandardCharsets.UTF_8));
         } else {
-          digest.update("empty".getBytes("UTF-8"));
+          digest.update("empty".getBytes(StandardCharsets.UTF_8));
         }
       }
     }
 
-    Assert.assertEquals(new BigInteger("13162568910062822351942983467905626940"),
+    Assert.assertEquals(new BigInteger("312218841713337505306598301082074515847"),
         new BigInteger(1, digest.digest()));
   }
 }