#include <tess_lang_mod_edge.h>
List of all members.
Detailed Description
Definition at line 68 of file tess_lang_mod_edge.h.
Constructor & Destructor Documentation
Definition at line 41 of file tess_lang_mod_edge.cpp.
{
root_ = false;
cntxt_ = cntxt;
dawg_ = dawg;
start_edge_ = edge_idx;
end_edge_ = edge_idx;
edge_mask_ = 0;
class_id_ = class_id;
path_cost_ = Cost();
}
Definition at line 55 of file tess_lang_mod_edge.cpp.
{
root_ = false;
cntxt_ = cntxt;
dawg_ = dawg;
start_edge_ = start_edge_idx;
end_edge_ = end_edge_idx;
edge_mask_ = 0;
class_id_ = class_id;
path_cost_ = Cost();
}
tesseract::TessLangModEdge::TessLangModEdge |
( |
CubeRecoContext * |
cntxt, |
|
|
int |
class_id |
|
) |
| |
Definition at line 28 of file tess_lang_mod_edge.cpp.
{
root_ = false;
cntxt_ = cntxt;
start_edge_ = 0;
end_edge_ = 0;
edge_mask_ = 0;
class_id_ = class_id;
path_cost_ = Cost();
}
tesseract::TessLangModEdge::~TessLangModEdge |
( |
| ) |
|
|
inline |
Member Function Documentation
int tesseract::TessLangModEdge::ClassID |
( |
| ) |
const |
|
inlinevirtual |
Definition at line 104 of file tess_lang_mod_edge.cpp.
{
int edge_cnt = 0;
dawg->unichar_ids_of(parent_node, &vec);
for (int i = 0; i < vec.size(); ++i) {
const NodeChild &child = vec[i];
if (child.unichar_id == INVALID_UNICHAR_ID) continue;
edge_array[edge_cnt] =
if (edge_array[edge_cnt] !=
NULL) edge_cnt++;
}
return edge_cnt;
}
char * tesseract::TessLangModEdge::Description |
( |
| ) |
const |
|
virtual |
Implements tesseract::LangModEdge.
Definition at line 69 of file tess_lang_mod_edge.cpp.
{
char *char_ptr = new char[256];
if (!char_ptr) {
}
char dawg_str[256];
char edge_str[32];
strcpy(dawg_str, "OOD");
strcpy(dawg_str, "NUM");
}
else if (dawg_->
permuter() == SYSTEM_DAWG_PERM) {
strcpy(dawg_str, "Main");
}
else if (dawg_->
permuter() == USER_DAWG_PERM) {
strcpy(dawg_str, "User");
}
else if (dawg_->
permuter() == DOC_DAWG_PERM) {
strcpy(dawg_str, "Doc");
} else {
strcpy(dawg_str, "N/A");
}
sprintf(edge_str, "%d", static_cast<int>(start_edge_));
strcat(edge_str, "-LP");
}
strcat(edge_str, "-TP");
}
sprintf(char_ptr, "%s(%s)%s, Wtd Dawg Cost=%d",
dawg_str, edge_str,
IsEOW() ?
"-EOW-" :
"", path_cost_);
return char_ptr;
}
EDGE_REF tesseract::TessLangModEdge::EdgeMask |
( |
| ) |
const |
|
inline |
const char_32* tesseract::TessLangModEdge::EdgeString |
( |
| ) |
const |
|
inlinevirtual |
EDGE_REF tesseract::TessLangModEdge::EndEdge |
( |
| ) |
const |
|
inline |
const Dawg* tesseract::TessLangModEdge::GetDawg |
( |
| ) |
const |
|
inline |
unsigned int tesseract::TessLangModEdge::Hash |
( |
| ) |
const |
|
inlinevirtual |
Implements tesseract::LangModEdge.
Definition at line 178 of file tess_lang_mod_edge.h.
{
return static_cast<unsigned int>(((start_edge_ | end_edge_) ^
((reinterpret_cast<unsigned long int>(dawg_)))) ^
((unsigned int)edge_mask_) ^
class_id_);
}
bool tesseract::TessLangModEdge::IsEOW |
( |
| ) |
const |
|
inlinevirtual |
bool tesseract::TessLangModEdge::IsIdentical |
( |
LangModEdge * |
lang_mod_edge | ) |
const |
|
inlinevirtual |
Implements tesseract::LangModEdge.
Definition at line 189 of file tess_lang_mod_edge.h.
{
return (class_id_ ==
reinterpret_cast<TessLangModEdge *>(lang_mod_edge)->class_id_ &&
str_ == reinterpret_cast<TessLangModEdge *>(lang_mod_edge)->str_ &&
dawg_ == reinterpret_cast<TessLangModEdge *>(lang_mod_edge)->dawg_ &&
start_edge_ ==
reinterpret_cast<TessLangModEdge *>(lang_mod_edge)->start_edge_ &&
end_edge_ ==
reinterpret_cast<TessLangModEdge *>(lang_mod_edge)->end_edge_ &&
edge_mask_ ==
reinterpret_cast<TessLangModEdge *>(lang_mod_edge)->edge_mask_);
}
bool tesseract::TessLangModEdge::IsNumber |
( |
| ) |
const |
|
inline |
bool tesseract::TessLangModEdge::IsOOD |
( |
| ) |
const |
|
inlinevirtual |
bool tesseract::TessLangModEdge::IsRoot |
( |
| ) |
const |
|
inlinevirtual |
bool tesseract::TessLangModEdge::IsTerminal |
( |
| ) |
const |
|
inlinevirtual |
int tesseract::TessLangModEdge::PathCost |
( |
| ) |
const |
|
inlinevirtual |
void tesseract::TessLangModEdge::SetDawg |
( |
Dawg * |
dawg | ) |
|
|
inline |
void tesseract::TessLangModEdge::SetEdgeMask |
( |
EDGE_REF |
edge_mask | ) |
|
|
inline |
void tesseract::TessLangModEdge::SetEndEdge |
( |
EDGE_REF |
edge_idx | ) |
|
|
inline |
void tesseract::TessLangModEdge::SetRoot |
( |
bool |
flag | ) |
|
|
inlinevirtual |
void tesseract::TessLangModEdge::SetSignalWgt |
( |
int |
signal, |
|
|
double |
wgt |
|
) |
| |
|
inline |
Definition at line 144 of file tess_lang_mod_edge.h.
{
CubeTuningParams *params =
reinterpret_cast<CubeTuningParams *
>(cntxt_->
Params());
switch (signal) {
case 0:
params->SetOODWgt(wgt);
break;
case 1:
params->SetNumWgt(wgt);
break;
}
}
}
void tesseract::TessLangModEdge::SetStartEdge |
( |
EDGE_REF |
edge_idx | ) |
|
|
inline |
int tesseract::TessLangModEdge::Signal |
( |
int |
signal | ) |
|
|
inline |
Definition at line 161 of file tess_lang_mod_edge.h.
{
switch (signal) {
case 0:
break;
case 1:
break;
default:
return 0;
}
}
int tesseract::TessLangModEdge::SignalCnt |
( |
| ) |
const |
|
inline |
double tesseract::TessLangModEdge::SignalWgt |
( |
int |
signal | ) |
const |
|
inline |
Definition at line 125 of file tess_lang_mod_edge.h.
{
CubeTuningParams *params =
reinterpret_cast<CubeTuningParams *
>(cntxt_->
Params());
switch (signal) {
case 0:
return params->OODWgt();
break;
case 1:
return params->NumWgt();
break;
}
}
return 0.0;
}
EDGE_REF tesseract::TessLangModEdge::StartEdge |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: