mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
27 lines
502 B
Python
27 lines
502 B
Python
from spacy.en import English
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def EN():
|
|
return English(tag=True, parse=False)
|
|
|
|
@pytest.fixture
|
|
def tagged(EN):
|
|
string = u'Bananas in pyjamas are geese.'
|
|
tokens = EN(string, tag=True)
|
|
return tokens
|
|
|
|
|
|
@pytest.fixture
|
|
def lemmas(tagged):
|
|
return [t.lemma for t in tagged]
|
|
|
|
|
|
def test_lemmas(lemmas):
|
|
assert lemmas[0] == 'banana'
|
|
assert lemmas[1] == 'in'
|
|
assert lemmas[2] == 'pyjama'
|
|
assert lemmas[3] == 'be'
|
|
assert lemmas[4] == 'goose'
|