ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1591721 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationExpectationFeatureExtractor.java
Date Thu, 01 May 2014 18:06:25 GMT
Author: dligach
Date: Thu May  1 18:06:24 2014
New Revision: 1591721

URL: http://svn.apache.org/r1591721
Log:
added a few more duration representations

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

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationExpectationFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationExpectationFeatureExtractor.java?rev=1591721&r1=1591720&r2=1591721&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationExpectationFeatureExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationExpectationFeatureExtractor.java
Thu May  1 18:06:24 2014
@@ -62,11 +62,26 @@ public class DurationExpectationFeatureE
     Map<String, Float> eventDistribution = textToDistribution.get(eventText);
     if(eventDistribution == null) {
       features.add(new Feature("no_duration_info"));
-    } else {
-      float expectation = Utils.expectedDuration(eventDistribution);
-      features.add(new Feature("expected_duration", expectation));
+      return features;
+    }
+    
+    float expectation = Utils.expectedDuration(eventDistribution);
+    features.add(new Feature("expected_duration", expectation));
+    
+    for(String bin : Utils.bins) {
+      features.add(new Feature(bin, eventDistribution.get(bin)));
     }
 
+    String largestBin = null;
+    float largestValue = 0f;
+    for(String bin : Utils.bins) {
+      if(eventDistribution.get(bin) > largestValue) {
+        largestBin = bin;
+        largestValue = eventDistribution.get(bin);
+      }
+    }
+    features.add(new Feature("largest_bin_" + largestBin));
+    
     return features;
   }
 }
\ No newline at end of file



Mime
View raw message