Skip to content

Commit

Permalink
If the entitymentions annotator ran (indicated by MentionsAnnotation …
Browse files Browse the repository at this point in the history
…being set), return an empty list of entityMentions for an empty document. Addresses #1322
  • Loading branch information
AngledLuffa committed Dec 8, 2022
1 parent 02d2957 commit da08664
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/edu/stanford/nlp/pipeline/CoreDocument.java
Expand Up @@ -33,8 +33,10 @@ public void wrapAnnotations() {
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) {
if (!sentences.isEmpty() && sentences.get(0).entityMentions() != null) {
buildDocumentEntityMentionsList();
} else if (annotationDocument.get(CoreAnnotations.MentionsAnnotation.class) != null) {
entityMentions = Collections.emptyList();
}
// if there are quotes, build a document wide list
if (QuoteAnnotator.gatherQuotes(this.annotationDocument) != null)
Expand Down

0 comments on commit da08664

Please sign in to comment.