1323 if (words->
empty()) {
1330 (*words)[0]->word->set_flag(
W_BOL,
true);
1332 (*words)[0]->word->set_blanks(1);
1342 WERD_IT w_it(
row()->
row->word_list());
1344 for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
1346 if (word == input_word->
word)
1353 WERD_RES_IT wr_it(&
row()->word_res_list);
1354 for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
1356 if (word == input_word)
1366 for (
int w = 0; w < words->
size(); ++w) {
1370 C_BLOB_LIST* next_word_blobs =
1371 w + 1 < words->
size() ? (*words)[w + 1]->word->cblob_list() :
NULL;
1372 ComputeBlobEnds(*word_w, next_word_blobs, &blob_ends);
1378 for (
int i = 0; i < blob_ends.
size(); ++i) {
1379 int end_x = blob_ends[i];
1382 while (!src_b_it.empty() &&
1383 src_b_it.data()->bounding_box().x_middle() < end_x) {
1384 blob_box += src_b_it.data()->bounding_box();
1385 dest_it.add_after_then_move(src_b_it.extract());
1388 while (!rej_b_it.empty() &&
1389 rej_b_it.data()->bounding_box().x_middle() < end_x) {
1390 blob_box += rej_b_it.data()->bounding_box();
1391 dest_it.add_after_then_move(rej_b_it.extract());
1397 if (i > 0 && blob_box.
left() < blob_ends[i - 1])
1398 blob_box.
set_left(blob_ends[i - 1]);
1399 if (blob_box.
right() > end_x)
1401 box_word->InsertBox(i, blob_box);
1406 for (
int i = 0; i < box_word->length(); ++i) {
1407 TBOX box = box_word->BlobBox(i);
1411 for (dest_it.mark_cycle_pt(); !dest_it.cycled_list();
1412 dest_it.forward()) {
1413 TBOX blob_box = dest_it.data()->bounding_box();
1414 if (blob_box.
left() < blob_ends[i] &&
1415 (i == 0 || blob_box.
right() >= blob_ends[i - 1])) {
1416 if (i > 0 && blob_box.
left() < blob_ends[i - 1])
1417 blob_box.
set_left(blob_ends[i - 1]);
1418 if (blob_box.
right() > blob_ends[i])
1420 box_word->ChangeBox(i, blob_box);
1431 w_it.add_before_stay_put(word_w->
word);
1435 wr_it.add_before_stay_put(word_w);
1443 delete w_it.extract();
1444 delete wr_it.extract();
tesseract::BoxWord * box_word
static int SortByXMiddle(const void *v1, const void *v2)
BOOL8 flag(WERD_FLAGS mask) const
C_BLOB_LIST * rej_cblob_list()
C_BLOB_LIST * cblob_list()