ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1585753 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java
Date Tue, 08 Apr 2014 15:07:26 GMT
Author: dligach
Date: Tue Apr  8 15:07:25 2014
New Revision: 1585753

URL: http://svn.apache.org/r1585753
Log:
added time unit - wise duration difference features

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

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java?rev=1585753&r1=1585752&r2=1585753&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java
Tue Apr  8 15:07:25 2014
@@ -43,9 +43,9 @@ public class DurationEventTimeFeatureExt
   @Override
   public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1, IdentifiedAnnotation
arg2)
       throws AnalysisEngineProcessException {
-    
-    List<Feature> features = new ArrayList<Feature>();
-    
+
+    List<Feature> features = new ArrayList<>();
+
     String eventText = Utils.normalizeEventText(jCas, arg1); // arg1 is an event
     String timeText = arg2.getCoveredText().toLowerCase();  // arg2 is a time mention
 
@@ -57,15 +57,19 @@ public class DurationEventTimeFeatureExt
       e.printStackTrace();
       return features;
     }
-
     Map<String, Float> eventDistribution = textToDistribution.get(eventText);
-    float eventExpectedDuration = Utils.expectedDuration(eventDistribution);
 
     HashSet<String> timeUnits = Utils.getTimeUnits(timeText);
     for(String timeUnit : timeUnits) {
       Map<String, Float> timeDistribution = Utils.convertToDistribution(timeUnit);
+      for(String bin : Utils.bins) {
+        features.add(new Feature("bin_diff_" + bin, timeDistribution.get(bin) - eventDistribution.get(bin)));
+      }
+
+      float eventExpectedDuration = Utils.expectedDuration(eventDistribution);
       float timeExpectedDuration = Utils.expectedDuration(timeDistribution);
       features.add(new Feature("duration_difference", timeExpectedDuration - eventExpectedDuration));
+
       break; // for now only use firs time unit
     }
 



Mime
View raw message