10 int main(int argc
,char **argv
)
14 cerr
<< "Loading... ";
15 warch
.load("wordlist.wl");
19 cerr
<< "done" << endl
;
21 get_sarch().set_blocked(true);
24 while (getline(cin
,s
)) {
25 if (s
.empty()) continue;
28 sentences_split(s
,ss
);
29 for (int ii
= 0;ii
< ss
.size();ii
++) {
37 segtor
.init(words
,0,4);
38 while (segtor
.step(seg
)) {
41 VocabIndex
*vi
= new VocabIndex
[ngram_length
];
42 vi
[ngram_length
] = Vocab_None
;
43 for (int i
= ngram_length
-1;i
< seg
.size();i
++) {
44 for (int j
= 0;j
< ngram_length
-1;j
++)
45 vi
[j
] = seg
[i
-1-j
].node
.node
->get_id();
46 seg
.prob
+= -get_ngram().wordProb(seg
[i
].node
.node
->get_id(),vi
);
49 cout
<< seg
<< " " << seg
.prob
<< endl
;
50 //cout << seg << endl;