mirror of https://github.com/explosion/spaCy.git
Improve Example error handling for NER data (#6835)
* Improve Example error handling for NER data * Fix conditional
This commit is contained in:
parent
78d6ff4dd4
commit
cc18f3f23c
|
@ -356,7 +356,9 @@ def _add_entities_to_doc(doc, ner_data):
|
||||||
return
|
return
|
||||||
elif ner_data == []:
|
elif ner_data == []:
|
||||||
doc.ents = []
|
doc.ents = []
|
||||||
elif isinstance(ner_data[0], tuple):
|
elif not isinstance(ner_data, (list, tuple)):
|
||||||
|
raise ValueError(Errors.E973)
|
||||||
|
elif isinstance(ner_data[0], (list, tuple)):
|
||||||
return _add_entities_to_doc(
|
return _add_entities_to_doc(
|
||||||
doc,
|
doc,
|
||||||
offsets_to_biluo_tags(doc, ner_data)
|
offsets_to_biluo_tags(doc, ner_data)
|
||||||
|
|
Loading…
Reference in New Issue