mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Work on vectors
This commit is contained in:
parent
6937e311a4
commit
a131981f3b
|
@ -27,7 +27,8 @@ cdef struct _Cached:
|
|||
cdef class Vocab:
|
||||
cdef Pool mem
|
||||
cpdef readonly StringStore strings
|
||||
cpdef readonly Morphology morphology
|
||||
cpdef public Morphology morphology
|
||||
cpdef public object vectors
|
||||
cdef readonly int length
|
||||
cdef public object data_dir
|
||||
cdef public object lex_attr_getters
|
||||
|
@ -42,4 +43,3 @@ cdef class Vocab:
|
|||
|
||||
cdef PreshMap _by_hash
|
||||
cdef PreshMap _by_orth
|
||||
cdef readonly int vectors_length
|
||||
|
|
|
@ -239,6 +239,16 @@ cdef class Vocab:
|
|||
Token.set_struct_attr(token, attr_id, value)
|
||||
return tokens
|
||||
|
||||
@property
|
||||
def vectors_length(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def clear_vectors(self):
|
||||
"""Drop the current vector table. Because all vectors must be the same
|
||||
width, you have to call this to change the size of the vectors.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_vector(self, orth):
|
||||
"""Retrieve a vector for a word in the vocabulary.
|
||||
|
||||
|
@ -253,6 +263,16 @@ cdef class Vocab:
|
|||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_vector(self, orth, vector):
|
||||
"""Set a vector for a word in the vocabulary.
|
||||
|
||||
Words can be referenced by string or int ID.
|
||||
|
||||
RETURNS:
|
||||
None
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def has_vector(self, orth):
|
||||
"""Check whether a word has a vector. Returns False if no
|
||||
vectors have been loaded. Words can be looked up by string
|
||||
|
|
Loading…
Reference in New Issue
Block a user