ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1467325 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/TimeXExtractor.java
Date Fri, 12 Apr 2013 15:58:04 GMT
Author: clin
Date: Fri Apr 12 15:58:04 2013
New Revision: 1467325

URL: http://svn.apache.org/r1467325
Log:
add path feature between the closest time expression and the target event for docTimeRel

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

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/TimeXExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/TimeXExtractor.java?rev=1467325&r1=1467324&r2=1467325&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/TimeXExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/TimeXExtractor.java
Fri Apr 12 15:58:04 2013
@@ -28,6 +28,7 @@ import java.util.TreeMap;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.classifier.Feature;
@@ -38,12 +39,14 @@ import org.uimafit.util.JCasUtil;
 public class TimeXExtractor implements SimpleFeatureExtractor {
 
   private String name;
+  private EventTimeFlatTreeFeatureExtractor path;
 
 //  private Logger logger = Logger.getLogger(this.getClass().getName());
 
   public TimeXExtractor() {
     super();
     this.name = "TimeXFeature";
+    this.path = new EventTimeFlatTreeFeatureExtractor();
     
   }
 
@@ -73,9 +76,14 @@ public class TimeXExtractor implements S
 		  for (Map.Entry<Integer, TimeMention> entry : timeDistMap.entrySet()) {
 			  Feature feature = new Feature(this.name, entry.getValue().getCoveredText());
 			  features.add(feature);
-//			  logger.info("add time feature: "+ entry.getValue().getCoveredText() + entry.getValue().getTimeClass());
+			  //			  logger.info("add time feature: "+ entry.getValue().getCoveredText() + entry.getValue().getTimeClass());
 			  Feature indicator = new Feature("TimeXNearby", this.name);
 			  features.add(indicator);
+			  try {
+				  features.addAll(this.path.extract(view, targetTokenAnnotation, entry.getValue()));//add
path between timex and event
+			  } catch (AnalysisEngineProcessException e) {
+				  throw new IllegalArgumentException(String.format("error in gererating path feature:",
features));
+			  }
 			  break;
 		  }
 	  }



Mime
View raw message