|
Tesseract
3.02
|
#include <paragraphs_internal.h>
Definition at line 100 of file paragraphs_internal.h.
| void tesseract::RowScratchRegisters::AddBodyLine | ( | const ParagraphModel * | model | ) |
Definition at line 601 of file paragraphs.cpp.
| void tesseract::RowScratchRegisters::AddStartLine | ( | const ParagraphModel * | model | ) |
Definition at line 594 of file paragraphs.cpp.
| int tesseract::RowScratchRegisters::AlignsideIndent | ( | tesseract::ParagraphJustification | just | ) | const [inline] |
Definition at line 155 of file paragraphs_internal.h.
{
switch (just) {
case tesseract::JUSTIFICATION_RIGHT: return rindent_;
case tesseract::JUSTIFICATION_LEFT: return lindent_;
default: return lindent_ > rindent_ ? lindent_ : rindent_;
}
}
| void tesseract::RowScratchRegisters::AppendDebugHeaderFields | ( | GenericVector< STRING > * | header | ) | [static] |
Definition at line 487 of file paragraphs.cpp.
| void tesseract::RowScratchRegisters::AppendDebugInfo | ( | const ParagraphTheory & | theory, |
| GenericVector< STRING > * | dbg | ||
| ) | const |
Definition at line 493 of file paragraphs.cpp.
{
char s[30];
snprintf(s, sizeof(s), "[%3d,%3d;%3d,%3d]",
lmargin_, lindent_, rindent_, rmargin_);
dbg->push_back(s);
STRING model_string;
model_string += static_cast<char>(GetLineType());
model_string += ":";
int model_numbers = 0;
for (int h = 0; h < hypotheses_.size(); h++) {
if (hypotheses_[h].model == NULL)
continue;
if (model_numbers > 0)
model_string += ",";
if (StrongModel(hypotheses_[h].model)) {
model_string += StrOf(1 + theory.IndexOf(hypotheses_[h].model));
} else if (hypotheses_[h].model == kCrownLeft) {
model_string += "CrL";
} else if (hypotheses_[h].model == kCrownRight) {
model_string += "CrR";
}
model_numbers++;
}
if (model_numbers == 0)
model_string += "0";
dbg->push_back(model_string);
}
| void tesseract::RowScratchRegisters::DiscardNonMatchingHypotheses | ( | const SetOfModels & | models | ) |
Definition at line 642 of file paragraphs.cpp.
| LineType tesseract::RowScratchRegisters::GetLineType | ( | ) | const |
Definition at line 532 of file paragraphs.cpp.
{
if (hypotheses_.empty())
return LT_UNKNOWN;
bool has_start = false;
bool has_body = false;
for (int i = 0; i < hypotheses_.size(); i++) {
switch (hypotheses_[i].ty) {
case LT_START: has_start = true; break;
case LT_BODY: has_body = true; break;
default:
tprintf("Encountered bad value in hypothesis list: %c\n",
hypotheses_[i].ty);
break;
}
}
if (has_start && has_body)
return LT_MULTIPLE;
return has_start ? LT_START : LT_BODY;
}
| LineType tesseract::RowScratchRegisters::GetLineType | ( | const ParagraphModel * | model | ) | const |
Definition at line 552 of file paragraphs.cpp.
{
if (hypotheses_.empty())
return LT_UNKNOWN;
bool has_start = false;
bool has_body = false;
for (int i = 0; i < hypotheses_.size(); i++) {
if (hypotheses_[i].model != model)
continue;
switch (hypotheses_[i].ty) {
case LT_START: has_start = true; break;
case LT_BODY: has_body = true; break;
default:
tprintf("Encountered bad value in hypothesis list: %c\n",
hypotheses_[i].ty);
break;
}
}
if (has_start && has_body)
return LT_MULTIPLE;
return has_start ? LT_START : LT_BODY;
}
| void tesseract::RowScratchRegisters::Init | ( | const RowInfo & | row | ) |
| void tesseract::RowScratchRegisters::NonNullHypotheses | ( | SetOfModels * | models | ) | const |
Definition at line 622 of file paragraphs.cpp.
| int tesseract::RowScratchRegisters::OffsideIndent | ( | tesseract::ParagraphJustification | just | ) | const [inline] |
Definition at line 146 of file paragraphs_internal.h.
{
switch (just) {
case tesseract::JUSTIFICATION_RIGHT: return lindent_;
case tesseract::JUSTIFICATION_LEFT: return rindent_;
default: return lindent_ > rindent_ ? lindent_ : rindent_;
}
}
| void tesseract::RowScratchRegisters::SetBodyLine | ( | ) |
Definition at line 584 of file paragraphs.cpp.
{
LineType current_lt = GetLineType();
if (current_lt != LT_UNKNOWN && current_lt != LT_BODY) {
tprintf("Trying to set a line to be BODY when it's already START.\n");
}
if (current_lt == LT_UNKNOWN || current_lt == LT_START) {
hypotheses_.push_back_new(LineHypothesis(LT_BODY, NULL));
}
}
| void tesseract::RowScratchRegisters::SetStartLine | ( | ) |
Definition at line 574 of file paragraphs.cpp.
{
LineType current_lt = GetLineType();
if (current_lt != LT_UNKNOWN && current_lt != LT_START) {
tprintf("Trying to set a line to be START when it's already BODY.\n");
}
if (current_lt == LT_UNKNOWN || current_lt == LT_BODY) {
hypotheses_.push_back_new(LineHypothesis(LT_START, NULL));
}
}
| void tesseract::RowScratchRegisters::SetUnknown | ( | ) | [inline] |
Definition at line 123 of file paragraphs_internal.h.
{ hypotheses_.truncate(0); }
| void tesseract::RowScratchRegisters::StartHypotheses | ( | SetOfModels * | models | ) | const |
Definition at line 608 of file paragraphs.cpp.
{
for (int h = 0; h < hypotheses_.size(); h++) {
if (hypotheses_[h].ty == LT_START && StrongModel(hypotheses_[h].model))
models->push_back_new(hypotheses_[h].model);
}
}
| void tesseract::RowScratchRegisters::StrongHypotheses | ( | SetOfModels * | models | ) | const |
Definition at line 615 of file paragraphs.cpp.
{
for (int h = 0; h < hypotheses_.size(); h++) {
if (StrongModel(hypotheses_[h].model))
models->push_back_new(hypotheses_[h].model);
}
}
| const ParagraphModel * tesseract::RowScratchRegisters::UniqueBodyHypothesis | ( | ) | const |
Definition at line 635 of file paragraphs.cpp.
| const ParagraphModel * tesseract::RowScratchRegisters::UniqueStartHypothesis | ( | ) | const |
Definition at line 629 of file paragraphs.cpp.
Definition at line 178 of file paragraphs_internal.h.
Definition at line 177 of file paragraphs_internal.h.
Definition at line 170 of file paragraphs_internal.h.
Definition at line 179 of file paragraphs_internal.h.
Definition at line 180 of file paragraphs_internal.h.