mirror of https://github.com/explosion/spaCy.git
* Relax constraint on Break transition for non-monotonic parsing.
This commit is contained in:
parent
ef67ef7a4c
commit
8f31d3b864
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue