spaCy/spacy/tests/vocab/test_add_vectors.py
2016-10-21 17:07:21 +02:00

13 lines
281 B
Python

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,)