From d5bce35fb1124a9b53770aaa404b8cd3514b894f Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Sat, 27 Jul 2019 15:33:27 +0200 Subject: [PATCH] Fix bug in Span.similarity when called via hook --- spacy/tokens/span.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/tokens/span.pyx b/spacy/tokens/span.pyx index 42fb9852d..460972369 100644 --- a/spacy/tokens/span.pyx +++ b/spacy/tokens/span.pyx @@ -311,7 +311,7 @@ cdef class Span: DOCS: https://spacy.io/api/span#similarity """ if "similarity" in self.doc.user_span_hooks: - self.doc.user_span_hooks["similarity"](self, other) + return self.doc.user_span_hooks["similarity"](self, other) if len(self) == 1 and hasattr(other, "orth"): if self[0].orth == other.orth: return 1.0