2014-07-05 22:51:42 +04:00
|
|
|
from libcpp.vector cimport vector
|
2014-08-03 00:51:52 +04:00
|
|
|
from libc.stdint cimport uint32_t
|
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-07-07 14:47:21 +04:00
|
|
|
|
2014-07-07 06:21:06 +04:00
|
|
|
# Circular import problems here
|
|
|
|
ctypedef size_t Lexeme_addr
|
2014-08-03 00:51:52 +04:00
|
|
|
ctypedef uint32_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-08-16 21:59:38 +04:00
|
|
|
from spacy._hashing cimport WordTree
|
2014-07-07 18:58:48 +04:00
|
|
|
|
2014-07-07 14:47:21 +04:00
|
|
|
|
|
|
|
cdef class Language:
|
|
|
|
cdef object name
|
2014-08-18 21:14:00 +04:00
|
|
|
cdef dense_hash_map[StringHash, size_t] chunks
|
|
|
|
cdef dense_hash_map[StringHash, size_t] vocab
|
2014-07-07 14:47:21 +04:00
|
|
|
cdef dict bacov
|
2014-07-07 06:21:06 +04:00
|
|
|
|
2014-08-18 21:14:00 +04:00
|
|
|
cdef Tokens tokenize(self, unicode text)
|
2014-08-16 05:22:03 +04:00
|
|
|
|
2014-08-18 21:14:00 +04:00
|
|
|
cdef Lexeme* lookup(self, unicode string) except NULL
|
|
|
|
cdef Lexeme** lookup_chunk(self, unicode string) except NULL
|
2014-08-16 05:22:03 +04:00
|
|
|
|
2014-08-18 21:14:00 +04:00
|
|
|
cdef Lexeme** new_chunk(self, unicode string, list substrings) except NULL
|
|
|
|
cdef Lexeme* new_lexeme(self, unicode lex) except NULL
|
2014-08-16 22:10:22 +04:00
|
|
|
cdef Orthography* new_orth(self, unicode lex) except NULL
|
|
|
|
cdef Distribution* new_dist(self, unicode lex) except NULL
|
2014-08-16 05:22:03 +04:00
|
|
|
|
2014-07-07 14:47:21 +04:00
|
|
|
cdef unicode unhash(self, StringHash hashed)
|
|
|
|
|
2014-08-18 21:14:00 +04:00
|
|
|
cpdef list find_substrings(self, unicode word)
|
|
|
|
cdef int find_split(self, unicode word)
|