diff --git a/spacy/tokens/spans.pyx b/spacy/tokens/spans.pyx index 716d85a1a..f1c19f308 100644 --- a/spacy/tokens/spans.pyx +++ b/spacy/tokens/spans.pyx @@ -41,13 +41,17 @@ cdef class Span: def __getitem__(self, int i): if i < 0: - i = len(self) - i - return self._seq[self.start + i] + return self._seq[self.end + i] + else: + return self._seq[self.start + i] def __iter__(self): for i in range(self.start, self.end): yield self._seq[i] + def merge(self, unicode tag, unicode lemma, unicode ent_type): + self._seq.merge(self[0].idx, self[-1].idx + len(self[-1]), tag, lemma, ent_type) + property root: """The first ancestor of the first word of the span that has its head outside the span.