Example usage for edu.stanford.nlp.trees EnglishGrammaticalRelations AUX_MODIFIER

List of usage examples for edu.stanford.nlp.trees EnglishGrammaticalRelations AUX_MODIFIER

Introduction

In this page you can find the example usage for edu.stanford.nlp.trees EnglishGrammaticalRelations AUX_MODIFIER.

Prototype

GrammaticalRelation AUX_MODIFIER

To view the source code for edu.stanford.nlp.trees EnglishGrammaticalRelations AUX_MODIFIER.

Click Source Link

Document

The "auxiliary" grammatical relation.

Usage

From source file:knu.univ.lingvo.coref.Mention.java

License:Open Source License

public int getModal(Dictionaries dict) {

    if (headIndexedWord == null)
        return 0;

    // direct modal in a child
    Collection<IndexedWord> children = dependency.getChildren(headIndexedWord);
    for (IndexedWord child : children) {
        if (dict.modals.contains(child.lemma()))
            return 1;
    }/*from  w w  w .  ja  v a2 s  .  com*/

    // check the parent
    IndexedWord parent = dependency.getParent(headIndexedWord);
    if (parent != null) {
        if (dict.modals.contains(parent.lemma()))
            return 1;
        // check the children of the parent (that is needed for modal auxiliaries)
        IndexedWord child = dependency.getChildWithReln(parent, EnglishGrammaticalRelations.AUX_MODIFIER);
        if (!dependency.hasParentWithReln(headIndexedWord, EnglishGrammaticalRelations.NOMINAL_SUBJECT)
                && child != null && dict.modals.contains(child.lemma()))
            return 1;
    }

    // look at the path to root
    List<IndexedWord> path = dependency.getPathToRoot(headIndexedWord);
    if (path == null)
        return 0;
    for (IndexedWord word : path) {
        if (dict.modals.contains(word.lemma()))
            return 1;
    }
    return 0;
}