Package org.apache.ctakes.assertion.medfacts.cleartk.extractors

Source Code of org.apache.ctakes.assertion.medfacts.cleartk.extractors.AboveLeftFragmentExtractor

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.constituency.parser.util.TreeUtils;
import org.apache.ctakes.utils.tree.SimpleTree;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.tcas.Annotation;
import org.cleartk.classifier.Feature;
import org.cleartk.util.CleartkInitializationException;

public class AboveLeftFragmentExtractor extends TreeFragmentFeatureExtractor {

  public AboveLeftFragmentExtractor(String prefix, String resourceFilename)
      throws CleartkInitializationException {
    super(prefix, resourceFilename);
  }

  @Override
  public List<Feature> extract(JCas jcas, Annotation annotation) {
    List<Feature> features = new ArrayList<Feature>();
    SimpleTree tree = extractAboveLeftConceptTree(jcas, annotation, sems);
   
    for(SimpleTree frag : frags){
      if(TreeUtils.containsIgnoreCase(tree, frag)){
        features.add(new Feature("TreeFrag_" + prefix, frag.toString()));
      }
    }
 
    return features;
  }

}
TOP

Related Classes of org.apache.ctakes.assertion.medfacts.cleartk.extractors.AboveLeftFragmentExtractor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.