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

        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_PET", 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);

    //    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.setGeneralizeLeaf(true);
        moveTimexDownToNP(tree);
        simplifyGCG(tree);
       
        features.add(new TreeFeature("TK_PET", tree.toString()));
        return features;
      }
    View Full Code Here

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

        }
      }

      public static void moveTimexDownToNP(SimpleTree tree) {
        if(tree.cat.contains("-TIMEX-")){
          SimpleTree child = tree.children.get(0);
          // we've found the correct node: only correct clear violations: PP -> IN NP
          if(child.cat.contains("PP") && child.children.size() == 2 && child.children.get(0).cat.equals("IN") && child.children.get(1).cat.startsWith("NP")){
            // swap labels
            String fullCat = tree.cat;
            tree.cat = "PP";
    View Full Code Here

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

        String dtreeStr ="(TOP (EVENT " + focusAnnotation.getCoveredText().trim() + "))";
        //find the colldepnode covered by focusAnnotation:
        for(ConllDependencyNode node : JCasUtil.selectCovered(view, ConllDependencyNode.class, focusAnnotation)){
          //find if it has head:
          ConllDependencyNode head = node.getHead();
          SimpleTree curTree = null;
          SimpleTree headTree = null;
         
          if(head == null) { //if the current node is the root, then not right
            continue;
          }

    //      curTree = SimpleTree.fromString(String.format("(%s %s)", node.getDeprel(), SimpleTree.escapeCat(node.getCoveredText().trim())));
          curTree = SimpleTree.fromString(String.format("(%s %s)", node.getDeprel(), node.getPostag()));



          while(head.getHead() != null){ //while head node is not the root
    //              String token = node.getHead().getHead() == null ? "TOP" : node.getHead().getCoveredText();
    //        headTree = SimpleTree.fromString(String.format("(%s %s)", head.getDeprel(), SimpleTree.escapeCat(head.getCoveredText().trim())));
            headTree = SimpleTree.fromString(String.format("(%s %s)", head.getDeprel(), head.getPostag()));
            curTree.parent = headTree.children.get(0);
            headTree.children.get(0).addChild(curTree);
            curTree = headTree;
            head = head.getHead();
          }
          if(headTree==null){
            curTree = SimpleTree.fromString(String.format("(%s (%s %s))",node.getDeprel(), node.getPostag(),"null"));
            dtreeStr = curTree.toString();
          }else{
            dtreeStr = headTree.toString();
          }
          break;
        }
       
        features.add(new TreeFeature(FEAT_NAME, dtreeStr));
    View Full Code Here

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

          IdentifiedAnnotation temp = arg1;
          arg1 = arg2;
          arg2 = temp;
        }
       
        SimpleTree bopTree = getTree(jcas, arg1, arg2, "BOP", new Function<BaseToken,String>(){public String apply(BaseToken t){ return t.getPartOfSpeech();}});
        SimpleTree bowTree = getTree(jcas, arg1, arg2, "BOW", new Function<BaseToken,String>(){public String apply(BaseToken t){ return t.getCoveredText();}});
       
        feats.add(new TreeFeature("TK_BOP_Tree", bopTree.toString()));
        feats.add(new TreeFeature("TK_BOW_Tree", bowTree.toString()));
        return feats;
      }
    View Full Code Here

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

        feats.add(new TreeFeature("TK_BOW_Tree", bowTree.toString()));
        return feats;
      }

      private static SimpleTree getTree(JCas jcas, IdentifiedAnnotation arg1, IdentifiedAnnotation arg2, String label, Function<BaseToken, String> leafFun) throws AnalysisEngineProcessException{
        SimpleTree tree = new SimpleTree(label);
        SimpleTree arg1Tree = null;
        SimpleTree arg2Tree = null;
        String eventModality="";
        String timeClass="";
     
        // make sure we have the right classes
        if(arg1 instanceof EventMention){
          EventMention mention = (EventMention) arg1;
          if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
            eventModality = mention.getEvent().getProperties().getContextualModality();
          }
          arg1Tree = new SimpleTree("EVENT-"+eventModality);
        }else if(arg1 instanceof TimeMention){
          timeClass = ((TimeMention)arg1).getTimeClass();
          arg1Tree = new SimpleTree("TIMEX-"+timeClass);
        }else{
          throw new AnalysisEngineProcessException("Argument type not recognized (arg1) -- must be EventMention or TimeMention", null);
        }
       
        if(arg2 instanceof EventMention){
          EventMention mention = (EventMention) arg2;
          if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
            eventModality = mention.getEvent().getProperties().getContextualModality();
          }
          arg2Tree = new SimpleTree("EVENT-"+eventModality);     
        }else if(arg2 instanceof TimeMention){
          timeClass = ((TimeMention)arg2).getTimeClass();
          arg2Tree = new SimpleTree("TIMEX-"+timeClass);     
        }else{
          throw new AnalysisEngineProcessException("Argument type not recognized (arg2) -- must be EventMention or TimeMention", null);
        }
       
        List<BaseToken> tokens = JCasUtil.selectCovered(jcas, BaseToken.class, arg1.getBegin(), arg2.getEnd());
        tree.addChild(arg1Tree);
        for(BaseToken token : tokens){
          SimpleTree tokenTree = new SimpleTree("TOK");
          tokenTree.addChild(new SimpleTree(leafFun.apply(token)));
         
          if(token.getEnd() <= arg1.getEnd()){
            arg1Tree.addChild(tokenTree);
          }else if(token.getBegin() >= arg2.getBegin()){
            arg2Tree.addChild(tokenTree);
    View Full Code Here

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

      }

      @Override
      public List<Feature> extract(JCas jcas, Annotation annotation) {
        List<Feature> features = new ArrayList<Feature>();
        SimpleTree tree = extractAboveRightConceptTree(jcas, annotation, sems);
       
        for(SimpleTree frag : frags){
          if(TreeUtils.containsIgnoreCase(tree, frag)){
            features.add(new Feature("TreeFrag_" + prefix, frag.toString()));
          }
    View Full Code Here

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

      }

      @Override
      public List<Feature> extract(JCas jcas, Annotation annotation) {
        List<Feature> features = new ArrayList<Feature>();
        SimpleTree tree = extractAboveLeftConceptTree(jcas, annotation, sems);
       
        for(SimpleTree frag : frags){
          if(TreeUtils.containsIgnoreCase(tree, frag)){
            features.add(new Feature("TreeFrag_" + prefix, frag.toString()));
          }
    View Full Code Here

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

     
      @Override
      public List<Feature> extract(JCas jcas, Annotation annotation)
          throws CleartkExtractorException {
        List<Feature> features = new ArrayList<Feature>();
        SimpleTree tree = extractAboveLeftConceptTree(jcas, annotation, sems);
        features.add(new TreeFeature("TK_AboveLeftTree", tree.toString()));
        return features;
      }
    View Full Code Here

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

          Sentence sent = sents.get(0);
          List<ConllDependencyNode> nodes = JCasUtil.selectCovered(ConllDependencyNode.class, sent);
       
          //treeString = AnnotationDepUtils.getTokenRelTreeString(jCas, nodes, new Annotation[]{arg1}, new String[]{"CONCEPT"}, true);
    //      treeString = AssertionDepUtils.getTokenRelTreeString(jCas, nodes, arg1, "CONCEPT");
          SimpleTree tree = AssertionDepUtils.getTokenTreeString(jCas, nodes, arg1, GenerateDependencyRepresentation.UP_NODES);
         
          if(tree == null){
            treeString = "(S (no parse))";
          }else{
            AssertionTreeUtils.replaceDependencyWordsWithSemanticClasses(tree, sems);
            treeString = tree.toString();
    //        treeString = treeString.replaceAll("\\(([^ ]+) \\)", "$1");
          }
        }

        f1 = new TreeFeature("TK_DW", treeString);  
    View Full Code Here

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

        if(sents != null && sents.size() > 0){

          Sentence sent = sents.get(0);
          List<ConllDependencyNode> nodes = JCasUtil.selectCovered(ConllDependencyNode.class, sent);

          SimpleTree tree = AssertionDepUtils.getTokenTreeString(jCas, nodes, mention, GenerateDependencyRepresentation.UP_NODES);
          if(tree == null){
            System.err.println("Tree is null!");
          }else{
            AssertionTreeUtils.replaceDependencyWordsWithSemanticClasses(tree, sems);
            for(SimpleTree frag : frags){
    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.