From 7d866c3056007c931f5feaff29b4ac09479ad72a Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 25 Jun 2020 15:19:46 +0200 Subject: [PATCH] Add test --- spacy/tests/test_gold.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spacy/tests/test_gold.py b/spacy/tests/test_gold.py index a8d5625f8..463066406 100644 --- a/spacy/tests/test_gold.py +++ b/spacy/tests/test_gold.py @@ -161,6 +161,21 @@ def test_example_from_dict_no_ner(en_vocab): ner_tags = example.get_aligned_ner() assert ner_tags == [None, None, None, None] +def test_example_from_dict_some_ner(en_vocab): + words = ["a", "b", "c", "d"] + spaces = [True, True, False, True] + predicted = Doc(en_vocab, words=words, spaces=spaces) + example = Example.from_dict( + predicted, + { + "words": words, + "entities": ["U-LOC", None, None, None] + } + ) + ner_tags = example.get_aligned_ner() + assert ner_tags == ["U-LOC", None, None, None] + + def test_json2docs_no_ner(en_vocab): data = [{ "id":1,