spaCy/spacy/tests/vocab/test_add_vectors.py

15 lines
347 B
Python
Raw Normal View History

2017-01-12 17:09:49 +03:00
# coding: utf-8
from __future__ import unicode_literals
2017-01-12 17:09:49 +03:00
import numpy
import pytest
2017-01-12 17:09:49 +03:00
@pytest.mark.parametrize('text', ["Hello"])
def test_vocab_add_vector(en_vocab, text):
en_vocab.resize_vectors(10)
lex = en_vocab[text]
lex.vector = numpy.ndarray((10,), dtype='float32')
2017-01-12 17:09:49 +03:00
lex = en_vocab[text]
assert lex.vector.shape == (10,)