ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1554330 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java
Date Mon, 30 Dec 2013 22:42:56 GMT
Author: dligach
Date: Mon Dec 30 22:42:55 2013
New Revision: 1554330

URL: http://svn.apache.org/r1554330
Log:
simplified to isolate an error

Added:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java
      - copied, changed from r1552796, ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelations.java

Copied: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java
(from r1552796, ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelations.java)
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java?p2=ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java&p1=ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelations.java&r1=1552796&r2=1554330&rev=1554330&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/PreserveCertainEventTimeRelationsInGold.java
Mon Dec 30 22:42:55 2013
@@ -1,60 +1,40 @@
 package org.apache.ctakes.temporal.ae;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.ctakes.temporal.ae.feature.duration.DurationDistributionFeatureExtractor.Callback;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.relation.RelationArgument;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
+import org.apache.ctakes.typesystem.type.textsem.TimeMention;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.cas.CASException;
 import org.apache.uima.jcas.JCas;
 import org.uimafit.component.JCasAnnotator_ImplBase;
 import org.uimafit.util.JCasUtil;
 
-import com.google.common.base.Charsets;
 import com.google.common.collect.Lists;
-import com.google.common.io.Files;
 
-public class PreserveCertainEventTimeRelations extends JCasAnnotator_ImplBase {         
                                     
+public class PreserveCertainEventTimeRelationsInGold extends JCasAnnotator_ImplBase {   
                                           
   
   public static final String GOLD_VIEW_NAME = "GoldView";
 
   @Override                                                                             
                                    
   public void process(JCas jCas) throws AnalysisEngineProcessException {                
                                    
-                                                                                        
                                    
-    File durationLookup = new File("/Users/Dima/Boston/Thyme/Duration/Output/Duration/distribution.txt");
                   
-    Map<String, Map<String, Float>> textToDistribution = null;              
                                                
-    try {                                                                               
                                    
-      textToDistribution = Files.readLines(durationLookup, Charsets.UTF_8, new Callback());
                                 
-    } catch(IOException e) {                                                            
                                    
-      e.printStackTrace();                                                              
                                    
-      return;                                                                           
                                    
-    }                                                                                   
                                    
-                                                                                        
                                    
+
     JCas goldView;                                                                      
                                    
     try {                                                                               
                                    
       goldView = jCas.getView(GOLD_VIEW_NAME);                                          
                                    
     } catch (CASException e) {                                                          
                                    
       throw new AnalysisEngineProcessException(e);                                      
                                    
-    }                                                                                   
                                    
+    }                                                                                   
                                                                                         
                                                           
                                                                                         
                                    
     for (BinaryTextRelation relation : Lists.newArrayList(JCasUtil.select(goldView, BinaryTextRelation.class)))
{            
-      RelationArgument arg1 = relation.getArg1();                                       
                                    
-      RelationArgument arg2 = relation.getArg2();                                       
                                    
-      String arg1text = arg1.getArgument().getCoveredText().toLowerCase();              
                                    
-      String arg2text = arg2.getArgument().getCoveredText().toLowerCase();              
                                    
-      if(arg1.getArgument() instanceof EventMention && arg2.getArgument() instanceof
EventMention){                          
-        if(textToDistribution.containsKey(arg1text) || textToDistribution.containsKey(arg2text))
{                           
-          // keep relations where on of the arguments has duration data                 
                                    
-          continue;                                                                     
                                    
-        }                                                                               
                                    
-                                                                                        
                                    
+      RelationArgument arg1 = relation.getArg1(); // arg1 is an event                   
                                                        
+      RelationArgument arg2 = relation.getArg2(); // arg2 is a time expression
+      
+      if(arg1.getArgument() instanceof EventMention && arg2.getArgument() instanceof
TimeMention){
         arg1.removeFromIndexes();                                                       
                                    
         arg2.removeFromIndexes();                                                       
                                    
-        relation.removeFromIndexes();                                                   
                                    
+        relation.removeFromIndexes();
+        System.out.println("removing: " + relation.getCategory());
       }                                                                                 
                                    
     }                                                                                   
                                    
   }                                                                                     
                                    



Mime
View raw message