Example usage for edu.stanford.nlp.trees UniversalEnglishGrammaticalRelations NUMERIC_MODIFIER

List of usage examples for edu.stanford.nlp.trees UniversalEnglishGrammaticalRelations NUMERIC_MODIFIER

Introduction

In this page you can find the example usage for edu.stanford.nlp.trees UniversalEnglishGrammaticalRelations NUMERIC_MODIFIER.

Prototype

GrammaticalRelation NUMERIC_MODIFIER

To view the source code for edu.stanford.nlp.trees UniversalEnglishGrammaticalRelations NUMERIC_MODIFIER.

Click Source Link

Document

The "numeric modifier" grammatical relation.

Usage

From source file:edu.anu.spice.SpiceParser.java

License:Open Source License

/**
 * Checks if a word has a numerical modifier, and if so adds it as an object
 * with attribute/*from w w  w.  j a  v a 2s . c  om*/
 */
protected void checkForNumericAttribute(ProposedTuples tuples, SemanticGraph sg, IndexedWord word) {
    if (sg.hasChildWithReln(word, UniversalEnglishGrammaticalRelations.NUMERIC_MODIFIER)) {
        IndexedWord nummod = sg.getChildWithReln(word, UniversalEnglishGrammaticalRelations.NUMERIC_MODIFIER);
        /* Prevent things like "number 5" */
        if (nummod.index() < word.index()) {
            tuples.addTuple(word, nummod);
        }
    } else if (sg.hasChildWithReln(word, SemanticGraphEnhancer.QMOD_RELATION)) {
        IndexedWord qmod = sg.getChildWithReln(word, SemanticGraphEnhancer.QMOD_RELATION);
        tuples.addTuple(word, qmod);
    }
}