ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1632042 - in /ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors: AboveLeftFragmentExtractor.java AboveRightFragmentExtractor.java
Date Wed, 15 Oct 2014 14:02:54 GMT
Author: tmill
Date: Wed Oct 15 14:02:53 2014
New Revision: 1632042

URL: http://svn.apache.org/r1632042
Log:
CTAKES-280: Fix feature extractors to use cleartk generics.

Modified:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveLeftFragmentExtractor.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveRightFragmentExtractor.java

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveLeftFragmentExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveLeftFragmentExtractor.java?rev=1632042&r1=1632041&r2=1632042&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveLeftFragmentExtractor.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveLeftFragmentExtractor.java
Wed Oct 15 14:02:53 2014
@@ -18,15 +18,14 @@
  */
 package org.apache.ctakes.assertion.medfacts.cleartk.extractors;
 
-import static org.apache.ctakes.assertion.util.AssertionTreeUtils.extractAboveLeftConceptTree;
-
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.ctakes.assertion.pipelines.GenerateTreeRepresentation;
 import org.apache.ctakes.constituency.parser.util.TreeUtils;
+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.util.CleartkInitializationException;
 
@@ -38,14 +37,17 @@ public class AboveLeftFragmentExtractor 
   }
 
   @Override
-  public List<Feature> extract(JCas jcas, Annotation annotation) {
-    List<Feature> features = new ArrayList<Feature>();
-    SimpleTree tree = extractAboveLeftConceptTree(jcas, annotation, sems);
+  public List<Feature> extract(JCas jcas, IdentifiedAnnotation annotation) {
+    List<Feature> features = new ArrayList<>();
+//    SimpleTree tree = AssertionTreeUtils.extractAboveLeftConceptTree(jcas, annotation,
sems);
+    SimpleTree tree = GenerateTreeRepresentation.getNegationTree(jcas, annotation, sems);
     
     for(SimpleTree frag : frags){
       if(TreeUtils.containsIgnoreCase(tree, frag)){
         features.add(new Feature("TreeFrag_" + prefix, frag.toString()));
       }
+      
+//      features.add(new Feature("TreeFrag_" + prefix + "_" + frag.toString(), TreeUtils.countFrags(tree,
frag)));
     }
   
     return features;

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveRightFragmentExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveRightFragmentExtractor.java?rev=1632042&r1=1632041&r2=1632042&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveRightFragmentExtractor.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/extractors/AboveRightFragmentExtractor.java
Wed Oct 15 14:02:53 2014
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.ctakes.constituency.parser.util.TreeUtils;
+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;
@@ -38,7 +39,7 @@ public class AboveRightFragmentExtractor
   }
 
   @Override
-  public List<Feature> extract(JCas jcas, Annotation annotation) {
+  public List<Feature> extract(JCas jcas, IdentifiedAnnotation annotation) {
     List<Feature> features = new ArrayList<Feature>();
     SimpleTree tree = extractAboveRightConceptTree(jcas, annotation, sems);
     
@@ -50,4 +51,5 @@ public class AboveRightFragmentExtractor
   
     return features;
   }
+
 }



Mime
View raw message