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