Add extra comment on 'add label' in parser

This commit is contained in:
Matthew Honnibal 2018-08-15 15:37:24 +02:00
parent 6e749d3c70
commit 5080760288
1 changed files with 3 additions and 0 deletions

View File

@ -178,6 +178,9 @@ cdef class TransitionSystem:
self.c = <Transition*>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: