* Fix vectors bug in lexeme

This commit is contained in:
Matthew Honnibal 2015-09-15 19:05:11 +10:00
parent 22a1ad8a55
commit 191d593e03

View File

@ -54,12 +54,12 @@ cdef class Lexeme:
property vector: property vector:
def __get__(self): def __get__(self):
cdef int length = self.vocab.vector_length cdef int length = self.vocab.vectors_length
repvec_view = <float[:length,]>self.c.repvec repvec_view = <float[:length,]>self.c.repvec
return numpy.asarray(repvec_view) return numpy.asarray(repvec_view)
def __set__(self, vector): def __set__(self, vector):
assert len(vector) == self.vocab.vector_length assert len(vector) == self.vocab.vectors_length
cdef float value cdef float value
for i, value in enumerate(vector): for i, value in enumerate(vector):
self.c.repvec[i] = value self.c.repvec[i] = value