ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1461151 - /incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/CoveredTextToValuesExtractor.java
Date Tue, 26 Mar 2013 14:23:09 GMT
Author: clin
Date: Tue Mar 26 14:23:09 2013
New Revision: 1461151

URL: http://svn.apache.org/r1461151
Log:
Narrow this feature only for wordToken.

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

Modified: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/CoveredTextToValuesExtractor.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/CoveredTextToValuesExtractor.java?rev=1461151&r1=1461150&r2=1461151&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/CoveredTextToValuesExtractor.java
(original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/CoveredTextToValuesExtractor.java
Tue Mar 26 14:23:09 2013
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
+import org.apache.ctakes.typesystem.type.syntax.WordToken;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.classifier.Feature;
@@ -103,16 +104,19 @@ public class CoveredTextToValuesExtracto
 
   @Override
   public List<Feature> extract(JCas view, Annotation annotation) throws CleartkExtractorException
{
-    double[] values = this.textDoublesMap.get(annotation.getCoveredText());
-    if (values == null) {
-      values = this.meanValues;
-    }
-    ArrayList<Feature> features = new ArrayList<Feature>();
-    for (int i = 0; i < values.length; ++i) {
-      String featureName = Feature.createName(this.name, String.valueOf(i));
-      features.add(new Feature(featureName, values[i]));
-    }
-    return features;
+	  ArrayList<Feature> features = new ArrayList<Feature>();
+	  if (annotation instanceof  WordToken){
+		  double[] values = this.textDoublesMap.get(annotation.getCoveredText().toLowerCase());
+		  if (values == null) {
+			  values = this.meanValues;
+		  }
+
+		  for (int i = 0; i < values.length; ++i) {
+			  String featureName = Feature.createName(this.name, String.valueOf(i));
+			  features.add(new Feature(featureName, values[i]));
+		  }
+	  }
+	  return features;
   }
 
 }



Mime
View raw message