本文整理汇总了C++中MATRIX::IncreaseBandSize方法的典型用法代码示例。如果您正苦于以下问题:C++ MATRIX::IncreaseBandSize方法的具体用法?C++ MATRIX::IncreaseBandSize怎么用?C++ MATRIX::IncreaseBandSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MATRIX
的用法示例。
在下文中一共展示了MATRIX::IncreaseBandSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessSegSearchPainPoint
void Wordrec::ProcessSegSearchPainPoint(
float pain_point_priority,
const MATRIX_COORD &pain_point, const char* pain_point_type,
GenericVector<SegSearchPending>* pending, WERD_RES *word_res,
LMPainPoints *pain_points, BlamerBundle *blamer_bundle) {
if (segsearch_debug_level > 0) {
tprintf("Classifying pain point %s priority=%.4f, col=%d, row=%d\n",
pain_point_type, pain_point_priority,
pain_point.col, pain_point.row);
}
ASSERT_HOST(pain_points != NULL);
MATRIX *ratings = word_res->ratings;
// Classify blob [pain_point.col pain_point.row]
if (!pain_point.Valid(*ratings)) {
ratings->IncreaseBandSize(pain_point.row + 1 - pain_point.col);
}
ASSERT_HOST(pain_point.Valid(*ratings));
BLOB_CHOICE_LIST *classified = classify_piece(word_res->seam_array,
pain_point.col, pain_point.row,
pain_point_type,
word_res->chopped_word,
blamer_bundle);
BLOB_CHOICE_LIST *lst = ratings->get(pain_point.col, pain_point.row);
if (lst == NULL) {
ratings->put(pain_point.col, pain_point.row, classified);
} else {
// We can not delete old BLOB_CHOICEs, since they might contain
// ViterbiStateEntries that are parents of other "active" entries.
// Thus if the matrix cell already contains classifications we add
// the new ones to the beginning of the list.
BLOB_CHOICE_IT it(lst);
it.add_list_before(classified);
delete classified; // safe to delete, since empty after add_list_before()
classified = NULL;
}
if (segsearch_debug_level > 0) {
print_ratings_list("Updated ratings matrix with a new entry:",
ratings->get(pain_point.col, pain_point.row),
getDict().getUnicharset());
ratings->print(getDict().getUnicharset());
}
// Insert initial "pain points" to join the newly classified blob
// with its left and right neighbors.
if (classified != NULL && !classified->empty()) {
if (pain_point.col > 0) {
pain_points->GeneratePainPoint(
pain_point.col - 1, pain_point.row, LM_PPTYPE_SHAPE, 0.0,
true, segsearch_max_char_wh_ratio, word_res);
}
if (pain_point.row + 1 < ratings->dimension()) {
pain_points->GeneratePainPoint(
pain_point.col, pain_point.row + 1, LM_PPTYPE_SHAPE, 0.0,
true, segsearch_max_char_wh_ratio, word_res);
}
}
(*pending)[pain_point.col].SetBlobClassified(pain_point.row);
}