ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1631897 - /ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/
Date Tue, 14 Oct 2014 21:50:10 GMT
Author: tmill
Date: Tue Oct 14 21:50:10 2014
New Revision: 1631897

URL: http://svn.apache.org/r1631897
Log:
CTAKES-280: Cleanup of assertion types for cleartk generic features.

Modified:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionAboveLeftTreeExtractor.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionDependencyTreeExtractor.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ContextWordWindowExtractor.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/TreeFragmentFeatureExtractor.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/UncertaintyFeatureExtractor.java

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionAboveLeftTreeExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionAboveLeftTreeExtractor.java?rev=1631897&r1=1631896&r2=1631897&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionAboveLeftTreeExtractor.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionAboveLeftTreeExtractor.java
Tue Oct 14 21:50:10 2014
@@ -25,16 +25,16 @@ import java.util.List;
 
 import org.apache.ctakes.assertion.util.SemanticClasses;
 import org.apache.ctakes.core.resource.FileLocator;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.utils.tree.SimpleTree;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.ml.Feature;
 import org.cleartk.ml.TreeFeature;
 import org.cleartk.ml.feature.extractor.CleartkExtractorException;
 import org.cleartk.ml.feature.extractor.FeatureExtractor1;
 import org.cleartk.util.CleartkInitializationException;
 
