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

            }
          } catch (Exception e) { e.printStackTrace(); }
        }
       
        if(frags != null && frags.size() > 0){
          SimpleTree tn = TreeExtractor.extractPathTree(MarkableTreeUtils.markableNode(aJCas, antecedent.getBegin(), antecedent.getEnd()),
              MarkableTreeUtils.markableNode(aJCas, anaphor.getBegin(), anaphor.getEnd()));
    //      SimpleTree tn = TreeExtractor.extractPathEnclosedTree(MarkableTreeUtils.markableNode(aJCas, antecedent.getBegin(), antecedent.getEnd()),
    //          MarkableTreeUtils.markableNode(aJCas, anaphor.getBegin(), anaphor.getEnd()),
    //          aJCas);
          // now go over the tree fragment features:
    View Full Code Here

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

    //        continue;
    //      }else if(node.getHead().getHead() == null){
    //        topNode = node;
          }
              
          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() != null){
            if(node2tree.containsKey(node.getHead())){
              headTree = node2tree.get(node.getHead());
            }else{
              String token = node.getHead().getHead() == null ? "TOP" : node.getHead().getCoveredText();
              headTree = SimpleTree.fromString(String.format("(%s %s)", node.getHead().getDeprel(), SimpleTree.escapeCat(token)));
              node2tree.put(node.getHead(), headTree);
            }

            curTree.parent = headTree.children.get(0);
            headTree.children.get(0).addChild(curTree);
          }
        }
       
        ConllDependencyNode highestHead = null;
        ConllDependencyNode leftmostHead = null;
        ConllDependencyNode rightmostHead = null;
        List<SimpleTree> annotationNodes = Lists.newArrayList();
       
        // 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;
          }
          if(leftmostHead == null || headNode.getBegin() < leftmostHead.getBegin()){
            leftmostHead = headNode;
          }
          if(rightmostHead == null || headNode.getEnd() > rightmostHead.getEnd()){
            rightmostHead = headNode;
          }
         
          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;
          annotationNodes.add(insertionPoint);
        }
        if(highestHead == null) return null;
       
        SimpleTree root = node2tree.get(topNode);
        SimpleTree leftmostNode = getLeftmostNode(root, Sets.newHashSet(labels));
        SimpleTree rightmostNode = getRightmostNode(root, Sets.newHashSet(labels));
        SimpleTree pet = getPathEnclosedTree(root, annotationNodes, leftmostNode, rightmostNode);
        if(getParent && pet.parent != null) pet = pet.parent;
       
        String treeStr = pet.toString();
        treeStr = treeStr.replaceAll("\\(([^\\(]+) \\)", "($1 nil)").toLowerCase();
       
        return treeStr;
      }
    View Full Code Here

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

       
        return treeStr;
      }
     
      private static SimpleTree getRightmostNode(SimpleTree root, Set<String> labels) {
        SimpleTree node = null;
       
        for(int i = root.children.size()-1; i >= 0; i--){
          if(labels.contains(root.children.get(i).cat)){
            node = root.children.get(i);
            break;
    View Full Code Here

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

       
        return node;
      }

      private static SimpleTree getLeftmostNode(SimpleTree root, Set<String> labels) {
        SimpleTree node = null;
       
        for(int i = 0; i < root.children.size(); i++){
          if(labels.contains(root.children.get(i).cat)){
            node = root.children.get(i);
            break;
    View Full Code Here

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

          }
          if(rightmostHead == null || headNode.getEnd() > rightmostHead.getEnd()){
            rightmostHead = headNode;
          }
         
          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;
          annotationNodes.add(insertionPoint);
        }
        if(highestHead == null) return null;
       
        SimpleTree root = node2tree.get(topNode);
        SimpleTree leftmostNode = getLeftmostNode(root, Sets.newHashSet(labels));
        SimpleTree rightmostNode = getRightmostNode(root, Sets.newHashSet(labels));
        SimpleTree pet = getPathEnclosedTree(root, annotationNodes, leftmostNode, rightmostNode);
        if(getParent && pet.parent != null) pet = pet.parent;
       
        String treeStr = pet.toString();
        treeStr = treeStr.replaceAll("\\(([^\\(]+) \\)", "($1 nil)").toLowerCase();
       
        return treeStr;

      }
    View Full Code Here

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

        return treeStr;

      }
     
      public static SimpleTree getPathEnclosedTree(SimpleTree root, List<SimpleTree> annotationNodes, SimpleTree leftmostTree, SimpleTree rightmostTree){
        SimpleTree pet = null;
        // for the general case (>= 1 annotations) we need to first find the common set of ancestors
        Set<SimpleTree> commonAncestors = getAncestors(annotationNodes.get(0));
        for(int i = 1; i < annotationNodes.size(); i++){
          Set<SimpleTree> nodeAncestors = getAncestors(annotationNodes.get(i));
          commonAncestors = Sets.intersection(commonAncestors, nodeAncestors);
        }
        // of the common set, which is the lowest?
        SimpleTree lowestAncestor = null;
        for(SimpleTree ancestor : commonAncestors){
          if(lowestAncestor == null || distanceFromRoot(ancestor) > distanceFromRoot(lowestAncestor)){
            lowestAncestor = ancestor;
          }
        }
        // of the children of the lowest ancestors, which do not contain any of the annotations we are
        // interested in?
        root = lowestAncestor;
        SimpleTree curNode = leftmostTree;
        SimpleTree lastNode = null;
        while(curNode != root){
          lastNode = curNode;
          if(curNode == null || curNode.parent == null){
            logger.error("Something weird.");
          }
    View Full Code Here

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

    //        continue;
    //      }else if(node.getHead().getHead() == null){
    //        topNode = node;
          }
              
          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);
    View Full Code Here

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

        List<Feature> features = new ArrayList<Feature>();
        // first get the root and print it out...
        TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(view, AnnotationTreeUtils.getAnnotationTree(view, focusAnnotation));

        if(root == null){
          SimpleTree fakeTree = new SimpleTree("(S (NN null))");
          features.add(new TreeFeature(FEAT_NAME, fakeTree.toString()));
          return features;
        }


        String etype="";
        String eventModality="";

        if(focusAnnotation instanceof EventMention){
          eventModality = ((EventMention)focusAnnotation).getEvent().getProperties().getContextualModality();
          etype = "EVENT-"+eventModality;
          AnnotationTreeUtils.insertAnnotationNode(view, root, focusAnnotation, etype);
        }
     
        SimpleTree tree = null;
        tree = TreeExtractor.getSimpleClone(root);

        TemporalPETExtractor.moveTimexDownToNP(tree);

        features.add(new TreeFeature(FEAT_NAME, tree.toString()));
        return features;
      }
    View Full Code Here

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

          IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
        List<Feature> features = new ArrayList<Feature>();
        // first get the root and print it out...
        TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, AnnotationTreeUtils.getAnnotationTree(jcas, arg1));
        if(root == null){
          SimpleTree fakeTree = new SimpleTree("(S (NN null))");
          features.add(new TreeFeature("TK_PATH", fakeTree.toString()));
          return features;
        }
        // swap the order if necessary:
        if(arg2.getBegin() <= arg1.getBegin() && arg2.getEnd() <= arg1.getEnd()){
          IdentifiedAnnotation temp = arg1;
          arg1 = arg2;
          arg2 = temp;
        }
       
        String a1type="", a2type="";
        String eventModality="";
        String timeClass="";

        if(arg1 instanceof EventMention){
          EventMention mention = (EventMention) arg1;
          if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
            eventModality = mention.getEvent().getProperties().getContextualModality();
          }
          a1type = "EVENT-"+eventModality;
        }else if(arg1 instanceof TimeMention){
          timeClass = ((TimeMention)arg1).getTimeClass();
          a1type = "TIMEX-"+timeClass;
        }
       
        if(arg2 instanceof EventMention){
          EventMention mention = (EventMention) arg2;
          if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
            eventModality = mention.getEvent().getProperties().getContextualModality();
          }
          a2type = "EVENT"+eventModality;     
        }else if(arg2 instanceof TimeMention){
          timeClass = ((TimeMention)arg2).getTimeClass();
          a2type = "TIMEX-"+timeClass;     
        }
       
        TreebankNode t1 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg1, "ARG1-"+a1type);
        TreebankNode t2 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg2, "ARG2-"+a2type);

        SimpleTree tree = null;
        tree = TreeExtractor.extractPathTree(t1, t2);
        TemporalPETExtractor.simplifyGCG(tree);
        features.add(new TreeFeature("TK_PATH", tree.toString()));
        return features;
      }
    View Full Code Here

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

        List<Feature> features = new ArrayList<Feature>();
        // first get the root and print it out...
        TopTreebankNode root = AnnotationTreeUtils.getTreeCopy(jcas, AnnotationTreeUtils.getAnnotationTree(jcas, arg1));
       
        if(root == null){
          SimpleTree fakeTree = new SimpleTree("(S (NN null))");
          features.add(new TreeFeature(FEAT_NAME, fakeTree.toString()));
          return features;
        }
       
        // swap the order if necessary:
        if(arg2.getBegin() <= arg1.getBegin() && arg2.getEnd() <= arg1.getEnd()){
          IdentifiedAnnotation temp = arg1;
          arg1 = arg2;
          arg2 = temp;
        }
       
        String a1type="", a2type="";
        String eventModality="";
        String timeClass;
       
        if(arg1 instanceof EventMention){
          eventModality = ((EventMention)arg1).getEvent().getProperties().getContextualModality();
          a1type = "EVENT-"+eventModality;
        }else if(arg1 instanceof TimeMention){
          timeClass = ((TimeMention)arg1).getTimeClass();
          a1type = "TIMEX-"+timeClass;
        }
       
        if(arg2 instanceof EventMention){
          eventModality = ((EventMention)arg2).getEvent().getProperties().getContextualModality();
          a2type = "EVENT-"+eventModality;     
        }else if(arg2 instanceof TimeMention){
          timeClass = ((TimeMention)arg2).getTimeClass();
          a2type = "TIMEX-"+timeClass;     
        }
       
        TreebankNode t1 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg1, "ARG1-"+a1type);
        TreebankNode t2 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg2, "ARG2-"+a2type);

    //    addOtherTimes(jcas,root, arg1, 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);
          tree = TreeExtractor.getSimpleClone(root);
        }

        TemporalPETExtractor.moveTimexDownToNP(tree);
       
        features.add(new TreeFeature(FEAT_NAME, tree.toString()));
        return features;
      }
    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.