spaCy/tests/test_lexeme_flags.py

27 lines
676 B
Python
Raw Normal View History

2014-09-25 20:29:42 +04:00
from __future__ import unicode_literals
import pytest
from spacy.en import *
from spacy.lexeme import *
2014-09-25 20:29:42 +04:00
def test_is_alpha():
the = EN.lexicon.lookup('the')
assert the.check_orth_flag(LexOrth_alpha)
year = EN.lexicon.lookup('1999')
assert not year.check_orth_flag(LexOrth_alpha)
mixed = EN.lexicon.lookup('hello1')
assert not mixed.check_orth_flag(LexOrth_alpha)
2014-09-25 20:29:42 +04:00
def test_is_digit():
the = EN.lexicon.lookup('the')
assert not the.check_orth_flag(LexOrth_digit)
year = EN.lexicon.lookup('1999')
assert year.check_orth_flag(LexOrth_digit)
mixed = EN.lexicon.lookup('hello1')
assert not mixed.check_orth_flag(LexOrth_digit)
2014-09-25 20:29:42 +04:00