This method returns a new werd constructed using the blobs in the input all_blobs list, which correspond to the blobs in this werd object. The blobs used to construct the new word are consumed and removed from the input all_blobs list. Returns nullptr if the word couldn't be constructed. Returns original blobs for which no matches were found in the output list orphan_blobs (appends).
413 C_BLOB_LIST current_blob_list;
414 C_BLOB_IT werd_blobs_it(¤t_blob_list);
419 C_BLOB_LIST new_werd_blobs;
420 C_BLOB_IT new_blobs_it(&new_werd_blobs);
424 C_BLOB_LIST not_found_blobs;
425 C_BLOB_IT not_found_it(¬_found_blobs);
426 not_found_it.move_to_last();
428 werd_blobs_it.move_to_first();
429 for (werd_blobs_it.mark_cycle_pt(); !werd_blobs_it.cycled_list();
430 werd_blobs_it.forward()) {
431 C_BLOB* werd_blob = werd_blobs_it.extract();
437 C_BLOB_IT all_blobs_it(all_blobs);
438 for (all_blobs_it.mark_cycle_pt(); !all_blobs_it.cycled_list();
439 all_blobs_it.forward()) {
440 C_BLOB* a_blob = all_blobs_it.data();
445 tprintf(
"Bounding box couldn't be ascertained\n");
447 if (werd_blob_box.
contains(a_blob_box) ||
452 all_blobs_it.extract();
453 new_blobs_it.add_after_then_move(a_blob);
458 not_found_it.add_after_then_move(werd_blob);
466 not_found_it.move_to_first();
467 for (not_found_it.mark_cycle_pt(); !not_found_it.cycled_list();
468 not_found_it.forward()) {
469 C_BLOB* not_found = not_found_it.data();
471 C_BLOB_IT existing_blobs_it(new_blobs_it);
472 for (existing_blobs_it.mark_cycle_pt(); !existing_blobs_it.cycled_list();
473 existing_blobs_it.forward()) {
474 C_BLOB* a_blob = existing_blobs_it.data();
480 delete not_found_it.extract();
486 C_BLOB_IT orphan_blobs_it(orphan_blobs);
487 orphan_blobs_it.move_to_last();
488 orphan_blobs_it.add_list_after(¬_found_blobs);
492 WERD* new_werd =
nullptr;
493 if (!new_werd_blobs.empty()) {
494 new_werd =
new WERD(&new_werd_blobs,
this);
498 this_list_it.add_list_after(¬_found_blobs);
double y_overlap_fraction(const TBOX &box) const
bool major_overlap(const TBOX &box) const
DLLSYM void tprintf(const char *format,...)
C_BLOB_LIST * cblob_list()
TBOX bounding_box() const
bool contains(const FCOORD pt) const