ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1555921 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java
Date Mon, 06 Jan 2014 17:05:55 GMT
Author: dligach
Date: Mon Jan  6 17:05:55 2014
New Revision: 1555921

URL: http://svn.apache.org/r1555921
Log:
added logic to remove events and times that have no duration data

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

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java?rev=1555921&r1=1555920&r2=1555921&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java
Mon Jan  6 17:05:55 2014
@@ -50,7 +50,8 @@ public class PreserveCertainEventTimeRel
       throw new AnalysisEngineProcessException(e);                                      
                                    
     }                                                                                   
                                                                                         
                                                           
     
-    for (BinaryTextRelation relation : Lists.newArrayList(JCasUtil.select(goldView, BinaryTextRelation.class)))
{            
+    // remove relations where one or both arguments have no duration data
+    for(BinaryTextRelation relation : Lists.newArrayList(JCasUtil.select(goldView, BinaryTextRelation.class)))
{            
       RelationArgument arg1 = relation.getArg1();                                       
                                     
       RelationArgument arg2 = relation.getArg2(); 
       
@@ -76,6 +77,26 @@ public class PreserveCertainEventTimeRel
       arg1.removeFromIndexes();                                                         
                                  
       arg2.removeFromIndexes();                                                         
                                  
       relation.removeFromIndexes();
-    }                                                                                   
                                    
+    }
+    
+    // remove events (that didn't participate in relations) that have no data
+    for(EventMention mention : Lists.newArrayList(JCasUtil.select(goldView, EventMention.class)))
{
+      if(textToDistribution.containsKey(mention.getCoveredText().toLowerCase())) {
+        // these are the kind we keep
+        continue;
+      } 
+      mention.removeFromIndexes();
+    }
+    
+    // finally remove time expressions (that didn't participate in relations) that have no
data
+    for(TimeMention mention : Lists.newArrayList(JCasUtil.select(goldView, TimeMention.class)))
{
+      String timeText = mention.getCoveredText().toLowerCase();
+      Set<TemporalUnit> units = DurationTimeUnitFeatureExtractor.normalize(timeText);
+      if(units != null) {
+        // these are the kind we keep
+        continue;
+      }
+      mention.removeFromIndexes();
+    }
   }                                                                                     
                                    
 }                                                                                       
                                    
\ No newline at end of file



Mime
View raw message