* Make optimization to children_in_buffer: stop searching when we would cross a bracket.

This commit is contained in:
Matthew Honnibal 2015-06-02 21:05:24 +02:00
parent a513ec500f
commit 6c47b10a6e
1 changed files with 2 additions and 0 deletions

View File

@ -82,6 +82,8 @@ cdef int children_in_buffer(const State *s, int head, const int* gold) except -1
for i in range(s.i, s.sent_len):
if gold[i] == head:
n += 1
elif gold[i] == i or gold[i] < head:
break
return n