2014-07-05 22:51:42 +04:00
|
|
|
from libcpp.vector cimport vector
|
2014-07-07 06:21:06 +04:00
|
|
|
from libc.stdint cimport uint64_t
|
|
|
|
|
2014-07-25 18:47:27 +04:00
|
|
|
from sparsehash.dense_hash_map cimport dense_hash_map
|
2014-08-03 00:27:03 +04:00
|
|
|
from _hashing cimport FixedTable
|
2014-07-07 14:47:21 +04:00
|
|
|
|
2014-07-07 06:21:06 +04:00
|
|
|
# Circular import problems here
|
|
|
|
ctypedef size_t Lexeme_addr
|
|
|
|
ctypedef uint64_t StringHash
|
2014-07-07 18:58:48 +04:00
|
|
|
ctypedef dense_hash_map[StringHash, size_t] Vocab
|
|
|
|
from spacy.lexeme cimport Lexeme
|
|
|
|
|
|
|
|
from spacy.tokens cimport Tokens
|
|
|
|
|
|
|
|
# Put these above import to avoid circular import problem
|
|
|
|
ctypedef char Bits8
|
|
|
|
ctypedef uint64_t Bits64
|
|
|
|
ctypedef int ClusterID
|
2014-07-05 22:51:42 +04:00
|
|
|
|
|
|
|
|
2014-07-07 06:21:06 +04:00
|
|
|
from spacy.lexeme cimport Lexeme
|
2014-07-07 18:58:48 +04:00
|
|
|
from spacy.lexeme cimport Distribution
|
|
|
|
from spacy.lexeme cimport Orthography
|
|
|
|
|
2014-07-07 14:47:21 +04:00
|
|
|
|
|
|
|
cdef class Language:
|
|
|
|
cdef object name
|
2014-08-03 00:27:03 +04:00
|
|
|
cdef FixedTable happax
|
2014-07-07 14:47:21 +04:00
|
|
|
cdef Vocab* vocab
|
2014-07-07 18:58:48 +04:00
|
|
|
cdef Vocab* distri
|
|
|
|
cdef Vocab* ortho
|
2014-07-07 14:47:21 +04:00
|
|
|
cdef dict bacov
|
|
|
|
cdef int find_split(self, unicode word, size_t length)
|
2014-07-07 06:21:06 +04:00
|
|
|
|
2014-07-07 14:47:21 +04:00
|
|
|
cdef Lexeme_addr lookup(self, int split, Py_UNICODE* string, size_t length) except 0
|
|
|
|
cdef StringHash hash_string(self, Py_UNICODE* string, size_t length) except 0
|
|
|
|
cdef unicode unhash(self, StringHash hashed)
|
|
|
|
|
|
|
|
cpdef Tokens tokenize(self, unicode text)
|
|
|
|
cdef Lexeme* _add(self, StringHash hashed, unicode string, int split, size_t length)
|
2014-07-07 18:58:48 +04:00
|
|
|
cdef Lexeme* init_lexeme(self, unicode string, StringHash hashed,
|
|
|
|
int split, size_t length)
|
|
|
|
cdef Orthography* init_orth(self, StringHash hashed, unicode lex)
|
2014-08-03 00:27:03 +04:00
|
|
|
|
|
|
|
cdef int _happax_to_vocab(self, StringHash hashed, Lexeme_addr addr)
|