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-08-25 18:42:22 +04:00
|
|
|
from spacy.word cimport Lexeme
|
2014-09-10 20:11:13 +04:00
|
|
|
from spacy.tokens cimport Tokens
|
2014-09-12 05:30:50 +04:00
|
|
|
from spacy.lexeme cimport LexemeC
|
2014-09-10 20:11:13 +04:00
|
|
|
|
2014-09-12 04:23:51 +04:00
|
|
|
from libcpp.utility cimport pair
|
|
|
|
from libcpp.vector cimport vector
|
|
|
|
from libc.stdint cimport uint64_t, int64_t
|
2014-09-10 20:11:13 +04:00
|
|
|
|
|
|
|
|
2014-09-12 04:23:51 +04:00
|
|
|
cdef extern from "sparsehash/dense_hash_map" namespace "google":
|
|
|
|
cdef cppclass dense_hash_map[K, D]:
|
|
|
|
K& key_type
|
|
|
|
D& data_type
|
|
|
|
pair[K, D]& value_type
|
|
|
|
uint64_t size_type
|
|
|
|
cppclass iterator:
|
|
|
|
pair[K, D]& operator*() nogil
|
|
|
|
iterator operator++() nogil
|
|
|
|
iterator operator--() nogil
|
|
|
|
bint operator==(iterator) nogil
|
|
|
|
bint operator!=(iterator) nogil
|
|
|
|
iterator begin()
|
|
|
|
iterator end()
|
|
|
|
uint64_t size()
|
|
|
|
uint64_t max_size()
|
|
|
|
bint empty()
|
|
|
|
uint64_t bucket_count()
|
|
|
|
uint64_t bucket_size(uint64_t i)
|
|
|
|
uint64_t bucket(K& key)
|
|
|
|
double max_load_factor()
|
|
|
|
void max_load_vactor(double new_grow)
|
|
|
|
double min_load_factor()
|
|
|
|
double min_load_factor(double new_grow)
|
|
|
|
void set_resizing_parameters(double shrink, double grow)
|
|
|
|
void resize(uint64_t n)
|
|
|
|
void rehash(uint64_t n)
|
|
|
|
dense_hash_map()
|
|
|
|
dense_hash_map(uint64_t n)
|
|
|
|
void swap(dense_hash_map&)
|
|
|
|
pair[iterator, bint] insert(pair[K, D]) nogil
|
|
|
|
void set_empty_key(K&)
|
|
|
|
void set_deleted_key(K& key)
|
|
|
|
void clear_deleted_key()
|
|
|
|
void erase(iterator pos)
|
|
|
|
uint64_t erase(K& k)
|
|
|
|
void erase(iterator first, iterator last)
|
|
|
|
void clear()
|
|
|
|
void clear_no_resize()
|
|
|
|
pair[iterator, iterator] equal_range(K& k)
|
|
|
|
D& operator[](K&) nogil
|
2014-07-07 18:58:48 +04:00
|
|
|
|
2014-07-07 14:47:21 +04:00
|
|
|
|
2014-09-12 05:30:50 +04:00
|
|
|
cdef struct LexList:
|
|
|
|
LexemeC* lex
|
|
|
|
LexList* tail
|
|
|
|
|
2014-08-27 19:15:39 +04:00
|
|
|
cdef class Lexicon:
|
2014-09-10 20:11:13 +04:00
|
|
|
cpdef readonly size_t size
|
|
|
|
|
2014-08-27 19:15:39 +04:00
|
|
|
cpdef Lexeme lookup(self, unicode string)
|
2014-09-11 23:54:34 +04:00
|
|
|
cdef size_t get(self, unicode string)
|
2014-08-29 03:59:23 +04:00
|
|
|
|
|
|
|
cdef dict _dict
|
|
|
|
|
|
|
|
cdef list _string_features
|
|
|
|
cdef list _flag_features
|
2014-08-27 19:15:39 +04:00
|
|
|
|
|
|
|
|
2014-07-07 14:47:21 +04:00
|
|
|
cdef class Language:
|
2014-08-29 03:59:23 +04:00
|
|
|
cdef unicode name
|
2014-09-12 04:23:51 +04:00
|
|
|
cdef dense_hash_map[uint64_t, size_t] cache
|
|
|
|
cdef size_t cache_size
|
2014-08-27 19:15:39 +04:00
|
|
|
cpdef readonly Lexicon lexicon
|
2014-09-10 20:11:13 +04:00
|
|
|
cpdef readonly object tokens_class
|
2014-07-07 06:21:06 +04:00
|
|
|
|
2014-09-11 23:37:32 +04:00
|
|
|
cpdef Tokens tokenize(self, unicode text)
|
2014-08-29 03:59:23 +04:00
|
|
|
cpdef Lexeme lookup(self, unicode text)
|
2014-08-16 05:22:03 +04:00
|
|
|
|
2014-09-12 04:43:36 +04:00
|
|
|
cdef int _tokenize(self, Tokens tokens, Py_UNICODE* characters, size_t length) except -1
|
2014-08-29 03:59:23 +04:00
|
|
|
cdef int _split_one(self, unicode word)
|