mirror of https://github.com/explosion/spaCy.git
Fix bug in Token.similarity when called via hook
This commit is contained in:
parent
e000b5ed82
commit
109b5e1798
|
@ -202,7 +202,7 @@ cdef class Token:
|
||||||
DOCS: https://spacy.io/api/token#similarity
|
DOCS: https://spacy.io/api/token#similarity
|
||||||
"""
|
"""
|
||||||
if "similarity" in self.doc.user_token_hooks:
|
if "similarity" in self.doc.user_token_hooks:
|
||||||
return self.doc.user_token_hooks["similarity"](self)
|
return self.doc.user_token_hooks["similarity"](self, other)
|
||||||
if hasattr(other, "__len__") and len(other) == 1 and hasattr(other, "__getitem__"):
|
if hasattr(other, "__len__") and len(other) == 1 and hasattr(other, "__getitem__"):
|
||||||
if self.c.lex.orth == getattr(other[0], "orth", None):
|
if self.c.lex.orth == getattr(other[0], "orth", None):
|
||||||
return 1.0
|
return 1.0
|
||||||
|
|
Loading…
Reference in New Issue