Example usage for edu.stanford.nlp.trees Tree siblings

List of usage examples for edu.stanford.nlp.trees Tree siblings

Introduction

In this page you can find the example usage for edu.stanford.nlp.trees Tree siblings.

Prototype

public List<Tree> siblings(Tree root) 

Source Link

Document

Returns the siblings of this Tree node.

Usage

From source file:Anaphora_Resolution.ParseAllXMLDocuments.java

private static boolean adverbialEmphasis(Tree candidate, Tree root) { // Like in "Inside the castle, King Arthur was invincible". "Castle" has the adv emph.
    Tree parent = candidate;
    while (!parent.label().value().equals("S")) {
        if (parent.label().value().equals("PP")) {
            for (Tree sibling : parent.siblings(root)) {
                if ((sibling.label().value().equals(","))) {
                    //System.out.println("adv Emph!");
                    return true;
                }/*from   ww w . j  a  v a2  s  . c  om*/
            }
        }
        parent = parent.parent(root);
    }
    return false;
}

From source file:tml.utils.StanfordUtils.java

License:Apache License

public static String getPennTagFirstBranch(Tree orig, Tree t, Tree pt) {
    if (t.isLeaf())
        return "NOBRANCH";

    List<Tree> trees = t.siblings(orig);
    if (trees != null && trees.size() > 0 && pt != null)
        return pt.value();

    return getPennTagFirstBranch(orig, t.getChild(0), t);
}