mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 12:18:04 +03:00
* Upd test
This commit is contained in:
parent
d047dc0d0f
commit
4d4d2c0db4
|
@ -2,25 +2,28 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from spacy.en import *
|
from spacy.en import English
|
||||||
from spacy.lexeme import *
|
from spacy.en.attrs import IS_ALPHA, IS_DIGIT
|
||||||
|
|
||||||
|
|
||||||
def test_is_alpha():
|
@pytest.fixture
|
||||||
EN.load()
|
def EN():
|
||||||
the = EN.lexicon['the']
|
return English(pos_tag=False)
|
||||||
|
|
||||||
|
|
||||||
|
def test_is_alpha(EN):
|
||||||
|
the = EN.vocab['the']
|
||||||
assert the['flags'] & (1 << IS_ALPHA)
|
assert the['flags'] & (1 << IS_ALPHA)
|
||||||
year = EN.lexicon['1999']
|
year = EN.vocab['1999']
|
||||||
assert not year['flags'] & (1 << IS_ALPHA)
|
assert not year['flags'] & (1 << IS_ALPHA)
|
||||||
mixed = EN.lexicon['hello1']
|
mixed = EN.vocab['hello1']
|
||||||
assert not mixed['flags'] & (1 << IS_ALPHA)
|
assert not mixed['flags'] & (1 << IS_ALPHA)
|
||||||
|
|
||||||
|
|
||||||
def test_is_digit():
|
def test_is_digit(EN):
|
||||||
EN.load()
|
the = EN.vocab['the']
|
||||||
the = EN.lexicon['the']
|
|
||||||
assert not the['flags'] & (1 << IS_DIGIT)
|
assert not the['flags'] & (1 << IS_DIGIT)
|
||||||
year = EN.lexicon['1999']
|
year = EN.vocab['1999']
|
||||||
assert year['flags'] & (1 << IS_DIGIT)
|
assert year['flags'] & (1 << IS_DIGIT)
|
||||||
mixed = EN.lexicon['hello1']
|
mixed = EN.vocab['hello1']
|
||||||
assert not mixed['flags'] & (1 << IS_DIGIT)
|
assert not mixed['flags'] & (1 << IS_DIGIT)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user