mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +03:00
Modernise add vectors vocab test
This commit is contained in:
parent
89525ef345
commit
d7bd57abdf
|
@ -1,12 +1,14 @@
|
|||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import numpy
|
||||
|
||||
import spacy.en
|
||||
import pytest
|
||||
|
||||
|
||||
def test_add_vector():
|
||||
vocab = spacy.en.English.Defaults.create_vocab()
|
||||
vocab.resize_vectors(10)
|
||||
lex = vocab[u'Hello']
|
||||
@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')
|
||||
lex = vocab[u'Hello']
|
||||
lex = en_vocab[text]
|
||||
assert lex.vector.shape == (10,)
|
||||
|
|
Loading…
Reference in New Issue
Block a user