Tesseract  3.02
tesseract::ChoiceIterator Class Reference

#include <ltrresultiterator.h>

List of all members.

Public Member Functions

 ChoiceIterator (const LTRResultIterator &result_it)
 ~ChoiceIterator ()
bool Next ()
const char * GetUTF8Text () const
float Confidence () const

Detailed Description

Definition at line 170 of file ltrresultiterator.h.


Constructor & Destructor Documentation

tesseract::ChoiceIterator::ChoiceIterator ( const LTRResultIterator result_it) [explicit]

Definition at line 318 of file ltrresultiterator.cpp.

                                                                 {
  ASSERT_HOST(result_it.it_->word() != NULL);
  word_res_ = result_it.it_->word();
  PAGE_RES_IT res_it(*result_it.it_);
  WERD_CHOICE* best_choice = word_res_->best_choice;
  BLOB_CHOICE_LIST_CLIST* choices = best_choice->blob_choices();
  if (choices != NULL) {
    BLOB_CHOICE_LIST_C_IT blob_choices_it(choices);
    for (int blob = 0; blob < result_it.blob_index_; ++blob)
      blob_choices_it.forward();
    choice_it_ = new BLOB_CHOICE_IT(blob_choices_it.data());
    choice_it_->mark_cycle_pt();
  } else {
    choice_it_ = NULL;
  }
}
tesseract::ChoiceIterator::~ChoiceIterator ( )

Definition at line 335 of file ltrresultiterator.cpp.

                                {
  delete choice_it_;
}

Member Function Documentation

float tesseract::ChoiceIterator::Confidence ( ) const

Definition at line 359 of file ltrresultiterator.cpp.

                                       {
  if (choice_it_ == NULL)
    return 0.0f;
  float confidence = 100 + 5 * choice_it_->data()->certainty();
  if (confidence < 0.0f) confidence = 0.0f;
  if (confidence > 100.0f) confidence = 100.0f;
  return confidence;
}
const char * tesseract::ChoiceIterator::GetUTF8Text ( ) const

Definition at line 350 of file ltrresultiterator.cpp.

                                              {
  if (choice_it_ == NULL)
    return NULL;
  UNICHAR_ID id = choice_it_->data()->unichar_id();
  return word_res_->BestUTF8(id, false);
}
bool tesseract::ChoiceIterator::Next ( )

Definition at line 341 of file ltrresultiterator.cpp.

                          {
  if (choice_it_ == NULL)
    return false;
  choice_it_->forward();
  return !choice_it_->cycled_list();
}

The documentation for this class was generated from the following files: