From 809ddf7887b22a709dbf5c44e6967b950f0d01db Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 19 Dec 2014 07:23:00 +1100 Subject: [PATCH] * Add index.pxd --- spacy/index.pxd | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 spacy/index.pxd diff --git a/spacy/index.pxd b/spacy/index.pxd new file mode 100644 index 000000000..f8c2b0a60 --- /dev/null +++ b/spacy/index.pxd @@ -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