2018-07-24 21:38:44 +00:00
|
|
|
# coding: utf8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from spacy.language import Language
|
|
|
|
|
|
|
|
|
|
|
|
def test_issue2564():
|
|
|
|
"""Test the tagger sets is_tagged correctly when used via Language.pipe."""
|
|
|
|
nlp = Language()
|
2018-11-27 00:09:36 +00:00
|
|
|
tagger = nlp.create_pipe("tagger")
|
2018-07-24 21:38:44 +00:00
|
|
|
tagger.begin_training() # initialise weights
|
|
|
|
nlp.add_pipe(tagger)
|
2018-11-27 00:09:36 +00:00
|
|
|
doc = nlp("hello world")
|
2018-07-24 21:38:44 +00:00
|
|
|
assert doc.is_tagged
|
2018-11-27 00:09:36 +00:00
|
|
|
docs = nlp.pipe(["hello", "world"])
|
2018-07-24 21:38:44 +00:00
|
|
|
piped_doc = next(docs)
|
|
|
|
assert piped_doc.is_tagged
|