-public class AssertionAboveLeftTreeExtractor implements FeatureExtractor1 {
+public class AssertionAboveLeftTreeExtractor implements FeatureExtractor1<IdentifiedAnnotation>
{
   protected SemanticClasses sems = null;
 
   public AssertionAboveLeftTreeExtractor() throws CleartkInitializationException{
@@ -46,9 +46,9 @@ public class AssertionAboveLeftTreeExtra
   }
   
   @Override
-  public List<Feature> extract(JCas jcas, Annotation annotation)
+  public List<Feature> extract(JCas jcas, IdentifiedAnnotation annotation)
       throws CleartkExtractorException {
-    List<Feature> features = new ArrayList<Feature>();
+    List<Feature> features = new ArrayList<>();
     SimpleTree tree = extractAboveLeftConceptTree(jcas, annotation, sems);
     features.add(new TreeFeature("TK_AboveLeftTree", tree.toString()));
     return features;

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionDependencyTreeExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionDependencyTreeExtractor.java?rev=1631897&r1=1631896&r2=1631897&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionDependencyTreeExtractor.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AssertionDependencyTreeExtractor.java
Tue Oct 14 21:50:10 2014
@@ -26,11 +26,11 @@ import org.apache.ctakes.assertion.util.
 import org.apache.ctakes.assertion.util.SemanticClasses;
 import org.apache.ctakes.core.resource.FileLocator;
 import org.apache.ctakes.typesystem.type.syntax.ConllDependencyNode;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.ctakes.utils.tree.SimpleTree;
 import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.ml.Feature;
 import org.cleartk.ml.TreeFeature;
 import org.cleartk.ml.feature.extractor.CleartkExtractorException;
@@ -39,7 +39,7 @@ import org.cleartk.util.CleartkInitializ
 
 import com.google.common.collect.Lists;
 
-public class AssertionDependencyTreeExtractor implements FeatureExtractor1 {
+public class AssertionDependencyTreeExtractor implements FeatureExtractor1<IdentifiedAnnotation>
{
   protected SemanticClasses sems = null;
 
   public AssertionDependencyTreeExtractor() throws CleartkInitializationException {
@@ -51,7 +51,7 @@ public class AssertionDependencyTreeExtr
   }
   
   @Override
-  public List<Feature> extract(JCas jCas, Annotation arg1)
+  public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1)
       throws CleartkExtractorException {
     List<Feature> feats = Lists.newArrayList();
     TreeFeature f1 = null;

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ContextWordWindowExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ContextWordWindowExtractor.java?rev=1631897&r1=1631896&r2=1631897&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ContextWordWindowExtractor.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/ContextWordWindowExtractor.java
Tue Oct 14 21:50:10 2014
@@ -28,15 +28,15 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.ml.Feature;
 import org.cleartk.ml.feature.extractor.CleartkExtractorException;
 import org.cleartk.ml.feature.extractor.FeatureExtractor1;
 
-public class ContextWordWindowExtractor implements FeatureExtractor1 {
+public class ContextWordWindowExtractor implements FeatureExtractor1<IdentifiedAnnotation>
{
 
 	private HashMap<String,Double> termVals = null;
 	private static final Pattern linePatt = Pattern.compile("^([^ ]+) : (.+)$");
@@ -82,7 +82,7 @@ public class ContextWordWindowExtractor 
 	}
 	
 	@Override
-	public List<Feature> extract(JCas view, Annotation mention)
+	public List<Feature> extract(JCas view, IdentifiedAnnotation mention)
 			throws CleartkExtractorException {
 		ArrayList<Feature> feats = new ArrayList<Feature>();
 		List<Sentence> sents = JCasUtil.selectCovering(view, Sentence.class, mention.getBegin(),
mention.getEnd());

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/TreeFragmentFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/TreeFragmentFeatureExtractor.java?rev=1631897&r1=1631896&r2=1631897&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/TreeFragmentFeatureExtractor.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/TreeFragmentFeatureExtractor.java
Tue Oct 14 21:50:10 2014
@@ -26,10 +26,10 @@ import java.util.Scanner;
 
 import org.apache.ctakes.assertion.util.SemanticClasses;
 import org.apache.ctakes.core.resource.FileLocator;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.utils.tree.FragmentUtils;
 import org.apache.ctakes.utils.tree.SimpleTree;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.ml.Feature;
 import org.cleartk.ml.feature.extractor.FeatureExtractor1;
 import org.cleartk.util.CleartkInitializationException;
@@ -40,7 +40,7 @@ import org.cleartk.util.CleartkInitializ
  * Model location is hardcoded as of right now.
  * TODO: Parameterize this so that, e.g., multiple projects could use this feature if necessary.
  */
-public abstract class TreeFragmentFeatureExtractor implements FeatureExtractor1 {
+public abstract class TreeFragmentFeatureExtractor implements FeatureExtractor1<IdentifiedAnnotation>
{
 	public static final String PARAM_OUTPUTDIR = "outputDir";
 	public static final String PARAM_SEMDIR = "semDir";
 	protected HashSet<SimpleTree> frags = null;
@@ -55,7 +55,6 @@ public abstract class TreeFragmentFeatur
 		}catch(Exception e){
 		  throw new CleartkInitializationException(e, "org/apache/ctakes/assertion/all_cues.txt",
"Could not find semantic classes resource.", new Object[]{});
 		}
-
 	}
 
 	private void initializeFrags(String resourceFilename){
@@ -74,5 +73,5 @@ public abstract class TreeFragmentFeatur
 	}
 
 	@Override
-	public abstract List<Feature> extract(JCas jcas, Annotation annotation);
+	public abstract List<Feature> extract(JCas jcas, IdentifiedAnnotation annotation);
 }

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/UncertaintyFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/UncertaintyFeatureExtractor.java?rev=1631897&r1=1631896&r2=1631897&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/UncertaintyFeatureExtractor.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/UncertaintyFeatureExtractor.java
Tue Oct 14 21:50:10 2014
@@ -29,14 +29,14 @@ import org.cleartk.ml.Feature;
 import org.cleartk.ml.feature.extractor.CleartkExtractorException;
 import org.cleartk.ml.feature.extractor.FeatureExtractor1;
 
-public class UncertaintyFeatureExtractor implements FeatureExtractor1 {
+public class UncertaintyFeatureExtractor implements FeatureExtractor1<IdentifiedAnnotation>
{
 
   @Override
-  public List<Feature> extract(JCas view, Annotation focusAnnotation)
+  public List<Feature> extract(JCas view, IdentifiedAnnotation focusAnnotation)
       throws CleartkExtractorException {
-    List<Feature> featList = new ArrayList<Feature>();
+    List<Feature> featList = new ArrayList<>();
     
-    IdentifiedAnnotation mention = (IdentifiedAnnotation) focusAnnotation;
+    IdentifiedAnnotation mention = focusAnnotation;
     featList.add(new Feature("IsNegated", mention.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT));
     return featList;
   }



Mime
View raw message