Hi James,

please remove the author tag. It implies
individual code ownership but our goal is community
code ownership.

Thanks,
Jörn

On 12/22/10 5:26 AM, [email protected] wrote:
Author: jkosin
Date: Wed Dec 22 04:26:51 2010
New Revision: 1051748

URL: http://svn.apache.org/viewvc?rev=1051748&view=rev
Log:
OPENNLP-15: added the test class for the CoNLL 03 data set.

Added:
     
incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java
   (with props)

Added: 
incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java
URL: 
http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java?rev=1051748&view=auto
==============================================================================
--- 
incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java
 (added)
+++ 
incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java
 Wed Dec 22 04:26:51 2010
@@ -0,0 +1,75 @@
+/*
+ *  Copyright 2010 James Kosin.
+ *
+ *  Licensed 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.
+ *  under the License.
+ */
+
+package opennlp.tools.formats;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import opennlp.tools.formats.Conll03NameSampleStream.LANGUAGE;
+import opennlp.tools.namefind.NameSample;
+import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Span;
+import org.junit.Test;
+
+/**
+ *
+ * @author James Kosin
+ */
+public class Conll03NameSampleStreamTest {
+
+  private static ObjectStream<NameSample>  openData(LANGUAGE lang, String 
name) throws IOException {
+    InputStream in = 
Conll03NameSampleStreamTest.class.getResourceAsStream("/opennlp/tools/formats/" 
+ name);
+
+    return new Conll03NameSampleStream(lang, in, 
Conll03NameSampleStream.GENERATE_PERSON_ENTITIES);
+  }
+
+
+  @Test
+  public void testParsingEnglishSample() throws IOException {
+
+    ObjectStream<NameSample>  sampleStream = openData(LANGUAGE.EN, 
"conll2003-en.sample");
+
+    NameSample personName = sampleStream.read();
+
+    assertNotNull(personName);
+
+    assertEquals(9, personName.getSentence().length);
+    assertEquals(0, personName.getNames().length);
+    assertEquals(true, personName.isClearAdaptiveDataSet());
+
+    personName = sampleStream.read();
+
+    assertNotNull(personName);
+
+    assertEquals(2, personName.getSentence().length);
+    assertEquals(1, personName.getNames().length);
+    assertEquals(false, personName.isClearAdaptiveDataSet());
+
+    Span nameSpan = personName.getNames()[0];
+    assertEquals(0, nameSpan.getStart());
+    assertEquals(2, nameSpan.getEnd());
+
+    assertNull(sampleStream.read());
+  }
+
+}
\ No newline at end of file

Propchange: 
incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java
------------------------------------------------------------------------------
     svn:eol-style = native



Reply via email to