mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Fix #1518: vocab.vectors.resize() didn't work
This commit is contained in:
parent
dec79ca332
commit
a5ea0fdf5a
7
spacy/tests/regression/test_issue1518.py
Normal file
7
spacy/tests/regression/test_issue1518.py
Normal file
|
@ -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
Block a user