From 03cc2ee08e6233be66aa539a4aee7b43ee72716f Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 30 Jan 2015 16:43:55 +1100 Subject: [PATCH] * Add test for numpy array transport --- tests/test_array.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/test_array.py diff --git a/tests/test_array.py b/tests/test_array.py new file mode 100644 index 000000000..76f98c4a7 --- /dev/null +++ b/tests/test_array.py @@ -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] + +