#include <permute.h>
List of all members.
Detailed Description
Definition at line 113 of file permute.h.
Constructor & Destructor Documentation
tesseract::PermuterState::PermuterState |
( |
| ) |
|
Definition at line 231 of file permute.cpp.
{
adjust_factor_ = 1.0f;
allow_collision_ = false;
word_length_ = 0;
debug_ = false;
}
Member Function Documentation
void tesseract::PermuterState::AddPreference |
( |
int |
start_pos, |
|
|
char * |
pos_str, |
|
|
float |
weight |
|
) |
| |
Definition at line 266 of file permute.cpp.
{
ASSERT_HOST(start_pos + strlen(pos_str) - 1 < word_length_);
if (debug_) {
tprintf(
"Copy over %s -> %s @ %d ", pos_str, perm_state_, start_pos);
}
if (!allow_collision_) {
int len = strlen(pos_str);
for (int i = 0; i < len; ++i)
}
strncpy(&perm_state_[start_pos], pos_str, strlen(pos_str));
adjust_factor_ *= weight;
if (debug_)
tprintf(
"==> %s %f\n", perm_state_, adjust_factor_);
}
void tesseract::PermuterState::AddPreference |
( |
int |
char_pos, |
|
|
BLOB_CHOICE * |
blob_choice, |
|
|
float |
weight |
|
) |
| |
Definition at line 284 of file permute.cpp.
{
if (debug_) {
blob_choice->
unichar_id(), perm_state_, char_pos);
}
perm_state_[char_pos] = pos + '0';
adjust_factor_ *= weight;
if (debug_)
tprintf(
"==> %s %f\n", perm_state_, adjust_factor_);
}
WERD_CHOICE * tesseract::PermuterState::GetPermutedWord |
( |
float * |
certainties, |
|
|
float * |
adjust_factor |
|
) |
| |
Definition at line 303 of file permute.cpp.
{
unicharset_, *char_choices_, 0, perm_state_, certainties);
float rating = word_choice->
rating() * adjust_factor_;
*adjust_factor = adjust_factor_;
return word_choice;
}
Definition at line 240 of file permute.cpp.
{
unicharset_ = &unicharset;
char_choices_ = &char_choices;
word_length_ = char_choices.
length();
for (int i = 0; i < word_length_; ++i)
perm_state_[i] = kPosFree;
perm_state_[word_length_] = '\0';
for (int i = 0; i < word_length_; ++i) {
perm_state_[i] = '1';
}
adjust_factor_ = default_bias;
allow_collision_ = false;
debug_ = debug;
}
bool tesseract::PermuterState::position_marked |
( |
int |
pos | ) |
|
|
inline |
Definition at line 131 of file permute.h.
{ return perm_state_[pos] != kPosFree; }
void tesseract::PermuterState::set_adjust_factor |
( |
float |
factor | ) |
|
|
inline |
Definition at line 129 of file permute.h.
{ adjust_factor_ = factor; }
void tesseract::PermuterState::set_allow_collision |
( |
bool |
flag | ) |
|
|
inline |
Definition at line 128 of file permute.h.
{ allow_collision_ = flag; }
void tesseract::PermuterState::set_debug |
( |
bool |
debug | ) |
|
|
inline |
The documentation for this class was generated from the following files: