Package org.apache.ctakes.typesystem.type.syntax

Examples of org.apache.ctakes.typesystem.type.syntax.ConllDependencyNode


//    }
//    System.out.println();
   
    // Iterate through all nodes in the sentence to find the focus node
    for (int i=0; i<nodes.size(); i++) {
      ConllDependencyNode hypNegNode = nodes.get(i);
//      System.out.println("Node "+i+": {"+hypNegNode.getFORM()+"}"+hypNegNode.getPOSTAG()+">"+hypNegNode.getDEPREL());
      DependencyPath path = DependencyUtility.getPath(nodes, hypNegNode, focus);
      if(path == null) continue;
      int featMatchInd = findPathMatches(path);
      if ( featMatchInd != -1) {
View Full Code Here


    }
   
   
    List<ConllDependencyNode> depnodes = JCasUtil.selectCovered(jCas, ConllDependencyNode.class, arg);
    if (!depnodes.isEmpty()) {
      ConllDependencyNode depnode = DependencyUtility.getNominalHeadNode(depnodes);

      // 1) check if the head node of the entity mention is really just part of a larger noun phrase
      if (depnode.getDeprel().matches("(NMOD|amod|nmod|det|predet|nn|poss|possessive|infmod|partmod|rcmod)")) {
        vfeat.put(POSTCOORD_NMOD, true);
      }

      // 4) search dependency paths for discussion context
      for (ConllDependencyNode dn : DependencyUtility.getPathToTop(jCas, depnode)) {
View Full Code Here

  public List<Feature> extract(JCas jCas, Annotation arg) {
   
    List<Feature> features = new ArrayList<Feature>();
   
    // 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);
View Full Code Here

   
    // search dependency paths for stuff
    List<ConllDependencyNode> depnodes = JCasUtil.selectCovered(jCas, ConllDependencyNode.class, mention);
    if (!depnodes.isEmpty()) {
      ConllDependencyNode depnode = DependencyUtility.getNominalHeadNode(depnodes);
      for (ConllDependencyNode dn : DependencyUtility.getPathToTop(jCas, depnode)) {
        if ( isDonorTerm(dn) ) {
          vfeat.put(DONOR_DEPPATH, true);
        }
        if ( isFamilyTerm(dn) ) {
View Full Code Here

  public List<Feature> extract(JCas jCas, Annotation arg) {
   
    List<Feature> features = new ArrayList<Feature>();
   
    // 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.getCoveredText()));
        features.add(new Feature("DEPENDENCY_HEAD_deprel", node.getDeprel()));
    }
     
      HashMap<String, Boolean> featsMap = GenericAttributeClassifier.extract(jCas, arg);

      // Pull in all the features that were used for the rule-based module
View Full Code Here

  public List<Feature> extract(JCas jCas, Annotation arg) {
   
    List<Feature> features = new ArrayList<Feature>();
   
    // 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.getCoveredText()));
        features.add(new Feature("DEPENDENCY_HEAD_deprel", node.getDeprel()));
    }
     
      HashMap<String, Boolean> featsMap = SubjectAttributeClassifier.extract(jCas, arg);

      if (!featsMap.isEmpty()) {
View Full Code Here

//    }
//    System.out.println();
   
    // Iterate through all nodes in the sentence to find the focus node
    for (int i=0; i<nodes.size(); i++) {
      ConllDependencyNode hypNegNode = nodes.get(i);
//      System.out.println("Node "+i+": {"+hypNegNode.getFORM()+"}"+hypNegNode.getPOSTAG()+">"+hypNegNode.getDEPREL());
      DependencyPath path = DependencyUtility.getPath(nodes, hypNegNode, focus);
      if(path == null) continue;
      int featMatchInd = findPathMatches(path);
      if ( featMatchInd != -1) {
View Full Code Here

    List<LinkedList<ConllDependencyNode>> paths = new ArrayList<LinkedList<ConllDependencyNode>>(2);
    LinkedList<ConllDependencyNode> node1ToHeadPath = DependencyParseUtils.getPathToSentenceHead(node1);
    LinkedList<ConllDependencyNode> node2ToHeadPath = DependencyParseUtils.getPathToSentenceHead(node2);
   
    // We will remove the last item in each path until they diverge
    ConllDependencyNode ancestor = null;
    while (!node1ToHeadPath.isEmpty() && !node2ToHeadPath.isEmpty()) {
      if (node1ToHeadPath.getLast() == node2ToHeadPath.getLast()) {
        node1ToHeadPath.removeLast();
        ancestor = node2ToHeadPath.removeLast();
      } else {
View Full Code Here

   */
  public static ConllDependencyNode findAnnotationHead(JCas jcas, Annotation annotation) {
 
      for (ConllDependencyNode depNode : JCasUtil.selectCovered(jcas, ConllDependencyNode.class, annotation)) {
       
        ConllDependencyNode head = depNode.getHead();
        if (head == null || head.getEnd() <= annotation.getBegin() || head.getBegin() > annotation.getEnd()) {
          // The head is outside the bounds of the annotation, so this node must be the annotation's head
          return depNode;
        }
      }
      // Can this happen?
View Full Code Here

      return null;
  }

  public static LinkedList<ConllDependencyNode> getPathToSentenceHead(ConllDependencyNode node) {
       LinkedList<ConllDependencyNode> path = new LinkedList<ConllDependencyNode>();
       ConllDependencyNode currNode = node;
       while (currNode.getHead() != null) {
           path.add(currNode);
           currNode = currNode.getHead();
       }
       return path;
  }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.typesystem.type.syntax.ConllDependencyNode

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.