* Fix Token.has_vector and Lexeme.has_vector

This commit is contained in:
Matthew Honnibal 2015-09-22 01:43:16 +02:00
parent 596fde8daa
commit 44aecba701
2 changed files with 12 additions and 2 deletions

View File

@ -47,7 +47,12 @@ cdef class Lexeme:
property has_vector:
def __get__(self):
return sum(abs(self.c.repvec)) != 0
cdef int i
for i in range(self.vocab.vectors_length):
if self.c.repvec[i] != 0:
return True
else:
return False
property vector_norm:
def __get__(self):

View File

@ -130,7 +130,12 @@ cdef class Token:
property has_vector:
def __get__(self):
return sum(abs(self.c.lex.repvec)) != 0
cdef int i
for i in range(self.vocab.vectors_length):
if self.c.lex.repvec[i] != 0:
return True
else:
return False
property vector:
def __get__(self):