mirror of https://github.com/explosion/spaCy.git
* Add a has_repvec property to Lexeme, and a check function to check flags
This commit is contained in:
parent
321b402739
commit
51b618d646
|
@ -39,3 +39,10 @@ cdef class Lexeme:
|
||||||
"""
|
"""
|
||||||
def __cinit__(self, int vec_size):
|
def __cinit__(self, int vec_size):
|
||||||
self.repvec = numpy.ndarray(shape=(vec_size,), dtype=numpy.float32)
|
self.repvec = numpy.ndarray(shape=(vec_size,), dtype=numpy.float32)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def has_repvec(self):
|
||||||
|
return self.l2_norm != 0
|
||||||
|
|
||||||
|
cpdef bint check(self, attr_id_t flag_id) except -1:
|
||||||
|
return self.flags & (1 << flag_id)
|
||||||
|
|
Loading…
Reference in New Issue