Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VIABLE_CHOICE_STRUCT Class Reference

#include <stopper.h>

Public Member Functions

 VIABLE_CHOICE_STRUCT ()
 
 VIABLE_CHOICE_STRUCT (int length)
 
 ~VIABLE_CHOICE_STRUCT ()
 
void Init (const WERD_CHOICE &word_choice, const PIECES_STATE &pieces_state, const float certainties[], FLOAT32 adjust_factor)
 
void SetBlobChoices (const BLOB_CHOICE_LIST_VECTOR &src_choices)
 

Public Attributes

int Length
 
float Rating
 
float Certainty
 
FLOAT32 AdjustFactor
 
bool ComposedFromCharFragments
 
CHAR_CHOICEBlob
 
BLOB_CHOICE_LIST_CLIST * blob_choices
 

Detailed Description

Definition at line 56 of file stopper.h.

Constructor & Destructor Documentation

VIABLE_CHOICE_STRUCT::VIABLE_CHOICE_STRUCT ( )

Definition at line 107 of file stopper.cpp.

107  : Length(0) {
108  Blob = NULL;
109  blob_choices = NULL;
110 }
CHAR_CHOICE * Blob
Definition: stopper.h:74
#define NULL
Definition: host.h:144
BLOB_CHOICE_LIST_CLIST * blob_choices
Definition: stopper.h:75
VIABLE_CHOICE_STRUCT::VIABLE_CHOICE_STRUCT ( int  length)
explicit

Definition at line 101 of file stopper.cpp.

102  : Length(length) {
103  Blob = new CHAR_CHOICE[length];
104  blob_choices = NULL;
105 }
CHAR_CHOICE * Blob
Definition: stopper.h:74
#define NULL
Definition: host.h:144
BLOB_CHOICE_LIST_CLIST * blob_choices
Definition: stopper.h:75
VIABLE_CHOICE_STRUCT::~VIABLE_CHOICE_STRUCT ( )

Definition at line 112 of file stopper.cpp.

112  {
113  delete []Blob;
114  if (blob_choices) {
115  blob_choices->deep_clear();
116  delete blob_choices;
117  }
118 }
CHAR_CHOICE * Blob
Definition: stopper.h:74
BLOB_CHOICE_LIST_CLIST * blob_choices
Definition: stopper.h:75

Member Function Documentation

void VIABLE_CHOICE_STRUCT::Init ( const WERD_CHOICE word_choice,
const PIECES_STATE pieces_state,
const float  certainties[],
FLOAT32  adjust_factor 
)

Definition at line 120 of file stopper.cpp.

124  {
125  this->Rating = word_choice.rating();
126  this->Certainty = word_choice.certainty();
127  this->AdjustFactor = adjust_factor;
128  this->ComposedFromCharFragments = false;
129  ASSERT_HOST(this->Length == word_choice.length());
130 
131  for (int i = 0, bw_idx = 0; i < word_choice.length(); i++, bw_idx++) {
132  int blob_width = pieces_state[bw_idx];
133  CHAR_CHOICE *blob_choice = &this->Blob[i];
134  blob_choice->Class = word_choice.unichar_id(i);
135  blob_choice->NumChunks = blob_width;
136  blob_choice->Certainty = certainties[i];
137  for (int f = 1; f < word_choice.fragment_length(i); ++f) {
138  blob_width = pieces_state[++bw_idx];
139  assert(blob_width > 0);
140  blob_choice->NumChunks += blob_width;
141  this->ComposedFromCharFragments = true;
142  }
143  }
144 }
int length() const
Definition: ratngs.h:214
CHAR_CHOICE * Blob
Definition: stopper.h:74
float certainty() const
Definition: ratngs.h:234
UNICHAR_ID Class
Definition: stopper.h:51
#define f(xc, yc)
Definition: imgscale.cpp:39
uinT16 NumChunks
Definition: stopper.h:52
bool ComposedFromCharFragments
Definition: stopper.h:73
const char fragment_length(int index) const
Definition: ratngs.h:227
FLOAT32 AdjustFactor
Definition: stopper.h:72
float Certainty
Definition: stopper.h:53
#define ASSERT_HOST(x)
Definition: errcode.h:84
const UNICHAR_ID unichar_id(int index) const
Definition: ratngs.h:220
float rating() const
Definition: ratngs.h:231
void VIABLE_CHOICE_STRUCT::SetBlobChoices ( const BLOB_CHOICE_LIST_VECTOR src_choices)

Definition at line 146 of file stopper.cpp.

147  {
148  if (blob_choices != NULL) {
149  blob_choices->deep_clear();
150  } else {
151  blob_choices = new BLOB_CHOICE_LIST_CLIST();
152  }
153  BLOB_CHOICE_LIST_C_IT list_it(blob_choices);
154 
155  for (int i = 0; i < src_choices.size(); ++i) {
156  BLOB_CHOICE_LIST *cc_list = new BLOB_CHOICE_LIST();
157  cc_list->deep_copy(src_choices[i], &BLOB_CHOICE::deep_copy);
158  list_it.add_after_then_move(cc_list);
159  }
160 }
#define NULL
Definition: host.h:144
BLOB_CHOICE_LIST_CLIST * blob_choices
Definition: stopper.h:75
int size() const
Definition: genericvector.h:59
static BLOB_CHOICE * deep_copy(const BLOB_CHOICE *src)
Definition: ratngs.h:126

Member Data Documentation

FLOAT32 VIABLE_CHOICE_STRUCT::AdjustFactor

Definition at line 72 of file stopper.h.

CHAR_CHOICE* VIABLE_CHOICE_STRUCT::Blob

Definition at line 74 of file stopper.h.

BLOB_CHOICE_LIST_CLIST* VIABLE_CHOICE_STRUCT::blob_choices

Definition at line 75 of file stopper.h.

float VIABLE_CHOICE_STRUCT::Certainty

Definition at line 71 of file stopper.h.

bool VIABLE_CHOICE_STRUCT::ComposedFromCharFragments

Definition at line 73 of file stopper.h.

int VIABLE_CHOICE_STRUCT::Length

Definition at line 69 of file stopper.h.

float VIABLE_CHOICE_STRUCT::Rating

Definition at line 70 of file stopper.h.


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