From e7af75e0a91a8d0f2eb2e3c5a3e680750d4324c0 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 21 Oct 2016 17:07:21 +0200 Subject: [PATCH] Add test for vector resizing, re Issue #544 --- spacy/tests/vocab/test_add_vectors.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 spacy/tests/vocab/test_add_vectors.py diff --git a/spacy/tests/vocab/test_add_vectors.py b/spacy/tests/vocab/test_add_vectors.py new file mode 100644 index 000000000..b2bd812cf --- /dev/null +++ b/spacy/tests/vocab/test_add_vectors.py @@ -0,0 +1,12 @@ +import numpy + +import spacy.en + + +def test_add_vector(): + vocab = spacy.en.English.Defaults.create_vocab() + vocab.resize_vectors(10) + lex = vocab[u'Hello'] + lex.vector = numpy.ndarray((10,), dtype='float32') + lex = vocab[u'Hello'] + assert lex.vector.shape == (10,)