#include <ltrresultiterator.h>
Definition at line 186 of file ltrresultiterator.h.
◆ ChoiceIterator()
Definition at line 376 of file ltrresultiterator.cpp.
378 word_res_ = result_it.it_->
word();
379 oemLSTM_ = word_res_->tesseract->AnyLSTMLang();
381 bool oemLegacy = word_res_->tesseract->AnyTessLang();
383 bool lstm_choice_mode = word_res_->tesseract->lstm_choice_mode;
384 rating_coefficient_ = word_res_->tesseract->lstm_rating_coefficient;
385 blanks_before_word_ = result_it.BlanksBeforeWord();
386 BLOB_CHOICE_LIST* choices =
nullptr;
387 tstep_index_ = &result_it.blob_index_;
388 if (oemLSTM_ && !word_res_->CTC_symbol_choices.empty()) {
389 if (!word_res_->CTC_symbol_choices[0].empty() &&
390 strcmp(word_res_->CTC_symbol_choices[0][0].first,
" ")) {
391 blanks_before_word_ = 0;
393 auto index = *tstep_index_;
394 index += blanks_before_word_;
395 if (index < word_res_->CTC_symbol_choices.size()) {
396 LSTM_choices_ = &word_res_->CTC_symbol_choices[index];
400 if ((oemLegacy || !lstm_choice_mode) && word_res_->ratings !=
nullptr)
401 choices = word_res_->GetBlobChoices(result_it.blob_index_);
402 if (choices !=
nullptr && !choices->empty()) {
403 choice_it_ =
new BLOB_CHOICE_IT(choices);
404 choice_it_->mark_cycle_pt();
406 choice_it_ =
nullptr;
408 if (LSTM_choices_ !=
nullptr && !LSTM_choices_->empty()) {
409 LSTM_choice_it_ = LSTM_choices_->begin();
◆ ~ChoiceIterator()
tesseract::ChoiceIterator::~ChoiceIterator |
( |
| ) |
|
◆ Confidence()
float tesseract::ChoiceIterator::Confidence |
( |
| ) |
const |
Definition at line 455 of file ltrresultiterator.cpp.
457 if (oemLSTM_ && LSTM_choices_ !=
nullptr && !LSTM_choices_->empty()) {
458 std::pair<const char*, float> choice = *LSTM_choice_it_;
459 confidence = 100 - rating_coefficient_ * choice.second;
461 if (choice_it_ ==
nullptr)
463 confidence = 100 + 5 * choice_it_->data()->certainty();
◆ GetUTF8Text()
const char * tesseract::ChoiceIterator::GetUTF8Text |
( |
| ) |
const |
Definition at line 437 of file ltrresultiterator.cpp.
438 if (oemLSTM_ && LSTM_choices_ !=
nullptr && !LSTM_choices_->empty()) {
439 std::pair<const char*, float> choice = *LSTM_choice_it_;
442 if (choice_it_ ==
nullptr)
444 UNICHAR_ID id = choice_it_->data()->unichar_id();
◆ Next()
bool tesseract::ChoiceIterator::Next |
( |
| ) |
|
Definition at line 418 of file ltrresultiterator.cpp.
419 if (oemLSTM_ && LSTM_choices_ !=
nullptr && !LSTM_choices_->empty()) {
420 if (LSTM_choice_it_ != LSTM_choices_->end() &&
421 next(LSTM_choice_it_) == LSTM_choices_->end()) {
428 if (choice_it_ ==
nullptr)
430 choice_it_->forward();
431 return !choice_it_->cycled_list();
◆ Timesteps()
std::vector< std::vector< std::pair< const char *, float > > > * tesseract::ChoiceIterator::Timesteps |
( |
| ) |
const |
The documentation for this class was generated from the following files: