Describe the bug
When calling model.inference_from_dicts, does not return an item if no named entity is found in text
To Reproduce
model = Inferencer.load(save_dir) # Connl EN NER
basic_texts = [
{"text": "I love you."},
{"text": "I love Anna."}, # only this sentence has a NE, Anna
{"text": "I love you so much!"},
]
result = model.inference_from_dicts(dicts=basic_texts)
actual output
[{'task': 'ner', 'predictions': [{'start': 7, 'end': 12, 'context': 'Anna.', 'label': 'PER', 'probability': 0.9851147}]}]
expected output
[{'task': 'ner', 'predictions': [{}, {'start': 7, 'end': 12, 'context': 'Anna.', 'label': 'PER', 'probability': 0.9851147}, {}]}]
(note the two empty dicts for the sentences where no NE was found.
Why it's important
Otherwise it's tricky to map it back to the original text...
Thanks!