#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.
{
unicharset_ = NULL;
char_choices_ = NULL;
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(char_choices_ != NULL);
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)
if (position_marked(start_pos + i)) return;
}
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 |
|
) |
| |
WERD_CHOICE * tesseract::PermuterState::GetPermutedWord |
( |
float * |
certainties, |
|
|
float * |
adjust_factor |
|
) |
| |
Definition at line 240 of file permute.cpp.
{
ASSERT_HOST(char_choices.length() < MAX_PERM_LENGTH);
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) {
UNICHAR_ID unichar_id = get_top_choice_uid(char_choices.get(i));
if (unicharset.get_fragment(unichar_id) != NULL)
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: