2019-07-10 11:53:34 +00:00
|
|
|
from spacy.lang.en import English
|
2019-11-16 19:20:53 +00:00
|
|
|
import pytest
|
2019-07-10 11:53:34 +00:00
|
|
|
|
|
|
|
|
2019-11-16 19:20:53 +00:00
|
|
|
@pytest.mark.filterwarnings("ignore::UserWarning")
|
2019-07-10 11:53:34 +00:00
|
|
|
def test_issue3880():
|
|
|
|
"""Test that `nlp.pipe()` works when an empty string ends the batch.
|
|
|
|
|
|
|
|
Fixed in v7.0.5 of Thinc.
|
|
|
|
"""
|
|
|
|
texts = ["hello", "world", "", ""]
|
|
|
|
nlp = English()
|
|
|
|
nlp.add_pipe(nlp.create_pipe("parser"))
|
|
|
|
nlp.add_pipe(nlp.create_pipe("ner"))
|
|
|
|
nlp.add_pipe(nlp.create_pipe("tagger"))
|
|
|
|
nlp.get_pipe("parser").add_label("dep")
|
|
|
|
nlp.get_pipe("ner").add_label("PERSON")
|
|
|
|
nlp.get_pipe("tagger").add_label("NN")
|
|
|
|
nlp.begin_training()
|
|
|
|
for doc in nlp.pipe(texts):
|
|
|
|
pass
|