incubator-ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevenbeth...@apache.org
Subject svn commit: r1401758 - /incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java
Date Wed, 24 Oct 2012 16:18:21 GMT
Author: stevenbethard
Date: Wed Oct 24 16:18:21 2012
New Revision: 1401758

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

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

Modified: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java?rev=1401758&r1=1401757&r2=1401758&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventAnnotator.java
Wed Oct 24 16:18:21 2012
@@ -20,6 +20,7 @@ package org.apache.ctakes.temporal.ae;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -56,10 +57,12 @@ import org.cleartk.classifier.jar.JarCla
 import org.uimafit.factory.AnalysisEngineFactory;
 import org.uimafit.util.JCasUtil;
 
+import com.google.common.base.Charsets;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.common.io.LineProcessor;
+import com.google.common.io.Resources;
 
 public class EventAnnotator extends CleartkAnnotator<String> {
 
@@ -115,9 +118,9 @@ public class EventAnnotator extends Clea
         new CharacterCategoryPatternExtractor(PatternType.ONE_PER_CHAR),
         new TypePathExtractor(BaseToken.class, "partOfSpeech")));
     // new SRLExtractor(),
-    // new CoveredTextToValuesExtractor("ACF", parseStringDoublesMap("/word_freq.lst")),
-    // new CoveredTextToValuesExtractor("PCA", parseStringDoublesMap("/word_pca.lst")),
-    // new CoveredTextToValuesExtractor("TimPCA", parseStringDoublesMap("/tim_word_pca.txt")),
+    // new CoveredTextToValuesExtractor("ACF", StringToDoublesProcessor.parse("/word_freq.lst")),
+    // new CoveredTextToValuesExtractor("PCA", StringToDoublesProcessor.parse("/word_pca.lst")),
+    // new CoveredTextToValuesExtractor("TimPCA", StringToDoublesProcessor.parse("/tim_word_pca.txt")),
     // new PhraseExtractor()));
     // } catch (IOException e) {
     // throw new ResourceInitializationException(e);
@@ -137,13 +140,6 @@ public class EventAnnotator extends Clea
         new Following(3)));
   }
 
-  // private static Map<String, double[]> parseStringDoublesMap(String resourcePath)
-  // throws IOException {
-  // StringToDoublesProcessor processor = new StringToDoublesProcessor();
-  // URL url = EventAnnotator.class.getResource(resourcePath);
-  // return Resources.readLines(url, Charsets.US_ASCII, processor);
-  // }
-
   @Override
   public void process(JCas jCas) throws AnalysisEngineProcessException {
     // classify tokens within each sentence
@@ -236,7 +232,13 @@ public class EventAnnotator extends Clea
     };
   }
 
-  private static class StringToDoublesProcessor implements LineProcessor<Map<String,
double[]>> {
+  static class StringToDoublesProcessor implements LineProcessor<Map<String, double[]>>
{
+    public static Map<String, double[]> parse(String resourcePath) throws IOException
{
+      StringToDoublesProcessor processor = new StringToDoublesProcessor();
+      URL url = EventAnnotator.class.getResource(resourcePath);
+      return Resources.readLines(url, Charsets.US_ASCII, processor);
+    }
+
     private Logger logger = Logger.getLogger(this.getClass().getName());
 
     private Map<String, double[]> result = new HashMap<String, double[]>();



Mime
View raw message