1318 if (words->
empty()) {
1325 (*words)[0]->word->set_flag(
W_BOL,
true);
1327 (*words)[0]->word->set_blanks(1);
1337 WERD_IT w_it(
row()->
row->word_list());
1339 for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
1341 if (word == input_word->
word)
1348 WERD_RES_IT wr_it(&
row()->word_res_list);
1349 for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
1351 if (word == input_word)
1361 for (
int w = 0; w < words->
size(); ++w) {
1365 C_BLOB_LIST* next_word_blobs =
1366 w + 1 < words->
size() ? (*words)[w + 1]->word->cblob_list() : NULL;
1367 ComputeBlobEnds(*word_w, next_word_blobs, &blob_ends);
1373 for (
int i = 0; i < blob_ends.
size(); ++i) {
1374 int end_x = blob_ends[i];
1377 while (!src_b_it.empty() &&
1378 src_b_it.data()->bounding_box().x_middle() < end_x) {
1379 blob_box += src_b_it.data()->bounding_box();
1380 dest_it.add_after_then_move(src_b_it.extract());
1383 while (!rej_b_it.empty() &&
1384 rej_b_it.data()->bounding_box().x_middle() < end_x) {
1385 blob_box += rej_b_it.data()->bounding_box();
1386 dest_it.add_after_then_move(rej_b_it.extract());
1392 if (i > 0 && blob_box.
left() < blob_ends[i - 1])
1393 blob_box.
set_left(blob_ends[i - 1]);
1394 if (blob_box.
right() > end_x)
1396 box_word->InsertBox(i, blob_box);
1401 for (
int i = 0; i < box_word->length(); ++i) {
1402 TBOX box = box_word->BlobBox(i);
1406 for (dest_it.mark_cycle_pt(); !dest_it.cycled_list();
1407 dest_it.forward()) {
1408 TBOX blob_box = dest_it.data()->bounding_box();
1409 if (blob_box.
left() < blob_ends[i] &&
1410 (i == 0 || blob_box.
right() >= blob_ends[i - 1])) {
1411 if (i > 0 && blob_box.
left() < blob_ends[i - 1])
1412 blob_box.
set_left(blob_ends[i - 1]);
1413 if (blob_box.
right() > blob_ends[i])
1415 box_word->ChangeBox(i, blob_box);
1426 w_it.add_before_stay_put(word_w->
word);
1430 wr_it.add_before_stay_put(word_w);
1438 delete w_it.extract();
1439 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()