Set rank for new vector in Vocab.set_vector
Set `Lexeme.rank` for vectors added with `Vocab.set_vector` so that the
lexeme `ID` accessed by a model points the right row for the new vector.
@@ -406,9 +406,9 @@ cdef class Vocab:
else:
width = self.vectors.shape[1]
self.vectors.resize((new_rows, width))
- lex = self[orth] # Adds words to vocab
- self.vectors.add(orth, vector=vector)
- self.vectors.add(orth, vector=vector)
+ lex = self[orth] # Add word to vocab if necessary
+ row = self.vectors.add(orth, vector=vector)
+ lex.rank = row
def has_vector(self, orth):
"""Check whether a word has a vector. Returns False if no vectors have
