Skip to content

Commit da08664

Browse files
committed
If the entitymentions annotator ran (indicated by MentionsAnnotation being set), return an empty list of entityMentions for an empty document. Addresses #1322
1 parent 02d2957 commit da08664

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/edu/stanford/nlp/pipeline/CoreDocument.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ public void wrapAnnotations() {
3333
if (this.annotationDocument.get(CoreAnnotations.SentencesAnnotation.class) != null) {
3434
wrapSentences();
3535
// if there are entity mentions, build a document wide list
36-
if ( ! sentences.isEmpty() && sentences.get(0).entityMentions() != null) {
36+
if (!sentences.isEmpty() && sentences.get(0).entityMentions() != null) {
3737
buildDocumentEntityMentionsList();
38+
} else if (annotationDocument.get(CoreAnnotations.MentionsAnnotation.class) != null) {
39+
entityMentions = Collections.emptyList();
3840
}
3941
// if there are quotes, build a document wide list
4042
if (QuoteAnnotator.gatherQuotes(this.annotationDocument) != null)

0 commit comments

Comments
 (0)