You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by dl...@apache.org on 2014/03/27 19:11:17 UTC
svn commit: r1582430 -
/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/Utils.java
Author: dligach
Date: Thu Mar 27 18:11:16 2014
New Revision: 1582430
URL: http://svn.apache.org/r1582430
Log:
moved mapping (bethard normalizer -> coarse time unit) to one place
Modified:
ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/Utils.java
Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/Utils.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/Utils.java?rev=1582430&r1=1582429&r2=1582430&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/Utils.java (original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/Utils.java Thu Mar 27 18:11:16 2014
@@ -133,15 +133,14 @@ public class Utils {
/**
* Take a time unit and return a probability distribution
* in which p(this time unit) = 1 and all others are zero.
+ * Assume time unit is one of the eight duration bins.
*/
public static Map<String, Float> convertToDistribution(String timeUnit) {
Map<String, Float> distribution = new HashMap<String, Float>();
for(String bin: bins) {
- // convert things like "Hours" to "hour"
- String normalized = timeUnit.substring(0, timeUnit.length() - 1).toLowerCase();
- if(bin.equals(normalized)) {
+ if(bin.equals(timeUnit)) {
distribution.put(bin, 1.0f);
} else {
distribution.put(bin, 0.0f);