Package edu.stanford.nlp.trees

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


      while (true) {
        if (node.children().length == 0) {
          return null;
        }
        Tree child = node.children()[0];
        if (!(child.label() instanceof CoreLabel)) {
          throw new IllegalArgumentException("Can only featurize CoreLabel trees");
        }
        if (((CoreLabel) child.label()).get(TreeCoreAnnotations.HeadWordAnnotation.class) != head) {
          return (CoreLabel) child.label();
        }
View Full Code Here


        }
        Tree child = node.children()[0];
        if (!(child.label() instanceof CoreLabel)) {
          throw new IllegalArgumentException("Can only featurize CoreLabel trees");
        }
        if (((CoreLabel) child.label()).get(TreeCoreAnnotations.HeadWordAnnotation.class) != head) {
          return (CoreLabel) child.label();
        }
        node = child;
      }
    }
View Full Code Here

        Tree child = node.children()[0];
        if (!(child.label() instanceof CoreLabel)) {
          throw new IllegalArgumentException("Can only featurize CoreLabel trees");
        }
        if (((CoreLabel) child.label()).get(TreeCoreAnnotations.HeadWordAnnotation.class) != head) {
          return (CoreLabel) child.label();
        }
        node = child;
      }
    }
    case RIGHT: {
View Full Code Here

        if (node.children().length == 1) {
          node = node.children()[0];
          continue;
        }
        Tree child = node.children()[1];
        if (!(child.label() instanceof CoreLabel)) {
          throw new IllegalArgumentException("Can only featurize CoreLabel trees");
        }
        if (((CoreLabel) child.label()).get(TreeCoreAnnotations.HeadWordAnnotation.class) != head) {
          return (CoreLabel) child.label();
        }
View Full Code Here

        }
        Tree child = node.children()[1];
        if (!(child.label() instanceof CoreLabel)) {
          throw new IllegalArgumentException("Can only featurize CoreLabel trees");
        }
        if (((CoreLabel) child.label()).get(TreeCoreAnnotations.HeadWordAnnotation.class) != head) {
          return (CoreLabel) child.label();
        }
        node = child;
      }
    }
View Full Code Here

        Tree child = node.children()[1];
        if (!(child.label() instanceof CoreLabel)) {
          throw new IllegalArgumentException("Can only featurize CoreLabel trees");
        }
        if (((CoreLabel) child.label()).get(TreeCoreAnnotations.HeadWordAnnotation.class) != head) {
          return (CoreLabel) child.label();
        }
        node = child;
      }
    }
    default:
View Full Code Here

      default:
        throw new IllegalArgumentException("Unknown transition type " + t);
      }
    }

    if (!(node.label() instanceof CoreLabel)) {
      throw new IllegalArgumentException("Can only featurize CoreLabel trees");
    }
    return (CoreLabel) node.label();
  }
View Full Code Here

    }

    if (!(node.label() instanceof CoreLabel)) {
      throw new IllegalArgumentException("Can only featurize CoreLabel trees");
    }
    return (CoreLabel) node.label();
  }

  public static CoreLabel getQueueLabel(State state, int offset) {
    return getQueueLabel(state.sentence, state.tokenPosition, offset);
  }
View Full Code Here

    if (tokenPosition + offset < 0 || tokenPosition + offset >= sentence.size()) {
      return null;
    }

    Tree node = sentence.get(tokenPosition + offset);
    if (!(node.label() instanceof CoreLabel)) {
      throw new IllegalArgumentException("Can only featurize CoreLabel trees");
    }
    return (CoreLabel) node.label();
  }
View Full Code Here

    Tree node = sentence.get(tokenPosition + offset);
    if (!(node.label() instanceof CoreLabel)) {
      throw new IllegalArgumentException("Can only featurize CoreLabel trees");
    }
    return (CoreLabel) node.label();
  }

  public static CoreLabel getCoreLabel(Tree node) {
    if (!(node.label() instanceof CoreLabel)) {
      throw new IllegalArgumentException("Can only featurize CoreLabel trees");
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.