forked from kpu/kenlm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_kenlm.pxd
63 lines (51 loc) · 1.91 KB
/
_kenlm.pxd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from libcpp cimport bool
cdef extern from "lm/word_index.hh" namespace "lm":
ctypedef unsigned WordIndex
cdef extern from "lm/return.hh" namespace "lm":
cdef struct FullScoreReturn:
float prob
unsigned char ngram_length
cdef extern from "lm/state.hh" namespace "lm::ngram":
cdef cppclass State :
int Compare(const State &other) const
int hash_value(const State &state)
cdef extern from "lm/virtual_interface.hh" namespace "lm::base":
cdef cppclass Vocabulary:
WordIndex Index(char*)
WordIndex BeginSentence()
WordIndex EndSentence()
WordIndex NotFound()
ctypedef Vocabulary const_Vocabulary "const lm::base::Vocabulary"
cdef cppclass Model:
void BeginSentenceWrite(void *)
void NullContextWrite(void *)
unsigned int Order()
const_Vocabulary& BaseVocabulary()
float BaseScore(void *in_state, WordIndex new_word, void *out_state)
FullScoreReturn BaseFullScore(void *in_state, WordIndex new_word, void *out_state)
cdef extern from "util/mmap.hh" namespace "util":
cdef enum LoadMethod:
LAZY
POPULATE_OR_LAZY
POPULATE_OR_READ
READ
PARALLEL_READ
cdef extern from "lm/config.hh" namespace "lm::ngram::Config":
cdef enum ARPALoadComplain:
ALL
EXPENSIVE
NONE
cdef extern from "lm/config.hh" namespace "lm::ngram":
cdef cppclass Config:
Config()
float probing_multiplier
LoadMethod load_method
bool show_progress
ARPALoadComplain arpa_complain
float unknown_missing_logprob
cdef extern from "lm/model.hh" namespace "lm::ngram":
cdef Model *LoadVirtual(char *, Config &config) except +
#default constructor
cdef Model *LoadVirtual(char *) except +
cdef extern from "python/score_sentence.hh" namespace "lm::base":
cdef float ScoreSentence(const Model *model, const char *sentence)