mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 09:44:36 +03:00
Restore vectors test utils
This commit is contained in:
parent
1391f9da37
commit
ef87562741
|
@ -79,9 +79,9 @@ def add_vecs_to_vocab(vocab, vectors):
|
||||||
"""Add list of vector tuples to given vocab. All vectors need to have the
|
"""Add list of vector tuples to given vocab. All vectors need to have the
|
||||||
same length. Format: [("text", [1, 2, 3])]"""
|
same length. Format: [("text", [1, 2, 3])]"""
|
||||||
length = len(vectors[0][1])
|
length = len(vectors[0][1])
|
||||||
vocab.resize_vectors(length)
|
vocab.clear_vectors(length)
|
||||||
for word, vec in vectors:
|
for word, vec in vectors:
|
||||||
vocab[word].vector = vec
|
vocab.set_vector(word, vec)
|
||||||
return vocab
|
return vocab
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user