Example usage for edu.stanford.nlp.ling IndexedWord endPosition

List of usage examples for edu.stanford.nlp.ling IndexedWord endPosition

Introduction

In this page you can find the example usage for edu.stanford.nlp.ling IndexedWord endPosition.

Prototype

@Override
    public int endPosition() 

Source Link

Usage

From source file:eu.ubipol.opinionmining.nlp_engine.Sentence.java

License:Open Source License

protected Sentence(SemanticGraph dependencies, int indexStart, DatabaseAdapter adp, int beginPosition) {
    IndexedWord rootWord = dependencies.getFirstRoot();
    sentenceRoot = new Token(rootWord.originalText(), rootWord.lemma(), rootWord.tag(), null, null,
            rootWord.index() + indexStart, rootWord.beginPosition(), rootWord.endPosition(), adp,
            beginPosition);//from   www  .ja va 2 s.  c  om
    addChildTokens(sentenceRoot, rootWord, dependencies, indexStart, adp, beginPosition);
    sentenceRoot.transferScores();
    if (sentenceRoot.isAKeyword())
        sentenceRoot.addAspectScore(sentenceRoot.getScore(), sentenceRoot.getWeight(),
                sentenceRoot.getAspect());
    indexStart += dependencies.size();
}

From source file:eu.ubipol.opinionmining.nlp_engine.Sentence.java

License:Open Source License

private void addChildTokens(Token rootToken, IndexedWord currentRoot, SemanticGraph dependencies,
        int indexStart, DatabaseAdapter adp, int beginPosition) {
    for (IndexedWord child : dependencies.getChildren(currentRoot)) {
        Token childToken = new Token(child.originalText(), child.lemma(), child.tag(), rootToken,
                dependencies.getEdge(currentRoot, child).toString(), child.index() + indexStart,
                child.beginPosition(), child.endPosition(), adp, beginPosition);
        rootToken.addChildToken(childToken);
        addChildTokens(childToken, child, dependencies, indexStart, adp, beginPosition);
    }/*w  w w  .java  2  s.c o m*/
}