From 83ca2113a2fd9cde383222706f33fea9baae6d70 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 1 Apr 2018 13:47:02 +0200 Subject: [PATCH] Constrain Break action to stack depth==1 --- spacy/syntax/_state.pxd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/syntax/_state.pxd b/spacy/syntax/_state.pxd index 96bd727fa..388c8133e 100644 --- a/spacy/syntax/_state.pxd +++ b/spacy/syntax/_state.pxd @@ -189,7 +189,9 @@ cdef cppclass StateC: return False elif this._sent[this.B_(0).l_edge].sent_start < 0: return False - elif this.stack_depth() < 1: # ?? I guess stops first action break? + # We only want to break when the 'root' word is on the stack, so that + # we can add the label. + elif this.stack_depth() != 1: return False elif this.at_break(): return False