Package org.cleartk.classifier

Examples of org.cleartk.classifier.Feature


        score += (weight * termVals.get(key));
      }
    }

    score /= z;  // weight by actual amount of context so we don't penalize begin/end of sentence.
    feats.add(new Feature("WORD_SCORE", score));
    return feats;
  }
View Full Code Here


    ConllDependencyNode headNode = DependencyUtility.getNominalHeadNode(jcas, focusAnnotation);
    try {
      boolean[] regexFeats = conAnal.findNegationContext(nodes, headNode);
      for(int j = 0; j < regexFeats.length; j++){
        if(regexFeats[j]){
          feats.add(new Feature("DepPath_" + conAnal.getRegexName(j))); //"NEG_DEP_REGEX_"+j));
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new CleartkExtractorException(e);
View Full Code Here

    List<Feature> features = new ArrayList<Feature>();
    SimpleTree tree = extractAboveRightConceptTree(jcas, annotation, sems);
   
    for(SimpleTree frag : frags){
      if(TreeUtils.containsIgnoreCase(tree, frag)){
        features.add(new Feature("TreeFrag_" + prefix, frag.toString()));
      }
    }
 
    return features;
  }
View Full Code Here

    List<Feature> feats = new ArrayList<Feature>();
    List<Sentence> sents = JCasUtil.selectCovering(jCas, Sentence.class, entity.getBegin(), entity.getEnd());
    if(sents!= null && sents.size() > 0){
      List<String> srlFeats = getEntityFeats(jCas, (IdentifiedAnnotation) entity, sents.get(0));
      for(String feat : srlFeats){
        feats.add(new Feature(feat));
      }
    }
    return feats;
  }
View Full Code Here

    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;
  }
View Full Code Here

    }
   
    ArrayList<Feature> featureList = new ArrayList<Feature>();
    for (Zone zone : zoneList)
    {
      Feature currentFeature = new Feature("zone", zone.getLabel());
      logger.info(String.format("zone: %s", zone.getLabel()));
      logger.info(String.format("zone feature: %s", currentFeature.toString()));
      featureList.add(currentFeature);
    }
   
    logger.debug("SurroundingExtractor.extract() END");
    return featureList;
View Full Code Here

   
    // Pull in general dependency-based features -- externalize to another extractor?
      ConllDependencyNode node = DependencyUtility.getNominalHeadNode(jCas, arg);
      if (node!= null) {
//        features.add(new Feature("DEPENDENCY_HEAD", node));
        features.add(new Feature("DEPENDENCY_HEAD_word", node.getCoveredText()));
//        features.add(new Feature("DEPENDENCY_HEAD_pos", node.getPostag()));
        features.add(new Feature("DEPENDENCY_HEAD_deprel", node.getDeprel()));
//        features.add(new Feature("DEPENDENCY_HEAD_lemma", node.getLemma()));
    }
     
      HashMap<String, Boolean> featsMap = HistoryAttributeClassifier.extract(jCas, arg);

      // Pull in all the features that were used for the rule-based module
      features.addAll( hashToFeatureList(featsMap) );
      // Pull in the result of the rule-based module as well
      features.add(new Feature("HISTORY_CLASSIFIER_LOGIC", HistoryAttributeClassifier.classifyWithLogic(featsMap)));

     
      return features;
  }
View Full Code Here

  private Collection<? extends Feature> hashToFeatureList(
      HashMap<String, Boolean> featsIn) {
   
    Collection<Feature> featsOut = new HashSet<Feature>();
    for (String featName : featsIn.keySet()) {
      featsOut.add(new Feature(featName,featsIn.get(featName)));
    }
   
    return featsOut;
  }
View Full Code Here

     
      List<LinkedList<ConllDependencyNode>> paths = DependencyParseUtils.getPathsToCommonAncestor(node1, node2);
      LinkedList<ConllDependencyNode> path1 = paths.get(0);
      LinkedList<ConllDependencyNode> path2 = paths.get(1);
     
      features.add(new Feature("DEPENDENCY_PATH_MEAN_DISTANCE_TO_COMMON_ANCESTOR", (path1.size() + path2.size()) / 2.0));
      features.add(new Feature("DEPENDENCY_PATH_MAX_DISTANCE_TO_COMMON_ANCESTOR", Math.max(path1.size(), path2.size())));
      features.add(new Feature("DEPENDENCY_PATH_MIN_DISTANCE_TO_COMMON_ANCESTOR", Math.min(path1.size(), path2.size())));
     
      LinkedList<ConllDependencyNode> node1ToNode2Path = DependencyParseUtils.getPathBetweenNodes(node1, node2);
      features.add(new Feature("DEPENDENCY_PATH", DependencyParseUtils.pathToString(node1ToNode2Path)));
     
      return features;
  }
View Full Code Here

    // entity1 ... entity2 scenario
    if(arg1.getEnd() < arg2.getBegin()) {
      for(NP np : JCasUtil.selectCovering(jCas, NP.class, arg1.getBegin(), arg2.getEnd())) {
        if(arg1.getBegin() == np.getBegin() && arg2.getEnd() == np.getEnd()) {
          features.add(new Feature("arg1arg2insideNP", true));
        }
      }
    }

// entity2 ... entity1 scenario
    if(arg2.getEnd() < arg1.getBegin()) {
      for(NP np : JCasUtil.selectCovering(jCas, NP.class, arg2.getBegin(), arg1.getEnd())) {
        if(arg2.getBegin() == np.getBegin() && arg1.getEnd() == np.getEnd()) {
          features.add(new Feature("arg2arg1insideNP", true));
        }
      }
    }
   
    return features;
View Full Code Here

TOP

Related Classes of org.cleartk.classifier.Feature

Copyright © 2018 www.massapicom. 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.