List of usage examples for edu.stanford.nlp.ling IndexedWord endPosition
@Override
public int endPosition()
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*/ }