1324 if (words->
empty()) {
1331 (*words)[0]->word->set_flag(
W_BOL,
true);
1333 (*words)[0]->word->set_blanks(input_word->
word->
space());
1343 WERD_IT w_it(
row()->
row->word_list());
1345 for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
1354 WERD_RES_IT wr_it(&
row()->word_res_list);
1355 for (wr_it.mark_cycle_pt(); !wr_it.cycled_list(); wr_it.forward()) {
1357 if (
word == input_word)
1367 for (
int w = 0; w < words->
size(); ++w) {
1371 C_BLOB_LIST* next_word_blobs =
1372 w + 1 < words->
size() ? (*words)[w + 1]->word->cblob_list() :
nullptr;
1373 ComputeBlobEnds(*word_w, next_word_blobs, &blob_ends);
1379 for (
int i = 0; i < blob_ends.
size(); ++i) {
1380 int end_x = blob_ends[i];
1383 while (!src_b_it.empty() &&
1384 src_b_it.data()->bounding_box().x_middle() < end_x) {
1385 blob_box += src_b_it.data()->bounding_box();
1386 dest_it.add_after_then_move(src_b_it.extract());
1389 while (!rej_b_it.empty() &&
1390 rej_b_it.data()->bounding_box().x_middle() < end_x) {
1391 blob_box += rej_b_it.data()->bounding_box();
1392 dest_it.add_after_then_move(rej_b_it.extract());
1398 if (i > 0 && blob_box.
left() < blob_ends[i - 1])
1399 blob_box.
set_left(blob_ends[i - 1]);
1400 if (blob_box.
right() > end_x)
1402 box_word->InsertBox(i, blob_box);
1407 for (
int i = 0; i < box_word->length(); ++i) {
1408 TBOX box = box_word->BlobBox(i);
1412 for (dest_it.mark_cycle_pt(); !dest_it.cycled_list();
1413 dest_it.forward()) {
1414 TBOX blob_box = dest_it.data()->bounding_box();
1415 if (blob_box.
left() < blob_ends[i] &&
1416 (i == 0 || blob_box.
right() >= blob_ends[i - 1])) {
1417 if (i > 0 && blob_box.
left() < blob_ends[i - 1])
1418 blob_box.
set_left(blob_ends[i - 1]);
1419 if (blob_box.
right() > blob_ends[i])
1421 box_word->ChangeBox(i, blob_box);
1432 w_it.add_before_stay_put(word_w->
word);
1435 (*words)[w] =
nullptr;
1436 wr_it.add_before_stay_put(word_w);
1444 delete w_it.extract();
1445 delete wr_it.extract();
C_BLOB_LIST * rej_cblob_list()
bool flag(WERD_FLAGS mask) const
C_BLOB_LIST * cblob_list()
static int SortByXMiddle(const void *v1, const void *v2)
tesseract::BoxWord * box_word