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