opennlp-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1655552 - in /opennlp/trunk/opennlp-tools/src/test: java/opennlp/tools/ngram/NGramModelTest.java resources/opennlp/tools/ngram/ngram-model.xml
Date Thu, 29 Jan 2015 09:05:28 GMT
Author: tommaso
Date: Thu Jan 29 09:05:27 2015
New Revision: 1655552

URL: http://svn.apache.org/r1655552
Log:
OPENNLP-746 - added missing AL header to test ngram model, using utf-8 in String conversion

Modified:
    opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/ngram/NGramModelTest.java
    opennlp/trunk/opennlp-tools/src/test/resources/opennlp/tools/ngram/ngram-model.xml

Modified: opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/ngram/NGramModelTest.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/ngram/NGramModelTest.java?rev=1655552&r1=1655551&r2=1655552&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/ngram/NGramModelTest.java (original)
+++ opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/ngram/NGramModelTest.java Thu
Jan 29 09:05:27 2015
@@ -184,7 +184,12 @@ public class NGramModelTest {
     assertNotNull(out);
     InputStream nGramModelStream = getClass().getResourceAsStream("/opennlp/tools/ngram/ngram-model.xml");
     String modelString = IOUtils.toString(nGramModelStream);
-    String outputString = out.toString(Charset.defaultCharset().name());
+    // remove AL header
+    int start = modelString.indexOf("<!--");
+    int end = modelString.indexOf("-->");
+    String asfHeaderString = modelString.substring(start, end +3);
+    modelString = modelString.replace(asfHeaderString, "");
+    String outputString = out.toString(Charset.forName("UTF-8").name());
     assertEquals(modelString.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "").replaceAll("
", ""),
             outputString.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "").replaceAll("
", ""));
   }

Modified: opennlp/trunk/opennlp-tools/src/test/resources/opennlp/tools/ngram/ngram-model.xml
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/test/resources/opennlp/tools/ngram/ngram-model.xml?rev=1655552&r1=1655551&r2=1655552&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/test/resources/opennlp/tools/ngram/ngram-model.xml (original)
+++ opennlp/trunk/opennlp-tools/src/test/resources/opennlp/tools/ngram/ngram-model.xml Thu
Jan 29 09:05:27 2015
@@ -1,4 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
 <dictionary case_sensitive="false">
     <entry count="1">
         <token>brown</token>



Mime
View raw message