mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Fix KeyError in Vectors.most_similar. Fixes #2648
This commit is contained in:
parent
90aec6d2f6
commit
449b889454
|
@ -295,7 +295,8 @@ cdef class Vectors:
|
||||||
|
|
||||||
xp = get_array_module(self.data)
|
xp = get_array_module(self.data)
|
||||||
row2key = {row: key for key, row in self.key2row.items()}
|
row2key = {row: key for key, row in self.key2row.items()}
|
||||||
keys = xp.asarray([row2key[row] for row in best_rows], dtype='uint64')
|
keys = xp.asarray(
|
||||||
|
[row2key[row] for row in best_rows if row in row2key], dtype='uint64')
|
||||||
return (keys, best_rows, scores)
|
return (keys, best_rows, scores)
|
||||||
|
|
||||||
def from_glove(self, path):
|
def from_glove(self, path):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user