You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jk...@apache.org on 2012/03/17 03:00:48 UTC

svn commit: r1301855 - /opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/namefind/DictionaryNameFinderTest.java

Author: jkosin
Date: Sat Mar 17 02:00:48 2012
New Revision: 1301855

URL: http://svn.apache.org/viewvc?rev=1301855&view=rev
Log:
OPENNLP-471: added a test for the DictoionaryNameFinder to check for a longer entry without any shorter matches

Modified:
    opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/namefind/DictionaryNameFinderTest.java

Modified: opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/namefind/DictionaryNameFinderTest.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/namefind/DictionaryNameFinderTest.java?rev=1301855&r1=1301854&r2=1301855&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/namefind/DictionaryNameFinderTest.java (original)
+++ opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/namefind/DictionaryNameFinderTest.java Sat Mar 17 02:00:48 2012
@@ -47,6 +47,10 @@ public class DictionaryNameFinderTest{
 
     StringList max = new StringList(new String[]{"Max"});
     mDictionary.put(max);
+    
+    StringList michaelJordan = new
+        StringList(new String[]{"Michael", "Jordan"});
+    mDictionary.put(michaelJordan);
   }
 
   @Before
@@ -123,4 +127,14 @@ public class DictionaryNameFinderTest{
     assertTrue(names.length == 1);
     assertTrue(names[0].getStart() == 3 && names[0].getEnd() == 5);
   }
+  
+  @Test
+  public void testCaseLongerEntry() {
+    String sentence[] = {"a", "b", "michael", "jordan"};
+    
+    Span names[] = mNameFinder.find(sentence);
+    
+    assertTrue(names.length == 1);
+    assertTrue(names[0].length() == 2);
+  }
 }
\ No newline at end of file