mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
* Add tests for word shape
This commit is contained in:
parent
4e5b2d47e2
commit
6209d94f83
27
tests/test_shape.py
Normal file
27
tests/test_shape.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
|
||||
from spacy.orth import word_shape as ws
|
||||
|
||||
|
||||
def test_capitalized():
|
||||
assert ws('Nasa') == 'Xxxx'
|
||||
|
||||
def test_truncate():
|
||||
assert ws('capitalized') == 'xxx'
|
||||
|
||||
def test_digits():
|
||||
assert ws('999999999') == 'ddd'
|
||||
|
||||
def test_mix():
|
||||
assert ws('C3P0') == 'XdXd'
|
||||
|
||||
def test_punct():
|
||||
assert ws(',') == ','
|
||||
|
||||
def test_space():
|
||||
assert ws('\n') == '\n'
|
||||
|
||||
def test_punct_seq():
|
||||
assert ws('``,-') == '``,-'
|
Loading…
Reference in New Issue
Block a user