You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by co...@apache.org on 2017/03/13 16:06:25 UTC

[17/24] opennlp git commit: OPENNLP-989: Fix validation of CONT after START with different type

OPENNLP-989: Fix validation of CONT after START with different type

This closes #126


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

Branch: refs/heads/OPENNLP-778
Commit: ebf108170e9a6215176174d84313a0564ddde0c4
Parents: f60bfa2
Author: Peter Thygesen <pe...@gmail.com>
Authored: Fri Feb 17 15:17:13 2017 +0100
Committer: J�rn Kottmann <jo...@apache.org>
Committed: Thu Mar 2 21:25:28 2017 +0100

----------------------------------------------------------------------
 .../opennlp/tools/namefind/NameFinderSequenceValidator.java  | 5 +++--
 .../test/java/opennlp/tools/eval/Conll02NameFinderEval.java  | 8 ++++----
 .../tools/namefind/NameFinderSequenceValidatorTest.java      | 2 --
 3 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/opennlp/blob/ebf10817/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderSequenceValidator.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderSequenceValidator.java b/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderSequenceValidator.java
index d42e8c5..5143468 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderSequenceValidator.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderSequenceValidator.java
@@ -35,8 +35,9 @@ public class NameFinderSequenceValidator implements
         return false;
       } else if (outcomesSequence[li].endsWith(NameFinderME.OTHER)) {
         return false;
-      } else if (outcomesSequence[li].endsWith(NameFinderME.CONTINUE)) {
-        // if it is continue, we have to check if previous match was of the same type
+      } else if (outcomesSequence[li].endsWith(NameFinderME.CONTINUE) ||
+          outcomesSequence[li].endsWith(NameFinderME.START)) {
+        // if it is continue or start, we have to check if previous match was of the same type
         String previousNameType = NameFinderME.extractNameType(outcomesSequence[li]);
         String nameType = NameFinderME.extractNameType(outcome);
         if (previousNameType != null || nameType != null ) {

http://git-wip-us.apache.org/repos/asf/opennlp/blob/ebf10817/opennlp-tools/src/test/java/opennlp/tools/eval/Conll02NameFinderEval.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/test/java/opennlp/tools/eval/Conll02NameFinderEval.java b/opennlp-tools/src/test/java/opennlp/tools/eval/Conll02NameFinderEval.java
index d1a71cf..abe53aa 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/eval/Conll02NameFinderEval.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/eval/Conll02NameFinderEval.java
@@ -287,9 +287,9 @@ public class Conll02NameFinderEval {
     TokenNameFinderModel maxentModel = train(dutchTrainingFile, LANGUAGE.NL, params,
         combinedType);
 
-    eval(maxentModel, dutchTestAFile, LANGUAGE.NL,   combinedType, 0.6728164867517175d);
+    eval(maxentModel, dutchTestAFile, LANGUAGE.NL,   combinedType, 0.6673209028459275d);
 
-    eval(maxentModel, dutchTestBFile, LANGUAGE.NL, combinedType, 0.6985893619774816d);
+    eval(maxentModel, dutchTestBFile, LANGUAGE.NL, combinedType, 0.6984085910208306d);
   }
 
   @Test
@@ -507,9 +507,9 @@ public class Conll02NameFinderEval {
     TokenNameFinderModel maxentModel = train(spanishTrainingFile, LANGUAGE.ES, params,
         combinedType);
 
-    eval(maxentModel, spanishTestAFile, LANGUAGE.ES, combinedType, 0.706765154179857d);
+    eval(maxentModel, spanishTestAFile, LANGUAGE.ES, combinedType, 0.707400023454908d);
 
-    eval(maxentModel, spanishTestBFile, LANGUAGE.ES, combinedType, 0.7583580194667795d);
+    eval(maxentModel, spanishTestBFile, LANGUAGE.ES, combinedType, 0.7576868829337094d);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/opennlp/blob/ebf10817/opennlp-tools/src/test/java/opennlp/tools/namefind/NameFinderSequenceValidatorTest.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/test/java/opennlp/tools/namefind/NameFinderSequenceValidatorTest.java b/opennlp-tools/src/test/java/opennlp/tools/namefind/NameFinderSequenceValidatorTest.java
index 35752c1..1b2f6ed 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/namefind/NameFinderSequenceValidatorTest.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/namefind/NameFinderSequenceValidatorTest.java
@@ -17,7 +17,6 @@
 package opennlp.tools.namefind;
 
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -55,7 +54,6 @@ public class NameFinderSequenceValidatorTest {
 
   }
 
-  @Ignore
   @Test
   public void testContinueAfterStartAndNotSameType() {