mirror of https://github.com/explosion/spaCy.git
Amend 8ae8b443f: Handle comparison with None tokens.
This commit is contained in:
parent
44e2b0100d
commit
12cd27b821
|
@ -60,10 +60,10 @@ cdef class Token:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.__str__()
|
return self.__str__()
|
||||||
|
|
||||||
def __richcmp__(self, other, int op):
|
def __richcmp__(self, Token other, int op):
|
||||||
# http://cython.readthedocs.io/en/latest/src/userguide/special_methods.html
|
# http://cython.readthedocs.io/en/latest/src/userguide/special_methods.html
|
||||||
my = self.idx
|
my = self.idx
|
||||||
their = other.idx
|
their = other.idx if other is not None else None
|
||||||
if op == 0:
|
if op == 0:
|
||||||
return my < their
|
return my < their
|
||||||
elif op == 2:
|
elif op == 2:
|
||||||
|
|
Loading…
Reference in New Issue