Improve Example error handling for NER data (#6835)

* Improve Example error handling for NER data

* Fix conditional
This commit is contained in:
Ines Montani 2021-01-28 13:11:20 +11:00 committed by GitHub
parent 78d6ff4dd4
commit cc18f3f23c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

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