mirror of https://github.com/explosion/spaCy.git
Add all vectors to vocab before pruning (#6408)
Add all vectors to the vocab before pruning to correct the selection of vectors to prioritize.
This commit is contained in:
parent
13f0676f04
commit
a8c2dad466
|
@ -316,6 +316,9 @@ cdef class Vocab:
|
||||||
DOCS: https://spacy.io/api/vocab#prune_vectors
|
DOCS: https://spacy.io/api/vocab#prune_vectors
|
||||||
"""
|
"""
|
||||||
xp = get_array_module(self.vectors.data)
|
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
|
# Make prob negative so it sorts by rank ascending
|
||||||
# (key2row contains the rank)
|
# (key2row contains the rank)
|
||||||
priority = [(-lex.prob, self.vectors.key2row[lex.orth], lex.orth)
|
priority = [(-lex.prob, self.vectors.key2row[lex.orth], lex.orth)
|
||||||
|
|
Loading…
Reference in New Issue