/** build a list of all entity mentions in the document from the sentences **/ private void buildDocumentEntityMentionsList() { entityMentions = sentences.stream().flatMap(sentence -> sentence.entityMentions().stream()). collect(Collectors.toList()); }
/** complete the wrapping process post annotation by a pipeline **/ public void wrapAnnotations() { // wrap all of the sentences if (this.annotationDocument.get(CoreAnnotations.SentencesAnnotation.class) != null) { wrapSentences(); // if there are entity mentions, build a document wide list if ( ! sentences.isEmpty() && sentences.get(0).entityMentions() != null) { buildDocumentEntityMentionsList(); } // if there are quotes, build a document wide list if (QuoteAnnotator.gatherQuotes(this.annotationDocument) != null) buildDocumentQuotesList(); } }
List<CoreEntityMention> entityMentions = sentence.entityMentions(); System.out.println("Example: entity mentions"); System.out.println(entityMentions); CoreEntityMention originalEntityMention = document.sentences().get(3).entityMentions().get(1); System.out.println("Example: original entity mention"); System.out.println(originalEntityMention);
/** build a list of all entity mentions in the document from the sentences **/ private void buildDocumentEntityMentionsList() { entityMentions = sentences.stream().flatMap(sentence -> sentence.entityMentions().stream()). collect(Collectors.toList()); }
/** complete the wrapping process post annotation by a pipeline **/ public void wrapAnnotations() { // wrap all of the sentences if (this.annotationDocument.get(CoreAnnotations.SentencesAnnotation.class) != null) { wrapSentences(); // if there are entity mentions, build a document wide list if ( ! sentences.isEmpty() && sentences.get(0).entityMentions() != null) { buildDocumentEntityMentionsList(); } // if there are quotes, build a document wide list if (QuoteAnnotator.gatherQuotes(this.annotationDocument) != null) buildDocumentQuotesList(); } }