Restore vectors test utils

This commit is contained in:
Matthew Honnibal 2017-08-19 20:35:16 +02:00
parent 1391f9da37
commit ef87562741

View File

@ -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