* Add index.pxd

This commit is contained in:
Matthew Honnibal 2014-12-19 07:23:00 +11:00
parent 1879abd16a
commit 809ddf7887
1 changed files with 37 additions and 0 deletions

37
spacy/index.pxd Normal file
View File

@ -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