Package edu.stanford.nlp.trees

Examples of edu.stanford.nlp.trees.Tree.children()


      if(node.isPreTerminal()) {
        List<CoreLabel> lin = new ArrayList<CoreLabel>(labelStack);
        lineages.add(lin);

      } else {
        for(Tree kid : node.children()) {
          ((HasIndex) kid.label()).setIndex(nodeDepth + 1);
          treeStack.push(kid);
        }
        CoreLabel nodeLabel = new CoreLabel(node.label());
        nodeLabel.setIndex(nodeDepth);
View Full Code Here


    // TODO: this is nice for code readability, but might be expensive
    for (Transition t : transitions) {
      switch (t) {
      case LEFT:
        if (node.children().length != 2) {
          return null;
        }
        node = node.children()[0];
        break;
      case RIGHT:
View Full Code Here

      switch (t) {
      case LEFT:
        if (node.children().length != 2) {
          return null;
        }
        node = node.children()[0];
        break;
      case RIGHT:
        if (node.children().length != 2) {
          return null;
        }
View Full Code Here

          return null;
        }
        node = node.children()[0];
        break;
      case RIGHT:
        if (node.children().length != 2) {
          return null;
        }
        node = node.children()[1];
        break;
      case UNARY:
View Full Code Here

        break;
      case RIGHT:
        if (node.children().length != 2) {
          return null;
        }
        node = node.children()[1];
        break;
      case UNARY:
        if (node.children().length != 1) {
          return null;
        }
View Full Code Here

          return null;
        }
        node = node.children()[1];
        break;
      case UNARY:
        if (node.children().length != 1) {
          return null;
        }
        node = node.children()[0];
        break;
      default:
View Full Code Here

        break;
      case UNARY:
        if (node.children().length != 1) {
          return null;
        }
        node = node.children()[0];
        break;
      default:
        throw new IllegalArgumentException("Unknown transition type " + t);
      }
    }
View Full Code Here

    }
    if (state.stack.size() == 0) {
      return false;
    }
    final Tree top = state.stack.peek();
    if (top.children().length == 1 && !top.isPreTerminal()) {
      // Disallow unary transitions after we've already had a unary transition
      return false;
    }
    if (top.label().value().equals(labels[0])) {
      // Disallow unary transitions where the final label doesn't change
View Full Code Here

      if(t.numChildren() == 1) {
        final Tree fc = t.firstChild();

        //A over A nodes i.e. from BobChrisTreeNormalizer
        if(t.label() != null && fc.label() != null && t.value().equals(fc.value())) {
          t.setChildren(fc.children());
        }
      }

      for(Tree kid : t.getChildrenAsList())
        arabicAoverAFilter(kid);
View Full Code Here

    for(Tree t : tb) {
      TregexMatcher m = rootMatch.matcher(t);
      while(m.findNextMatchingNode()) {
        Tree match = m.getMatch();
        StringBuilder sb = new StringBuilder();
        for(Tree kid : match.children())
          sb.append(kid.value()).append(" ");
        rhsCounter.incrementCount(sb.toString().trim());
      }
    }
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.