Add xfailing test for peculiar spans failure [ci skip]

This commit is contained in:
Ines Montani 2020-10-09 12:10:25 +02:00
parent e50dc2c1c9
commit cc3646b06c

View File

@ -606,3 +606,16 @@ def test_doc_init_iob():
ents = [0, "B-", "O", "I-PERSON", "I-GPE"]
with pytest.raises(ValueError):
doc = Doc(Vocab(), words=words, ents=ents)
@pytest.mark.xfail
def test_doc_set_ents_spans(en_tokenizer):
doc = en_tokenizer("Some text about Colombia and the Czech Republic")
spans = [Span(doc, 3, 4, label="GPE"), Span(doc, 6, 8, label="GPE")]
with doc.retokenize() as retokenizer:
for span in spans:
retokenizer.merge(span)
# If this line is uncommented, it works:
# print(spans)
doc.ents = list(doc.ents) + spans
print([ent.text for ent in doc.ents])