ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1662010 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
Date Tue, 24 Feb 2015 16:36:01 GMT
Author: clin
Date: Tue Feb 24 16:36:01 2015
New Revision: 1662010

URL: http://svn.apache.org/r1662010
Log:
Add an non-overlapping span filter for event-event relations, so that expanded events would
not have overlapping spans.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java?rev=1662010&r1=1662009&r2=1662010&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
Tue Feb 24 16:36:01 2015
@@ -193,12 +193,18 @@ public class EventEventRelationAnnotator
 					//pairing covering system events:
 					for (EventMention event1 : coveringMap.get(eventA)){
 						for(EventMention event2 : coveringMap.get(eventB)){
-							pairs.add(new IdentifiedAnnotationPair(event1, event2));
+							if(!hasOverlap(event1,event2)){//don't generate overlapping arguments
+								pairs.add(new IdentifiedAnnotationPair(event1, event2));
+							}
+						}
+						if(!hasOverlap(event1,eventB)){//don't generate overlapping arguments
+							pairs.add(new IdentifiedAnnotationPair(event1, eventB));
 						}
-						pairs.add(new IdentifiedAnnotationPair(event1, eventB));
 					}
 					for(EventMention event2 : coveringMap.get(eventB)){
-						pairs.add(new IdentifiedAnnotationPair(eventA, event2));
+						if(!hasOverlap(eventA,event2)){//don't generate overlapping arguments
+							pairs.add(new IdentifiedAnnotationPair(eventA, event2));
+						}
 					}
 				}
 				pairs.add(new IdentifiedAnnotationPair(eventA, eventB));
@@ -226,6 +232,16 @@ public class EventEventRelationAnnotator
 		return pairs;
 	}
 
+	private static boolean hasOverlap(Annotation event1, Annotation event2) {
+		if(event1.getEnd()>=event2.getBegin()&&event1.getEnd()<=event2.getEnd()){
+			return true;
+		}
+		if(event2.getEnd()>=event1.getBegin()&&event2.getEnd()<=event2.getEnd()){
+			return true;
+		}
+		return false;
+	}
+
 	@Override
 	protected void createRelation(JCas jCas, IdentifiedAnnotation arg1,
 			IdentifiedAnnotation arg2, String predictedCategory) {



Mime
View raw message