2018-07-25 00:38:44 +03: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 03:09:36 +03:00
|
|
|
tagger = nlp.create_pipe("tagger")
|
2018-07-25 00:38:44 +03:00
|
|
|
tagger.begin_training() # initialise weights
|
|
|
|
nlp.add_pipe(tagger)
|
2018-11-27 03:09:36 +03:00
|
|
|
doc = nlp("hello world")
|
2018-07-25 00:38:44 +03:00
|
|
|
assert doc.is_tagged
|
2018-11-27 03:09:36 +03:00
|
|
|
docs = nlp.pipe(["hello", "world"])
|
2018-07-25 00:38:44 +03:00
|
|
|
piped_doc = next(docs)
|
|
|
|
assert piped_doc.is_tagged
|