本文整理汇总了C++中Segmentation::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Segmentation::end方法的具体用法?C++ Segmentation::end怎么用?C++ Segmentation::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Segmentation
的用法示例。
在下文中一共展示了Segmentation::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate_misspelled_words
void WFST::generate_misspelled_words(const vector<uint> &pos,int len,Segmentation &final_seg)
{
const Lattice &words = *p_words;
Lattice w;
w.based_on(words);
// 2. Compute the score, jump to 1. if score is too low (pruning 1)
// create new (more compact) Lattice structure
int i,n = words.get_word_count();
for (i = 0;i < len;i ++) {
const WordEntryRefs &fmap = words.get_fuzzy_map(pos[i]);
int ii,nn = fmap.size();
for (ii = 0;ii < nn;++ii)
w.add(*fmap[ii]);
}
//cerr << w << endl;
// 4. Create sections
Sections sects;
sects.construct(words);
// 5. Call create_base_segmentation
//Segmentation base_seg(words.we);
//create_base_segmentation(words,sects,base_seg);
// 6. Get the best segmentation of each section,
// then merge to one big segment.
n = sects.size();
uint ii,nn;
i = ii = 0;
nn = words.get_word_count();
final_seg.clear();
while (ii < nn)
if (i < n && sects[i].start == ii) {
Segmentation seg;
sects[i].segment_best(words,seg);
copy(seg.begin(),
seg.end(),
back_insert_iterator< Segmentation >(final_seg));
ii += sects[i].len;
i ++;
} else {
// only word(i,*,0) exists
final_seg.push_back(words.get_we(ii)[0]->id);
ii += words.get_we(ii)[0]->len;
}
}