From e420e0366cba712ab678679fe9fbb212f2eb6466 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 15 Aug 2017 03:13:57 -0500 Subject: [PATCH] Remove use of hash function in beam parser --- spacy/syntax/_beam_utils.pyx | 6 +----- spacy/syntax/nn_parser.pyx | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/spacy/syntax/_beam_utils.pyx b/spacy/syntax/_beam_utils.pyx index e77036e55..15f1ce59b 100644 --- a/spacy/syntax/_beam_utils.pyx +++ b/spacy/syntax/_beam_utils.pyx @@ -86,11 +86,7 @@ cdef class ParserBeam(object): self._set_scores(beam, scores[i]) if self.golds is not None: self._set_costs(beam, self.golds[i], follow_gold=follow_gold) - if follow_gold: - assert self.golds is not None - beam.advance(_transition_state, NULL, self.moves.c) - else: - beam.advance(_transition_state, _hash_state, self.moves.c) + beam.advance(_transition_state, NULL, self.moves.c) beam.check_done(_check_final_state, NULL) if beam.is_done: for j in range(beam.size): diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index a193c96a3..fb7099022 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -471,7 +471,7 @@ cdef class Parser: for k in range(nr_class): beam.scores[i][k] = c_scores[j * scores.shape[1] + k] j += 1 - beam.advance(_transition_state, _hash_state, self.moves.c) + beam.advance(_transition_state, NULL, self.moves.c) beam.check_done(_check_final_state, NULL) beams.append(beam) return beams