2014-07-05 18:51:42 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from spacy import lex_of
|
|
|
|
from spacy.en import lookup
|
|
|
|
from spacy.en import unhash
|
|
|
|
|
|
|
|
|
|
|
|
def test_neq():
|
|
|
|
addr = lookup('Hello')
|
|
|
|
assert lookup('bye') != addr
|
|
|
|
|
|
|
|
|
|
|
|
def test_eq():
|
|
|
|
addr = lookup('Hello')
|
|
|
|
assert lookup('Hello') == addr
|
|
|
|
|
|
|
|
|
|
|
|
def test_round_trip():
|
|
|
|
hello = lookup('Hello')
|
2014-08-23 17:55:06 +00:00
|
|
|
assert unhash(hello.lex) == 'Hello'
|
2014-07-05 18:51:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_case_neq():
|
|
|
|
addr = lookup('Hello')
|
|
|
|
assert lookup('hello') != addr
|
|
|
|
|
|
|
|
|
|
|
|
def test_punct_neq():
|
|
|
|
addr = lookup('Hello')
|
|
|
|
assert lookup('Hello,') != addr
|
2014-07-06 22:02:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_short():
|
|
|
|
addr = lookup('I')
|
2014-08-23 17:55:06 +00:00
|
|
|
assert unhash(addr.lex) == 'I'
|
2014-07-06 22:02:55 +00:00
|
|
|
addr = lookup('not')
|
2014-08-23 17:55:06 +00:00
|
|
|
assert unhash(addr.lex) == 'not'
|