mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-10 19:57:17 +03:00
Skip vector ngram backoff if minn is not set (#7925)
This commit is contained in:
parent
e9037d8fc0
commit
7d5db41ac3
|
@ -364,15 +364,15 @@ cdef class Vocab:
|
|||
word = self[orth].orth_
|
||||
if orth in self.vectors.key2row:
|
||||
return self.vectors[orth]
|
||||
# Assign default ngram limits to minn and maxn which is the length of the word.
|
||||
if minn is None:
|
||||
minn = len(word)
|
||||
if maxn is None:
|
||||
maxn = len(word)
|
||||
xp = get_array_module(self.vectors.data)
|
||||
vectors = xp.zeros((self.vectors_length,), dtype="f")
|
||||
if minn is None:
|
||||
return vectors
|
||||
# Fasttext's ngram computation taken from
|
||||
# https://github.com/facebookresearch/fastText
|
||||
# Assign default ngram limit to maxn which is the length of the word.
|
||||
if maxn is None:
|
||||
maxn = len(word)
|
||||
ngrams_size = 0;
|
||||
for i in range(len(word)):
|
||||
ngram = ""
|
||||
|
|
Loading…
Reference in New Issue
Block a user