incubator-ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevenbeth...@apache.org
Subject svn commit: r1414613 - in /incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature: ./ selection/
Date Wed, 28 Nov 2012 09:46:33 GMT
Author: stevenbethard
Date: Wed Nov 28 09:46:32 2012
New Revision: 1414613

URL: http://svn.apache.org/viewvc?rev=1414613&view=rev
Log:
Fixes some warnings in ctakes-temporal

Modified:
    incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/CoveredTextToValuesExtractor.java
    incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SRLExtractor.java
    incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SurfaceFormFeatureExtractor.java
    incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/selection/MutualInformationFeatureSelectionExtractor.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=1414613&r1=1414612&r2=1414613&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
Wed Nov 28 09:46:32 2012
@@ -64,8 +64,8 @@ public class CoveredTextToValuesExtracto
     }
     ArrayList<Feature> features = new ArrayList<Feature>();
     for (int i = 0; i < values.length; ++i) {
-      String name = Feature.createName(this.name, String.valueOf(i));
-      features.add(new Feature(name, values[i]));
+      String featureName = Feature.createName(this.name, String.valueOf(i));
+      features.add(new Feature(featureName, values[i]));
     }
     return features;
   }

Modified: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SRLExtractor.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SRLExtractor.java?rev=1414613&r1=1414612&r2=1414613&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SRLExtractor.java
(original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SRLExtractor.java
Wed Nov 28 09:46:32 2012
@@ -19,7 +19,6 @@
 package org.apache.ctakes.temporal.ae.feature;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
@@ -39,20 +38,20 @@ public class SRLExtractor implements Sim
   public List<Feature> extract(JCas jCas, Annotation focusAnnotation)
       throws CleartkExtractorException {
     // and cache the results so that we only do this once per CAS
-	String jCasText = jCas.getDocumentText();
+	//String jCasText = jCas.getDocumentText();
 	String roleFeat = "SemanticRole";
-	String roleVerbFeat = "RoleAndVerb";
-	String verb = "noVerb";
+	//String roleVerbFeat = "RoleAndVerb";
+	//String verb = "noVerb";
     Feature role = new Feature(roleFeat, "NoRole");
-    Feature roleVerb = new Feature(roleVerbFeat, "NoRole"+verb);
+    //Feature roleVerb = new Feature(roleVerbFeat, "NoRole"+verb);
     ArrayList<Feature> features = new ArrayList<Feature>();
     for (Predicate predicate : JCasUtil.select(jCas, Predicate.class)) {
 
       for (BaseToken token : JCasUtil.selectCovered(jCas, BaseToken.class, predicate)) {
         if (token.equals(focusAnnotation)) {// token.getBegin()==focusAnnotation.getBegin()){
           role = new Feature(roleFeat,"Predicate");
-          verb = jCasText.substring(predicate.getBegin(), predicate.getEnd());
-          roleVerb = new Feature(roleVerbFeat, "Predicate::"+verb);
+          //verb = jCasText.substring(predicate.getBegin(), predicate.getEnd());
+          //roleVerb = new Feature(roleVerbFeat, "Predicate::"+verb);
           
           features.add(role);
           //features.add(roleVerb);
@@ -68,10 +67,10 @@ public class SRLExtractor implements Sim
         for (BaseToken token : JCasUtil.selectCovered(jCas, BaseToken.class, arg)) {
           if (token.equals(focusAnnotation)) {// token.getBegin()==focusAnnotation.getBegin()){
             String label = arg.getLabel();
-            Predicate currentPred = relation.getPredicate();
-            verb = jCasText.substring(currentPred.getBegin(), currentPred.getEnd());
+            //Predicate currentPred = relation.getPredicate();
+            //verb = jCasText.substring(currentPred.getBegin(), currentPred.getEnd());
             role = new Feature(roleFeat, label);
-            roleVerb = new Feature(roleVerbFeat, label+"::"+verb);
+            //roleVerb = new Feature(roleVerbFeat, label+"::"+verb);
             
             features.add(role);
             //features.add(roleVerb);

Modified: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SurfaceFormFeatureExtractor.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SurfaceFormFeatureExtractor.java?rev=1414613&r1=1414612&r2=1414613&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SurfaceFormFeatureExtractor.java
(original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/SurfaceFormFeatureExtractor.java
Wed Nov 28 09:46:32 2012
@@ -39,7 +39,7 @@ public class SurfaceFormFeatureExtractor
 	    int end = focusAnnotation.getEnd();
 	    String text = jCasText == null ? null : jCasText.substring(begin, end);
 	    features.add(new Feature(this.FEATURE_SURF, getStrType(text)));
-	    int length = text.length();
+	    int length = text == null ? 0 : text.length();
 	    if (length <=1) features.add(new Feature(this.FEATURE_LENGTH, "single"));
 	    else features.add(new Feature(this.FEATURE_LENGTH, "multiple"));
 

Modified: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/selection/MutualInformationFeatureSelectionExtractor.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/selection/MutualInformationFeatureSelectionExtractor.java?rev=1414613&r1=1414612&r2=1414613&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/selection/MutualInformationFeatureSelectionExtractor.java
(original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/selection/MutualInformationFeatureSelectionExtractor.java
Wed Nov 28 09:46:32 2012
@@ -20,8 +20,6 @@ import org.cleartk.classifier.Instance;
 import org.cleartk.classifier.feature.extractor.CleartkExtractorException;
 import org.cleartk.classifier.feature.extractor.simple.CombinedExtractor;
 import org.cleartk.classifier.feature.extractor.simple.SimpleFeatureExtractor;
-import org.apache.ctakes.temporal.ae.feature.selection.MutualInformationFeatureSelectionExtractor.CombineScoreMethod.CombineScoreFunction;
-import org.apache.ctakes.temporal.ae.feature.selection.MutualInformationFeatureSelectionExtractor.MutualInformationStats.ComputeFeatureScore;
 import org.cleartk.classifier.feature.transform.TransformableFeature;
 
 import com.google.common.base.Function;
@@ -60,11 +58,8 @@ public class MutualInformationFeatureSel
     // MERGE, // Take k-largest mutual information values for each class and merge into a
single
     // collection - currently omitted because it requires a different extraction flow
 
-    public abstract static class CombineScoreFunction<OUTCOME_T> implements
-        Function<Map<OUTCOME_T, Double>, Double> {
-    }
-
-    public static class AverageScores<OUTCOME_T> extends CombineScoreFunction<OUTCOME_T>
{
+    public static class AverageScores<OUTCOME_T>
+    implements Function<Map<OUTCOME_T, Double>, Double> {
       @Override
       public Double apply(Map<OUTCOME_T, Double> input) {
         Collection<Double> scores = input.values();
@@ -78,7 +73,8 @@ public class MutualInformationFeatureSel
       }
     }
 
-    public static class MaxScores<OUTCOME_T> extends CombineScoreFunction<OUTCOME_T>
{
+    public static class MaxScores<OUTCOME_T>
+    implements Function<Map<OUTCOME_T, Double>, Double> {
       @Override
       public Double apply(Map<OUTCOME_T, Double> input) {
         return Ordering.natural().max(input.values());
@@ -118,7 +114,7 @@ public class MutualInformationFeatureSel
       int[][] featureOutcomeCounts = new int[2][2];
 
       int n = this.classCounts.size();
-      featureCounts[1] = this.sum(this.classConditionalCounts.row(featureName).values());
+      featureCounts[1] = sum(this.classConditionalCounts.row(featureName).values());
       featureCounts[0] = n - featureCounts[1];
       outcomeCounts[1] = this.classCounts.count(outcome);
       outcomeCounts[0] = n - outcomeCounts[1];
@@ -145,7 +141,7 @@ public class MutualInformationFeatureSel
       return information;
     }
 
-    private int sum(Collection<Integer> values) {
+    private static int sum(Collection<Integer> values) {
       int total = 0;
       for (int v : values) {
         total += v;
@@ -186,7 +182,7 @@ public class MutualInformationFeatureSel
 
       private MutualInformationStats<OUTCOME_T> stats;
 
-      private CombineScoreFunction<OUTCOME_T> combineScoreFunction;
+      private Function<Map<OUTCOME_T, Double>, Double> combineScoreFunction;
 
       public ComputeFeatureScore(
           MutualInformationStats<OUTCOME_T> stats,



Mime
View raw message