This commit is contained in:
Matthew Honnibal 2020-06-25 15:19:46 +02:00
parent c39401105b
commit 7d866c3056

View File

@ -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,