1325 if (words->
empty()) {
1332 (*words)[0]->word->set_flag(
W_BOL,
true);
1334 (*words)[0]->word->set_blanks(1);
1344 WERD_IT w_it(
row()->
row->word_list());
1346 for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
1348 if (word == input_word->
word)
1355 WERD_RES_IT wr_it(&
row()->word_res_list);
1356 for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
1358 if (word == input_word)
1368 for (
int w = 0; w < words->
size(); ++w) {
1372 C_BLOB_LIST* next_word_blobs =
1373 w + 1 < words->
size() ? (*words)[w + 1]->word->cblob_list() : NULL;
1374 ComputeBlobEnds(*word_w, next_word_blobs, &blob_ends);
1380 for (
int i = 0; i < blob_ends.
size(); ++i) {
1381 int end_x = blob_ends[i];
1384 while (!src_b_it.empty() &&
1385 src_b_it.data()->bounding_box().x_middle() < end_x) {
1386 blob_box += src_b_it.data()->bounding_box();
1387 dest_it.add_after_then_move(src_b_it.extract());
1390 while (!rej_b_it.empty() &&
1391 rej_b_it.data()->bounding_box().x_middle() < end_x) {
1392 blob_box += rej_b_it.data()->bounding_box();
1393 dest_it.add_after_then_move(rej_b_it.extract());
1399 if (i > 0 && blob_box.
left() < blob_ends[i - 1])
1400 blob_box.
set_left(blob_ends[i - 1]);
1401 if (blob_box.
right() > end_x)
1403 box_word->InsertBox(i, blob_box);
1408 for (
int i = 0; i < box_word->length(); ++i) {
1409 TBOX box = box_word->BlobBox(i);
1413 for (dest_it.mark_cycle_pt(); !dest_it.cycled_list();
1414 dest_it.forward()) {
1415 TBOX blob_box = dest_it.data()->bounding_box();
1416 if (blob_box.
left() < blob_ends[i] &&
1417 (i == 0 || blob_box.
right() >= blob_ends[i - 1])) {
1418 if (i > 0 && blob_box.
left() < blob_ends[i - 1])
1419 blob_box.
set_left(blob_ends[i - 1]);
1420 if (blob_box.
right() > blob_ends[i])
1422 box_word->ChangeBox(i, blob_box);
1433 w_it.add_before_stay_put(word_w->
word);
1437 wr_it.add_before_stay_put(word_w);
1445 delete w_it.extract();
1446 delete wr_it.extract();
tesseract::BoxWord * box_word
BOOL8 flag(WERD_FLAGS mask) const
static int SortByXMiddle(const void *v1, const void *v2)
C_BLOB_LIST * cblob_list()
C_BLOB_LIST * rej_cblob_list()