mirror of https://github.com/explosion/spaCy.git
* Add index.pxd
This commit is contained in:
parent
1879abd16a
commit
809ddf7887
|
@ -0,0 +1,37 @@
|
||||||
|
from libcpp.vector cimport vector
|
||||||
|
from libcpp.pair cimport pair
|
||||||
|
from preshed.counter cimport count_t
|
||||||
|
from preshed.maps cimport PreshMap
|
||||||
|
from preshed.counter cimport PreshCounter
|
||||||
|
from cymem.cymem cimport Pool
|
||||||
|
|
||||||
|
from .lang cimport Lexicon
|
||||||
|
from .tokens cimport Tokens, TokenC
|
||||||
|
from .typedefs cimport id_t
|
||||||
|
from .lexeme cimport attr_id_t
|
||||||
|
from .typedefs cimport attr_t
|
||||||
|
from .typedefs cimport hash_t
|
||||||
|
|
||||||
|
from murmurhash.mrmr cimport hash64
|
||||||
|
|
||||||
|
|
||||||
|
ctypedef vector[pair[id_t, count_t]] count_vector_t
|
||||||
|
|
||||||
|
|
||||||
|
cdef class Index:
|
||||||
|
cdef attr_id_t attr_id
|
||||||
|
cdef readonly attr_t max_value
|
||||||
|
cdef vector[count_vector_t] counts
|
||||||
|
|
||||||
|
cpdef int count(self, Tokens tokens) except -1
|
||||||
|
|
||||||
|
|
||||||
|
cdef class DecisionMemory:
|
||||||
|
cdef int n_classes
|
||||||
|
cdef Pool mem
|
||||||
|
cdef PreshCounter _counts
|
||||||
|
cdef PreshCounter _class_counts
|
||||||
|
cdef list class_names
|
||||||
|
|
||||||
|
cdef int inc(self, hash_t context_key, hash_t clas, count_t inc) except -1
|
||||||
|
cdef int find_best_class(self, count_t* counts, hash_t context_key) except -1
|
Loading…
Reference in New Issue