ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1620417 - /ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java
Date Mon, 25 Aug 2014 19:22:58 GMT
Author: clin
Date: Mon Aug 25 19:22:57 2014
New Revision: 1620417

URL: http://svn.apache.org/r1620417
Log:
fix an bug in the compareTo method which may cause general contract violation. The End positions
should also be compared for some cases. Thanks to Tim Miller.

Modified:
    ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java

Modified: ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java?rev=1620417&r1=1620416&r2=1620417&view=diff
==============================================================================
--- ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java
(original)
+++ ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java
Mon Aug 25 19:22:57 2014
@@ -700,14 +700,19 @@ public class RelationExtractorEvaluation
     public int compareTo(HashableArguments that) {
       int thisBegin = Math.min(this.arg1begin, this.arg2begin);
       int thatBegin = Math.min(that.arg1begin, that.arg2begin);
+      int thisEnd = Math.max(this.arg1end,  this.arg2end);
+      int thatEnd = Math.max(that.arg1end, that.arg2end);
+      
       if (thisBegin < thatBegin) {
         return -1;
       } else if (thisBegin > thatBegin) {
         return +1;
       } else if (this.equals(that)) {
         return 0;
-      } else {
-        return +1; // arbitrary choice for overlapping
+      } else if (thisEnd < thatEnd) {
+    	  return -1;
+      } else{
+    	  return 1;
       }
     }
 



Mime
View raw message