spaCy/tests/test_orth.py

29 lines
459 B
Python
Raw Normal View History

2014-07-23 16:36:12 +00:00
from __future__ import unicode_literals
import pytest
import spacy.word
2014-08-30 17:01:15 +00:00
from spacy import en
EN = en.EN
2014-07-23 16:36:12 +00:00
@pytest.fixture
def C3P0():
2014-08-30 17:01:15 +00:00
return EN.lookup("C3P0")
2014-07-23 16:36:12 +00:00
def test_shape(C3P0):
2014-08-30 17:01:15 +00:00
assert C3P0.string_view(en.SHAPE) == "XdXd"
2014-08-02 20:26:44 +00:00
def test_length():
2014-08-30 17:01:15 +00:00
t = EN.lookup('the')
assert t.length == 3
2014-08-30 17:01:15 +00:00
t = EN.lookup("n't")
assert t.length == 3
2014-08-30 17:01:15 +00:00
t = EN.lookup("'s")
assert t.length == 2
2014-08-30 17:01:15 +00:00
t = EN.lookup('Xxxx')
assert t.length == 4