Examples of SimpleTree

  • com.intellij.ui.treeStructure.SimpleTree
  • com.vaadin.client.SimpleTree
    @author Vaadin Ltd @deprecated as of 7.1. This class was mainly used by the old debug consolebut is retained for now for backwards compatibility.
  • de.timefinder.algo.graph.SimpleTree
    Used for the augmenting tree in KuhnMunkresAlgorithm @author Peter Karich, peat_hal 'at' users 'dot' sourceforge 'dot' net
  • org.apache.ctakes.utils.tree.SimpleTree
  • org.jamesii.core.util.graph.trees.SimpleTree
    This class merely defines a 'simple' tree that has {@link Integer} asvertices, {@link Double} as vertex and edge labels, and both vertices andlabels can be annotated by any {@link Object}. Creation date: 12.12.2006 @author Roland Ewald

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

      @Override
      public List<Feature> extract(JCas jcas, IdentifiedAnnotation arg1,
          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");
       
        tree.addChild(arg1Tree);
        List<BaseToken> coveredTokens = JCasUtil.selectCovered(jcas, BaseToken.class, lca);
        for(BaseToken token : coveredTokens){
          // create pre-terminal tree
          SimpleTree tokenTree = new SimpleTree("TOK");
    //      tokenTree.addChild(new SimpleTree(token.getCoveredText()));
          tokenTree.addChild(new SimpleTree(token.getPartOfSpeech()));
         
          // do we add this to one of the arg trees or to the root?
          if(token.getEnd() <= arg1.getEnd()){
            arg1Tree.addChild(tokenTree);
          }else if(token.getBegin() >= arg2.getBegin()){
            arg2Tree.addChild(tokenTree);
          }else{
            SimpleTree termTree = new SimpleTree("TERM");
            termTree.addChild(tokenTree);
            tree.addChild(termTree);
          }
        }
        tree.addChild(arg2Tree);
       
    View Full Code Here

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

    //    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);
        }

        features.add(new Feature("TK_PET", tree.toString()));
        return features;
      }
    View Full Code Here

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

          if(node.getHead() == null){
            // do absolutely nothing with this -- it covers the whole sentence and has no useful info
            continue;
          }
         
          SimpleTree curTree = null;
          SimpleTree headTree = null;
          if(!node2tree.containsKey(node)){
            curTree = new SimpleTree(node.getCoveredText().toLowerCase());
            node2tree.put(node, curTree);
          }else{
            curTree = node2tree.get(node);
          }
         
         
             
          if(curTree.parent == null && node.getHead().getHead() != null){
            if(node2tree.containsKey(node.getHead())){
              headTree = node2tree.get(node.getHead());
            }else{
              headTree = new SimpleTree(node.getHead().getCoveredText().toLowerCase());
              node2tree.put(node.getHead(), headTree);
            }

            curTree.parent = headTree;
            headTree.addChild(curTree);
          }
        }

        List<ConllDependencyNode> coveredNodes = JCasUtil.selectCovered(jCas, ConllDependencyNode.class, annotation);
        if(coveredNodes == null || coveredNodes.size() == 0) return null;
        ConllDependencyNode headNode = DependencyUtility.getNominalHeadNode(coveredNodes);
        SimpleTree localTree = node2tree.get(headNode.getHead().getHead() == null ? headNode : headNode.getHead());
        String realCat = node2tree.get(headNode).cat;
        // have to do this so that we have a placeholder so we can lowercase tokens, then insert the upper-case CONCEPT signifier token later.
        node2tree.get(headNode).cat = "CONCEPT";
        if(annotation instanceof IdentifiedAnnotation){
          node2tree.get(headNode).cat += ((IdentifiedAnnotation)annotation).getTypeID();
        }

    //    String treeStr = localTree.toString();
    //    treeStr = "(TOP " + treeStr.replaceAll("\\(([^\\(]+) \\)", "($1 nil)").toLowerCase().replace("conceptplaceholder", "CONCEPT") + ")";
    //    treeStr = "(TOP " + treeStr.toLowerCase().replace("conceptplaceholder", "CONCEPT") + ")";
    //    node2tree.get(headNode).cat = realCat;
    //    return localTree;
        SimpleTree returnTree = null;
       
        int steps = 0;
        ConllDependencyNode returnNode = headNode;
        while(steps < upNodes && returnNode.getHead().getHead() != null){
          returnNode = returnNode.getHead();
    View Full Code Here

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

          if(node.getHead() == null){
            // do absolutely nothing with this -- it covers the whole sentence and has no useful info
            continue;
          }
         
          SimpleTree curTree = null;
          SimpleTree headTree = null;
          if(!node2tree.containsKey(node)){
            curTree = SimpleTree.fromString(String.format("(%s %s)", node.getDeprel(), node.getCoveredText()));
            node2tree.put(node, curTree);
          }else{
            curTree = node2tree.get(node);
          }


          if(curTree.parent == null && node.getHead().getHead() != null){
            if(node2tree.containsKey(node.getHead())){
              headTree = node2tree.get(node.getHead());
            }else{
              headTree = SimpleTree.fromString(String.format("(%s %s)", node.getHead().getDeprel(), node.getHead().getCoveredText()));
              node2tree.put(node.getHead(), headTree);
            }

            curTree.parent = headTree.children.get(0);
            headTree.children.get(0).addChild(curTree);
          }
        }
       
        ConllDependencyNode highestHead = null;
        // take the set of input annotations and the corresponding labels and insert them into the SimpleTree
        for(int i = 0; i < annotations.length; i++){
          // get the node representing the head of this annotation
          List<ConllDependencyNode> coveredNodes = JCasUtil.selectCovered(jCas, ConllDependencyNode.class, annotations[i]);
          if(coveredNodes == null || coveredNodes.size() == 0) continue;
          ConllDependencyNode headNode = DependencyUtility.getNominalHeadNode(coveredNodes);
         
          // is this the highest node of all the annotations we're looking at?
          if(highestHead == null || (distanceFromRoot(headNode) < distanceFromRoot(highestHead))){
            highestHead = headNode;
          }
         
    //      String realCat = node2tree.get(headNode).children.get(0).cat;
          //  have to do this so that we have a placeholder so we can lowercase tokens, then insert the upper-case CONCEPT signifier token later.
    //      node2tree.get(headNode).children.get(0).cat = "conceptplaceholder";
          SimpleTree insertionPoint = node2tree.get(headNode);
          SimpleTree insertingTree = new SimpleTree(insertionPoint.cat);
          insertionPoint.cat = labels[i];
          insertingTree.children = insertionPoint.children;
          insertingTree.children.get(0).parent = insertingTree;
          insertionPoint.children = new ArrayList<SimpleTree>();
          insertionPoint.addChild(insertingTree);
          insertingTree.parent = insertionPoint;

    //      node2tree.get(headNode).children.get(0).cat = realCat;
        }
        SimpleTree localTree = node2tree.get(highestHead.getHead().getHead() == null ? highestHead : highestHead.getHead());
        String treeStr = localTree.toString();
        treeStr = treeStr.replaceAll("\\(([^\\(]+) \\)", "($1 nil)").toLowerCase();
       
        return treeStr;

      }
    View Full Code Here

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

    public class AssertionTreeUtils {

      public static final SimpleTree NULL_TREE = SimpleTree.fromString("(S (TOK nullparse))");
     
      public static SimpleTree extractFeatureTree(JCas jcas, Annotation mention, SemanticClasses sems){
        SimpleTree tree = null;
        TopTreebankNode annotationTree = AnnotationTreeUtils.getAnnotationTree(jcas, mention);
        if(annotationTree != null){
          TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, annotationTree);
          AnnotationTreeUtils.insertAnnotationNode(jcas, root, mention, "CONCEPT");
          tree = TreeExtractor.getSimpleClone(root);
    View Full Code Here

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

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

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

          }
        }
      }

      public static SimpleTree extractAboveRightConceptTree(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");
          //            SimpleTree tree = null;
    View Full Code Here

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

    //        TopTreebankNode orig = AnnotationTreeUtils.getAnnotationTree(jcas, mention);
    //        if(orig == null){
    //          log.warn("Tree for entity mention: " + mention.getCoveredText() + " (" + mention.getBegin() + "-" + mention.getEnd() + ") is null.");
    //          continue;
    //        }
            SimpleTree tree = null; // extractFeatureTree(jcas, mention, sems);
    //        SimpleTree tree = extractAboveLeftConceptTree(jcas, mention, null);
    //              SimpleTree tree = AssertionTreeUtils.extractAboveRightConceptTree(jcas, mention, sems);
            String label = null;
           
            if(options.attributeType == ATTRIBUTE.NEG){
              if(mention.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT) label = "+1";
              else label = "-1";
              tree = getNegationTree(jcas, mention);
            }else if(options.attributeType == ATTRIBUTE.UNC){
              if(mention.getUncertainty() == CONST.NE_UNCERTAINTY_PRESENT) label = "+1";
              else label = "-1";
              tree = getUncertaintyTree(jcas, mention);
            }else{
              throw new IllegalArgumentException("Do not have this attribute type!");
            }

            out.print(label);
            out.print(" |BT| ");
            out.print(tree.toString());
            out.println(" |ET|");
            out.flush();
          }
        }
      }
    View Full Code Here

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

          }
        }
      }

      private static SimpleTree getUncertaintyTree(JCas jcas, IdentifiedAnnotation mention) {
        SimpleTree tree = null;
        tree = extractAboveLeftConceptTree(jcas, mention, sems);   
        return tree;
      }
    View Full Code Here

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

        tree = extractAboveLeftConceptTree(jcas, mention, sems);   
        return tree;
      }

      private static SimpleTree getNegationTree(JCas jcas, IdentifiedAnnotation mention) {
        SimpleTree tree = null;
        tree = extractAboveLeftConceptTree(jcas, mention, sems);
        return tree;
      }
    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.