* Add a has_repvec property to Lexeme, and a check function to check flags

This commit is contained in:
Matthew Honnibal 2015-02-07 08:42:44 -05:00
parent 321b402739
commit 51b618d646

View File

@ -39,3 +39,10 @@ cdef class Lexeme:
"""
def __cinit__(self, int vec_size):
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)