Package org.apache.ctakes.utils.tree

Examples of org.apache.ctakes.utils.tree.SimpleTree


    }
    return node;
  }

  private static SimpleTree buildSimpleClonePET(TreebankNode lca, TreebankNode t1, TreebankNode t2){
    SimpleTree t = new SimpleTree(lca.getNodeType());
    if(!(lca instanceof TerminalTreebankNode)){
      for(int i = 0; i < lca.getChildren().size(); i++){
        TreebankNode tn = lca.getChildren(i);
        if(tn.getEnd() > t1.getBegin() && tn.getBegin() < t2.getEnd()){
          t.addChild(buildSimpleClonePET(lca.getChildren(i), t1, t2));
        }
      }
    }
    return t;
  }
View Full Code Here


//    node.setChildren(1,pt2);
//    return node;
//  }
 
  private static SimpleTree sameTree(TreebankNode t1, TreebankNode t2){
    SimpleTree node = new SimpleTree(t1.getNodeType());
    node.addChild(new SimpleTree("ANTECEDENT"));
    node.children.get(0).addChild(new SimpleTree("antecedent"));
    node.addChild(new SimpleTree("ANAPHOR"));
    node.children.get(1).addChild(new SimpleTree("anaphor"));
    return node;
  }
View Full Code Here

   *
   * It uses the method getSurroundingTree in a somewhat clever way to do the additional annotation
   * on the output string instead of the tree object.
   */
  public static SimpleTree getSurroundingTreeWithAnnotation(TreebankNode node, String string) {
    SimpleTree inner = getSimpleClone(node);
    SimpleTree outer = getSurroundingTree(node);
   
    String innerString = inner.toString();
    String outerString = outer.toString();
   
    String fullString = outerString.replace(innerString, "(" + string + " " + innerString + ")");
    return SimpleTree.fromString(fullString);   
  }
View Full Code Here

    String fullString = outerString.replace(innerString, "(" + string + " " + innerString + ")");
    return SimpleTree.fromString(fullString);   
  }

  public static SimpleTree getSurroundingTree(TreebankNode node){
    SimpleTree tree = null;
    TreebankNode top = node;
    while(node.getParent() != null){
      node = node.getParent();
    }
    tree = getSimpleClone(node);
View Full Code Here

    tree = getSimpleClone(node);
    return tree;
  }

  public static SimpleTree getSimpleClone(TreebankNode node) {
    SimpleTree t = new SimpleTree(node.getNodeType());
    if(!(node instanceof TerminalTreebankNode)){
      for(int i = 0; i < node.getChildren().size(); i++){
        t.addChild(getSimpleClone(node.getChildren(i)));
      }
    }
    return t;
  }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.utils.tree.SimpleTree

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.