mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-10 19:57:17 +03:00
* Support setting of word vectors on Lexeme object.
This commit is contained in:
parent
27f988b167
commit
dd4d64b235
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user