mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 00:46:28 +03:00
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
|
||||
"""
|
||||
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 self.c.lex.orth == getattr(other[0], "orth", None):
|
||||
return 1.0
|
||||
|
|
Loading…
Reference in New Issue
Block a user