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 NULL if the word couldn't be constructed. Returns original blobs for which no matches were found in the output list orphan_blobs (appends).
414 C_BLOB_LIST current_blob_list;
415 C_BLOB_IT werd_blobs_it(¤t_blob_list);
420 C_BLOB_LIST new_werd_blobs;
421 C_BLOB_IT new_blobs_it(&new_werd_blobs);
425 C_BLOB_LIST not_found_blobs;
426 C_BLOB_IT not_found_it(¬_found_blobs);
427 not_found_it.move_to_last();
429 werd_blobs_it.move_to_first();
430 for (werd_blobs_it.mark_cycle_pt(); !werd_blobs_it.cycled_list();
431 werd_blobs_it.forward()) {
432 C_BLOB* werd_blob = werd_blobs_it.extract();
438 C_BLOB_IT all_blobs_it(all_blobs);
439 for (all_blobs_it.mark_cycle_pt(); !all_blobs_it.cycled_list();
440 all_blobs_it.forward()) {
441 C_BLOB* a_blob = all_blobs_it.data();
446 tprintf(
"Bounding box couldn't be ascertained\n");
448 if (werd_blob_box.
contains(a_blob_box) ||
453 all_blobs_it.extract();
454 new_blobs_it.add_after_then_move(a_blob);
459 not_found_it.add_after_then_move(werd_blob);
467 not_found_it.move_to_first();
468 for (not_found_it.mark_cycle_pt(); !not_found_it.cycled_list();
469 not_found_it.forward()) {
470 C_BLOB* not_found = not_found_it.data();
472 C_BLOB_IT existing_blobs_it(new_blobs_it);
473 for (existing_blobs_it.mark_cycle_pt(); !existing_blobs_it.cycled_list();
474 existing_blobs_it.forward()) {
475 C_BLOB* a_blob = existing_blobs_it.data();
481 delete not_found_it.extract();
487 C_BLOB_IT orphan_blobs_it(orphan_blobs);
488 orphan_blobs_it.move_to_last();
489 orphan_blobs_it.add_list_after(¬_found_blobs);
493 WERD* new_werd = NULL;
494 if (!new_werd_blobs.empty()) {
495 new_werd =
new WERD(&new_werd_blobs,
this);
499 this_list_it.add_list_after(¬_found_blobs);
bool contains(const FCOORD pt) const
bool major_overlap(const TBOX &box) const
TBOX bounding_box() const
C_BLOB_LIST * cblob_list()
double y_overlap_fraction(const TBOX &box) const