Value<PosTag> pos = token.getAnnotation(NlpAnnotations.POS_ANNOTATION);
Span chunk = chunks.next(); Value<NerTag> ner = chunk.getAnnotation(NlpAnnotations.NER_ANNOTATION); if (ner != null) { sectionNers.add(chunk); Value<PhraseTag> phrase = chunk.getAnnotation(NlpAnnotations.PHRASE_ANNOTATION); if (phrase != null && phrase.value().getCategory() == LexicalCategory.Noun) { sectionNounPhrases.add(new NounPhrase(chunk, sentenceCnt));
Token word = (Token)span; Integer wordIndex = sentimentTokens.size(); Value<Double> sentimentAnnotation = span.getAnnotation(SENTIMENT_ANNOTATION); boolean addToList = false; Sentiment sentiment = null;
IRI nerType = ner.getAnnotation(NlpAnnotations.NER_ANNOTATION).value().getType(); IRI npNerType = npNer.getAnnotation(NlpAnnotations.NER_ANNOTATION).value().getType(); Set<String> rulesOntologyAttr = new HashSet<String>(); .getAnnotation(NlpAnnotations.NER_ANNOTATION).value().getType());
Value<Double> sentiment = span.getAnnotation(NlpAnnotations.SENTIMENT_ANNOTATION); if(sentiment != null && sentiment.value() != null){ metadata.add(new TripleImpl(current, SENTIMENT_PROPERTY,
/** * Gets an Entity from the configured {@link Site} based on the NER text and type. * * @param ner * @param language * @return * @throws EngineException */ private Entity lookupEntity(Span ner, String language) throws EngineException { Site site = getReferencedSite(); FieldQueryFactory queryFactory = site == null ? entityHub.getQueryFactory() : site.getQueryFactory(); FieldQuery query = queryFactory.createFieldQuery(); Constraint labelConstraint; String namedEntityLabel = ner.getSpan(); labelConstraint = new TextConstraint(namedEntityLabel, false, language, null); query.setConstraint(RDFS_LABEL.getUnicodeString(), labelConstraint); query.setConstraint(RDF_TYPE.getUnicodeString(), new ReferenceConstraint(ner.getAnnotation(NlpAnnotations.NER_ANNOTATION).value().getType() .getUnicodeString())); query.setLimit(1); QueryResultList<Entity> results = site == null ? // if site is NULL entityHub.findEntities(query) : // use the Entityhub site.findEntities(query); // else the referenced site if (results.isEmpty()) return null; // We set the limit to 1 so if it found anything it should contain just 1 entry return results.iterator().next(); }
Value<Double> sentiment = span.getAnnotation(NlpAnnotations.SENTIMENT_ANNOTATION); if(sentiment != null && sentiment.value() != null){ metadata.add(new TripleImpl(current, SENTIMENT_PROPERTY,
Value<NerTag> nerAnno = span.getAnnotation(NER_ANNOTATION); if(nerAnno != null){ IRI ta = EnhancementEngineHelper.createTextEnhancement(ci, this); Value<Double> sentimentAnnotation = span.getAnnotation(SENTIMENT_ANNOTATION); if (sentimentAnnotation != null) { //this span has a sentiment assigned