private boolean isVerb(Token token, String language) { Value<PosTag> posAnnotation = token.getAnnotation(NlpAnnotations.POS_ANNOTATION); return posAnnotation == null ? false : posAnnotation.value().hasCategory(LexicalCategory.Verb); }
PosTag posTag = pos.value(); if (posTag.hasCategory(LexicalCategory.Noun) || posTag.hasCategory(LexicalCategory.Adjective)) { nounNo++;
/** * Checks if the parsed {@link Token} represents an negation * @param token the word * @param index the index of the token relative to the sentence | section * @param language the language * @return <code>true</code> if the {@link Token} represents a negation. * Otherwise <code>false</code> */ private boolean isNoun(Token token, boolean firstTokenInSentence, String language) { String word = token.getSpan(); if(!firstTokenInSentence && !word.isEmpty() && Character.isUpperCase(word.charAt(0))){ return true; //assume all upper case tokens are Nouns } Value<PosTag> posAnnotation = token.getAnnotation(NlpAnnotations.POS_ANNOTATION); if(posAnnotation != null && (posAnnotation.value().hasCategory(LexicalCategory.Noun) || posAnnotation.value().getPosHierarchy().contains(Pos.CardinalNumber))){ return true; } return false; } /**
if(pos != null && pos.getPosHierarchy().contains(Pos.PredicativeAdjective)){ isPredicative = true; } else if(pos != null && pos.hasCategory(LexicalCategory.Adjective) && Integer.valueOf(index+nounContext)}; } else if(pos != null && pos.hasCategory(LexicalCategory.Adjective)){ } else if(pos != null && pos.hasCategory(LexicalCategory.Noun)){
posTag = tags.get(0).value(); if(posTag.hasCategory(LexicalCategory.Noun)){ if(posTag.hasCategory(LexicalCategory.Verb)){ setVerb(token);