Examples of TreebankNode


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

      IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
    List<Feature> features = new ArrayList<Feature>();
   
    SimpleTree tree = null;
    tree = new SimpleTree("BOP");
    TreebankNode lca = TreeExtractor.getLCA(AnnotationTreeUtils.annotationNode(jcas, arg1),
                        AnnotationTreeUtils.annotationNode(jcas, arg2));
       
    SimpleTree arg1Tree = new SimpleTree("ARG1");
    SimpleTree arg2Tree = new SimpleTree("ARG2");
   
View Full Code Here

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

  public static List<TreebankNode> getNodeList(TopTreebankNode tree){
    ArrayList<TreebankNode> list = new ArrayList<TreebankNode>();
    list.add(tree);
    int ind = 0
    while(ind < list.size()){
      TreebankNode cur = list.get(ind);
      for(int i = 0; i < cur.getChildren().size(); i++){
        list.add(cur.getChildren(i));
      }
      ind++;
    }
    return list;
  }
View Full Code Here

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

    }
      return getHighestIndexTerm(inTree.getChildren(inTree.getChildren().size()-1));
  }

  public static TopTreebankNode getTopNode(TreebankNode inTree) {
    TreebankNode cur = inTree;
    TopTreebankNode top = null;
   
    while(!(cur instanceof TopTreebankNode)){
      cur = cur.getParent();
    }
    top = (TopTreebankNode) cur;
    return top;
  }
View Full Code Here

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

        children.set(i,term);
        term.setParent(parent);
        term.addToIndexes();
      }else{
        try{
          TreebankNode child = new TreebankNode(jcas);
          child.setParent(parent);
          children.set(i, child);
          recursivelyCreateStructure(jcas, child, subtree, root);
          child.addToIndexes();
        }catch(NullPointerException e){
          System.err.println("MaxentParserWrapper Error: " + e);
          throw new AnalysisEngineProcessException();
        }
      }
View Full Code Here

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

    // first get the root and print it out...
    TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, AnnotationTreeUtils.getAnnotationTree(jcas, arg1));
   
//    SimpleTree tempClone = TreeExtractor.getSimpleClone(root);
//    features.add(new Feature("TK_FULL", tempClone.toString()));
    TreebankNode t1 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg1, "ARG1");
    TreebankNode t2 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg2, "ARG2");

    SimpleTree tree = null;
    if(t1.getBegin() <= t2.getBegin() && t1.getEnd() >= t2.getEnd()){
      // t1 encloses t2
      tree = TreeExtractor.getSimpleClone(t1);
    }else if(t2.getBegin() <= t1.getBegin() && t2.getEnd() >= t1.getEnd()){
      // t2 encloses t1
      tree = TreeExtractor.getSimpleClone(t2);
    }else{
      tree = TreeExtractor.extractPathEnclosedTree(t1, t2, jcas);
    }
View Full Code Here

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

      Sentence sentence = new Sentence(jcas, tree.getBegin(), tree.getEnd());
      sentence.addToIndexes();

      // create the Tokens and add them to the Sentence
      for (int i = 0; i < tree.getTerminals().size(); i++) {
        TreebankNode leaf = tree.getTerminals(i);
        if (leaf.getBegin() != leaf.getEnd()) {
          BaseToken token = new BaseToken(jcas, leaf.getBegin(), leaf.getEnd());
          token.setPartOfSpeech(leaf.getNodeType());
          token.addToIndexes();
        }
      }
    }
  }
View Full Code Here

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

  private static void _initTerminalNodes(
      TreebankNode node,
      List<TerminalTreebankNode> terminals) {
    FSArray children = node.getChildren();
    for (int i = 0; i < children.size(); i++) {
      TreebankNode child = (TreebankNode) children.get(i);
      if (child instanceof TerminalTreebankNode) {
        terminals.add((TerminalTreebankNode) child);
      } else
        _initTerminalNodes(child, terminals);
    }
View Full Code Here

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

    uimaNode.setLeaf(pojoNode.isLeaf());
    uimaNode.setParent(parentNode);

    List<TreebankNode> uimaChildren = new ArrayList<TreebankNode>();
    for (org.cleartk.syntax.constituent.util.TreebankNode child : pojoNode.getChildren()) {
      TreebankNode childNode;
      if (child.isLeaf()) {
        childNode = new TerminalTreebankNode(jCas, child.getTextBegin(), child.getTextEnd());
      } else {
        childNode = new TreebankNode(
            jCas,
            child.getTextBegin(),
            child.getTextEnd());
      }
      uimaChildren.add(convert(child, jCas, childNode, uimaNode));
      childNode.addToIndexes();
    }
    FSArray uimaChildrenFSArray = new FSArray(jCas, uimaChildren.size());
    uimaChildrenFSArray.copyFromArray(
        uimaChildren.toArray(new FeatureStructure[uimaChildren.size()]),
        0,
View Full Code Here

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

    // now do children if not a leaf & not a mention
    if(node.getLeaf() || MENTION.equals(category)) return score;
   
    double highestScore = 0.5;
    TreebankNode highestScoringChild = null;
   
    for(int i = 0; i < node.getChildren().size(); i++){
      TreebankNode child = node.getChildren(i);
      double childScore = recursivelyProcessNode(jCas, child, mentions, Math.max(score, parentScore));
      if(childScore > highestScore){
        highestScoringChild = child;
        highestScore = childScore;
      }
View Full Code Here

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

  public static SimpleTree extractAboveLeftConceptTree(JCas jcas, Annotation mention, SemanticClasses sems){
    SimpleTree tree = null;
    TopTreebankNode annotationTree = AnnotationTreeUtils.getAnnotationTree(jcas, mention);
    if(annotationTree != null){
      TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, annotationTree);
      TreebankNode conceptNode = AnnotationTreeUtils.insertAnnotationNode(jcas, root, mention, "CONCEPT");
      // navigate up the tree to retrieve the first "S" above this node.
      TreebankNode node = conceptNode;
      while(node.getParent() != null && !node.getNodeType().startsWith("S")){
        node =  node.getParent();
      }

//      elevateListConcepts(jcas, node);
     
      // remove nodes to the right of the CONCEPT node
View Full Code Here
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.