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

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

Introduction

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

Prototype

public Set<Constituent> constituents() 

Source Link

Document

Returns the Constituents generated by the parse tree.

Usage

From source file:ims.cs.lingdata.Token.java

License:Open Source License

/**
 * Determines whether a constituent starts at this token
 * @return/*from ww w.j  av  a 2  s . c  om*/
 */
public boolean hasStartingConstituents() {
    Tree tree = sentence.tree;
    Set<Constituent> constituents = tree.constituents();

    for (Constituent c : constituents) {
        if (c.end() - c.start() > 1 && c.start() == predSentencePosition)
            return true;
    }

    return false;
}

From source file:ims.cs.lingdata.Token.java

License:Open Source License

/**
 * Determines whether a constituent ends at this token
 * @return//from   www  .j a  v a  2 s.c  o m
 */
public boolean hasEndingConstituents() {
    Tree tree = sentence.tree;
    Set<Constituent> constituents = tree.constituents();

    for (Constituent c : constituents) {
        if (c.end() - c.start() > 1 && c.end() == predSentencePosition)
            return true;
    }

    return false;
}