mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
Fix bug in Span.similarity when called via hook
This commit is contained in:
parent
109b5e1798
commit
d5bce35fb1
|
@ -311,7 +311,7 @@ cdef class Span:
|
||||||
DOCS: https://spacy.io/api/span#similarity
|
DOCS: https://spacy.io/api/span#similarity
|
||||||
"""
|
"""
|
||||||
if "similarity" in self.doc.user_span_hooks:
|
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 len(self) == 1 and hasattr(other, "orth"):
|
||||||
if self[0].orth == other.orth:
|
if self[0].orth == other.orth:
|
||||||
return 1.0
|
return 1.0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user