stanfordnlp/CoreNLP

EntityMentions returns null instead of empty list

cholojuanito opened this issue · 3 comments

I ran into an issue where if an empty string is passed in then getting the entityMentions returns null instead of an empty list like I figure out be standard practice.

Example code:

StanfordCoreNLP processor = new StanfordCoreNLP(props);
CoreDocument nlpDocument = new CoreDocument("");

nlpProcessor.annotate(nlpDocument);
List<CoreEntityMention>  entities = nlpDocument.entityMentions(); <== returns null

Just wanted to know if there is any light that can be shed on this. If this is expected behavior then I will try my best to document it in the documentation

That is a little weird. I updated it to return an empty list in the case of an empty document

Thanks for the quick response. It's an edge case I ran into at work today.

4.5.2 is now released, including this bugfix