Update lexeme ranks for loaded vectors ()

Update the ranks for any lexemes that have been added to the vocab
before the vectors are added to the model.
This commit is contained in:
Adriane Boyd 2021-07-19 10:25:54 +02:00 committed by GitHub
parent e532c69475
commit 0e4b96c97e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions
spacy/training

View File

@ -156,6 +156,8 @@ def load_vectors_into_model(
logger.warning(Warnings.W112.format(name=name))
nlp.vocab.vectors = vectors_nlp.vocab.vectors
for lex in nlp.vocab:
lex.rank = nlp.vocab.vectors.key2row.get(lex.orth, OOV_RANK)
if add_strings:
# I guess we should add the strings from the vectors_nlp model?
# E.g. if someone does a similarity query, they might expect the strings.