* Relax constraint on Break transition for non-monotonic parsing.

This commit is contained in:
Matthew Honnibal 2015-05-28 23:38:19 +02:00
parent ef67ef7a4c
commit 8f31d3b864
1 changed files with 6 additions and 1 deletions

View File

@ -407,8 +407,13 @@ cdef inline bint _can_break(const State* s) nogil:
return False return False
elif at_eol(s): elif at_eol(s):
return False return False
elif NON_MONOTONIC:
return True
else: else:
# If stack is disconnected, cannot break # In the Break transition paper, they have this constraint that prevents
# Break if stack is disconnected. But, if we're doing non-monotonic parsing,
# we prefer to relax this constraint. This is helpful in parsing whole
# documents, because then we don't get stuck with words on the stack.
seen_headless = False seen_headless = False
for i in range(s.stack_len): for i in range(s.stack_len):
if s.sent[s.stack[-i]].head == 0: if s.sent[s.stack[-i]].head == 0: