mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
Use dict.copy().items() instead of list(.items()) (#9868)
This commit is contained in:
parent
018827e9fd
commit
94fbd88521
|
@ -604,7 +604,7 @@ cdef class ArcEager(TransitionSystem):
|
||||||
actions[SHIFT][''] += 1
|
actions[SHIFT][''] += 1
|
||||||
if min_freq is not None:
|
if min_freq is not None:
|
||||||
for action, label_freqs in actions.items():
|
for action, label_freqs in actions.items():
|
||||||
for label, freq in list(label_freqs.items()):
|
for label, freq in label_freqs.copy().items():
|
||||||
if freq < min_freq:
|
if freq < min_freq:
|
||||||
label_freqs.pop(label)
|
label_freqs.pop(label)
|
||||||
# Ensure these actions are present
|
# Ensure these actions are present
|
||||||
|
|
|
@ -274,7 +274,7 @@ cdef class Vectors:
|
||||||
self.data = resized_array
|
self.data = resized_array
|
||||||
self._sync_unset()
|
self._sync_unset()
|
||||||
removed_items = []
|
removed_items = []
|
||||||
for key, row in list(self.key2row.items()):
|
for key, row in self.key2row.copy().items():
|
||||||
if row >= shape[0]:
|
if row >= shape[0]:
|
||||||
self.key2row.pop(key)
|
self.key2row.pop(key)
|
||||||
removed_items.append((key, row))
|
removed_items.append((key, row))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user