code: def test_Example_from_dict_with_empty_entities():
      annots = {
          "words": ["I", "like", "New", "York", "and", "Berlin", "."],
          "entities": [],
      }
      vocab = Vocab()
      predicted = Doc(vocab, words=annots["words"])
      example = Example.from_dict(predicted, annots)
      # entities as empty list sets everything to O
      assert example.reference.has_annotation("ENT_IOB")
      assert len(list(example.reference.ents)) == 0
      assert all(token.ent_iob_ == "O" for token in example.reference)
      # various unset/missing entities leaves entities unset
      annots["entities"] = None
      example = Example.from_dict(predicted, annots)
      assert not example.reference.has_annotation("ENT_IOB")
      annots.pop("entities", None)
      example = Example.from_dict(predicted, annots)
      assert not example.reference.has_annotation("ENT_IOB")
  
imports: import pytest
  from spacy.tokens import Doc
  from spacy.training.example import Example
  from spacy.util import to_ternary_int
  from spacy.vocab import Vocab
label_desc: Use image node_id 12 for calling a global function with example usage: test_Example_from_dict_with_empty_entities() without return types