mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-10 19:57:17 +03:00
* Fix Token.has_vector and Lexeme.has_vector
This commit is contained in:
parent
596fde8daa
commit
44aecba701
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user