* Update tests

This commit is contained in:
Matthew Honnibal 2014-11-03 00:23:04 +11:00
parent 75329e9ef8
commit 11915e5238
3 changed files with 12 additions and 40 deletions

View File

@ -1,25 +0,0 @@
import py.test
from spacy.orth import non_sparse
import math
def test_common_case_upper():
cases = {'u': 0.7, 'l': 0.2, 't': 0.1}
prob = math.log(0.1)
assert non_sparse('usa', prob, 0, cases['u'], cases['t'], cases['l']) == 'USA'
def test_same():
cases = {'u': 0.01, 't': 0.09, 'l': 0.9}
prob = math.log(0.5)
assert non_sparse('the', prob, 0, cases['u'], cases['t'], cases['l']) == 'the'
def test_common_case_lower():
prob = math.log(0.5)
cases = {'u': 0.01, 't': 0.09, 'l': 0.9}
assert non_sparse('The', prob, 0, cases['u'], cases['t'], cases['l']) == 'the'
def test_shape():
prob = math.log(0.00001)
cases = {'u': 0.0, 't': 0.0, 'l': 0.0}
assert non_sparse('1999', prob, 0, cases['u'], cases['t'], cases['l']) == 'dddd'

View File

@ -9,6 +9,3 @@ def test_only_pre1():
def test_only_pre2():
assert len(EN.tokenize("((")) == 2
def test_only_suf2():
assert len(EN.tokenize("''")) == 2

View File

@ -1,20 +1,20 @@
from spacy.orth import is_urlish
from spacy.orth import like_url
def test_basic_url():
assert is_urlish('www.google.com')
assert is_urlish('google.com')
assert is_urlish('sydney.com')
assert is_urlish('Sydney.edu')
assert is_urlish('2girls1cup.org')
assert like_url('www.google.com')
assert like_url('google.com')
assert like_url('sydney.com')
assert like_url('Sydney.edu')
assert like_url('2girls1cup.org')
def test_close_enough():
assert is_urlish('http://stupid')
assert is_urlish('www.hi')
assert like_url('http://stupid')
assert like_url('www.hi')
def test_non_match():
assert not is_urlish('dog')
assert not is_urlish('1.2')
assert not is_urlish('1.a')
assert not is_urlish('hello.There')
assert not like_url('dog')
assert not like_url('1.2')
assert not like_url('1.a')
assert not like_url('hello.There')