mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* Add test for numpy array transport
This commit is contained in:
parent
d20eeac156
commit
03cc2ee08e
22
tests/test_array.py
Normal file
22
tests/test_array.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from spacy.en import English
|
||||||
|
from spacy.en import attrs
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def EN():
|
||||||
|
return English()
|
||||||
|
|
||||||
|
def test_attr_of_token(EN):
|
||||||
|
text = u'An example sentence.'
|
||||||
|
tokens = EN(text)
|
||||||
|
example = EN.vocab[u'example']
|
||||||
|
assert example.orth != example.shape
|
||||||
|
feats_array = tokens.to_array((attrs.ORTH, attrs.SHAPE))
|
||||||
|
assert feats_array[0][0] != feats_array[0][1]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user