2014-07-23 20:36:12 +04:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2014-08-23 21:55:06 +04:00
|
|
|
import spacy.word
|
2014-09-10 20:27:44 +04:00
|
|
|
from spacy.en import EN
|
2014-10-10 01:11:31 +04:00
|
|
|
from spacy.lexeme import *
|
2014-07-23 20:36:12 +04:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def C3P0():
|
2014-08-30 21:01:15 +04:00
|
|
|
return EN.lookup("C3P0")
|
2014-07-23 20:36:12 +04:00
|
|
|
|
|
|
|
|
|
|
|
def test_shape(C3P0):
|
2014-10-10 01:11:31 +04:00
|
|
|
assert C3P0.string_view(LexStr_shape) == "XdXd"
|
2014-08-03 00:26:44 +04:00
|
|
|
|
|
|
|
|
|
|
|
def test_length():
|
2014-08-30 21:01:15 +04:00
|
|
|
t = EN.lookup('the')
|
2014-08-23 21:55:06 +04:00
|
|
|
assert t.length == 3
|
2014-08-30 21:01:15 +04:00
|
|
|
t = EN.lookup("n't")
|
2014-08-23 21:55:06 +04:00
|
|
|
assert t.length == 3
|
2014-08-30 21:01:15 +04:00
|
|
|
t = EN.lookup("'s")
|
2014-08-23 21:55:06 +04:00
|
|
|
assert t.length == 2
|
2014-08-30 21:01:15 +04:00
|
|
|
t = EN.lookup('Xxxx')
|
2014-08-23 21:55:06 +04:00
|
|
|
assert t.length == 4
|