本文整理汇总了C++中Generator::init方法的典型用法代码示例。如果您正苦于以下问题:C++ Generator::init方法的具体用法?C++ Generator::init怎么用?C++ Generator::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: segment_best
void WFST::segment_best(const Lattice &words,Segmentation &seps)
{
//int i,ii,n,nn;
p_words = &words;
// in test mode, generate all positions where misspelled can appear,
// then create a new Lattice for them, re get_sections,
// create_base_segmentation and call segment_all1 for each sections.
// 1. Generate mispelled positions (pruning 0 - GA)
// 2. Compute the score, jump to 1. if score is too low (pruning 1)
// 3. Make a new Lattice based on the original Lattice
// 4. Call get_sections
// 5. Call create_base_segmentation
// 6. Call segment_all1 for each sections.
// 6.1. Recompute the score after each section processed. (pruning 2)
// 1. Bai toan hoan vi, tinh chap C(k,n) with modification. C(1,n)+C(2,n)+...+C(k,n)
Generator gen;
gen.init(*words.st);
vector<uint> pos;
uint len;
seps.prob = 100;
while (gen.step(pos,len)) {
Segmentation seg;
//cerr << "POS :";
//for (int i = 0;i < len;i ++) cerr << pos[i];
//cerr << endl;
generate_misspelled_words(pos,len,seg);
if (seg.prob < seps.prob)
seps = seg;
}
gen.done();
}