* Support setting of word vectors on Lexeme object.

This commit is contained in:
Matthew Honnibal 2015-09-15 14:42:27 +10:00
parent 27f988b167
commit dd4d64b235

View File

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