mirror of https://github.com/explosion/spaCy.git
Fix #1518: vocab.vectors.resize() didn't work
This commit is contained in:
parent
dec79ca332
commit
a5ea0fdf5a
|
@ -0,0 +1,7 @@
|
|||
from ...vectors import Vectors
|
||||
|
||||
def test_issue1518():
|
||||
'''Test vectors.resize() works.'''
|
||||
vectors = Vectors(shape=(10, 10))
|
||||
vectors.add(u'hello', row=2)
|
||||
vectors.resize((5, 9))
|
|
@ -150,7 +150,7 @@ cdef class Vectors:
|
|||
filled = {row for row in self.key2row.values()}
|
||||
self._unset = {row for row in range(shape[0]) if row not in filled}
|
||||
removed_items = []
|
||||
for key, row in dict(self.key2row.items()):
|
||||
for key, row in self.key2row.items():
|
||||
if row >= shape[0]:
|
||||
self.key2row.pop(key)
|
||||
removed_items.append((key, row))
|
||||
|
|
Loading…
Reference in New Issue