2014-07-05 22:51:42 +04: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 21:55:06 +04:00
|
|
|
assert unhash(hello.lex) == 'Hello'
|
2014-07-05 22:51:42 +04: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-07 02:02:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
def test_short():
|
|
|
|
addr = lookup('I')
|
2014-08-23 21:55:06 +04:00
|
|
|
assert unhash(addr.lex) == 'I'
|
2014-07-07 02:02:55 +04:00
|
|
|
addr = lookup('not')
|
2014-08-23 21:55:06 +04:00
|
|
|
assert unhash(addr.lex) == 'not'
|