From e5c447e237f7939966fb3c5969f10bccbf1bff0f Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 5 Feb 2016 19:18:35 +0100 Subject: [PATCH] * Questionable fix to problem in Span.root --- spacy/tokens/span.pyx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/tokens/span.pyx b/spacy/tokens/span.pyx index ab97fa8ef..801c98523 100644 --- a/spacy/tokens/span.pyx +++ b/spacy/tokens/span.pyx @@ -194,7 +194,10 @@ cdef class Span: if words_to_root < current_best: current_best = words_to_root root = i - return self.doc[root] + if root == -1: + return self.doc[self.start] + else: + return self.doc[root] property lefts: """Tokens that are to the left of the Span, whose head is within the Span."""