diff --git a/spacy/syntax/transition_system.pyx b/spacy/syntax/transition_system.pyx index b76c97566..fc84fc23a 100644 --- a/spacy/syntax/transition_system.pyx +++ b/spacy/syntax/transition_system.pyx @@ -178,6 +178,9 @@ cdef class TransitionSystem: self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id) self.n_moves += 1 + # Add the new (action, label) pair, making up a frequency for it if + # necessary. To preserve sort order, the frequency needs to be lower + # than previous frequencies. if self.labels.get(action, []): new_freq = min(self.labels[action].values()) else: