spaCy/spacy/lang.pxd

57 lines
1.9 KiB
Cython
Raw Normal View History

from libcpp.vector cimport vector
2014-09-10 20:11:13 +04:00
2014-12-02 15:46:59 +03:00
from cpython cimport Py_UNICODE_ISSPACE, Py_UNICODE_ISALPHA, Py_UNICODE_ISUPPER
2014-12-08 13:12:15 +03:00
from preshed.maps cimport PreshMap, PreshMapArray
from cymem.cymem cimport Pool
from .typedefs cimport hash_t
from .tokens cimport Tokens, TokenC
from .lexeme cimport Lexeme
from .tagger cimport Tagger
from .tagger cimport univ_tag_t
from .utf8string cimport StringStore, UniStr
cdef class Lexicon:
cpdef public get_lex_props
cdef Pool mem
cpdef readonly StringStore strings
2014-10-31 09:43:25 +03:00
cdef vector[Lexeme*] lexemes
2014-09-10 20:11:13 +04:00
cdef const Lexeme* get(self, Pool mem, UniStr* s) except NULL
2014-08-29 03:59:23 +04:00
2014-12-02 15:46:59 +03:00
cdef PreshMap _map
2014-08-29 03:59:23 +04:00
cdef class Language:
2014-10-30 10:01:27 +03:00
cdef Pool mem
cdef readonly unicode name
cdef PreshMap _cache
cdef PreshMap _specials
2014-12-08 13:12:15 +03:00
cdef PreshMapArray _lemmas
cpdef readonly Lexicon lexicon
cpdef readonly Tagger pos_tagger
2014-12-08 13:12:15 +03:00
cpdef readonly object lemmatizer
2014-10-30 10:01:27 +03:00
cdef object _prefix_re
cdef object _suffix_re
cdef object _infix_re
cdef int lemmatize(self, const univ_tag_t pos, const Lexeme* lex) except -1
2014-12-08 13:12:15 +03:00
cpdef Tokens tokens_from_list(self, list strings)
2014-09-11 23:37:32 +04:00
cpdef Tokens tokenize(self, unicode text)
cdef int _try_cache(self, int idx, hash_t key, Tokens tokens) except -1
cdef int _tokenize(self, Tokens tokens, UniStr* span, int start, int end) except -1
cdef UniStr* _split_affixes(self, UniStr* string, vector[Lexeme*] *prefixes,
vector[Lexeme*] *suffixes) except NULL
cdef int _attach_tokens(self, Tokens tokens, int idx, UniStr* string,
vector[Lexeme*] *prefixes, vector[Lexeme*] *suffixes) except -1
cdef int _find_prefix(self, Py_UNICODE* characters, size_t length) except -1
cdef int _find_suffix(self, Py_UNICODE* characters, size_t length) except -1
cdef int _find_infix(self, Py_UNICODE* characters, size_t length) except -1
cdef int _save_cached(self, const TokenC* tokens, hash_t key, int n) except -1