mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-02 19:03:14 +03:00
fix: lexeme.pyx
This commit is contained in:
parent
0210f0de26
commit
e7ea284ff1
|
@ -1,6 +1,5 @@
|
|||
# cython: embedsignature=True
|
||||
# Compiler crashes on memory view coercion without this. Should report bug.
|
||||
from cython.view cimport array as cvarray
|
||||
from libc.string cimport memset
|
||||
cimport numpy as np
|
||||
np.import_array()
|
||||
|
@ -121,9 +120,11 @@ cdef class Lexeme:
|
|||
if hasattr(other, "orth"):
|
||||
if self.c.orth == other.orth:
|
||||
return 1.0
|
||||
elif hasattr(other, "__len__") and len(other) == 1 \
|
||||
and hasattr(other[0], "orth"):
|
||||
if self.c.orth == other[0].orth:
|
||||
elif (
|
||||
hasattr(other, "__len__") and len(other) == 1
|
||||
and hasattr(other[0], "orth")
|
||||
and self.c.orth == other[0].orth
|
||||
):
|
||||
return 1.0
|
||||
if self.vector_norm == 0 or other.vector_norm == 0:
|
||||
warnings.warn(Warnings.W008.format(obj="Lexeme"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user