From cc3646b06ce21eb35edea34258a72e6b481af71f Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Fri, 9 Oct 2020 12:10:25 +0200 Subject: [PATCH] Add xfailing test for peculiar spans failure [ci skip] --- spacy/tests/doc/test_doc_api.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spacy/tests/doc/test_doc_api.py b/spacy/tests/doc/test_doc_api.py index e3e056685..136affab2 100644 --- a/spacy/tests/doc/test_doc_api.py +++ b/spacy/tests/doc/test_doc_api.py @@ -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])