Add all vectors to vocab before pruning
Add all vectors to the vocab before pruning to correct the selection of
vectors to prioritize.
@@ -316,6 +316,9 @@ cdef class Vocab:
DOCS: https://spacy.io/api/vocab#prune_vectors
"""
xp = get_array_module(self.vectors.data)
+ # Make sure all vectors are in the vocab
+ for orth in self.vectors:
+ self[orth]
# Make prob negative so it sorts by rank ascending
# (key2row contains the rank)
priority = [(-lex.prob, self.vectors.key2row[lex.orth], lex.orth)
