#include <paragraphs_internal.h>
Definition at line 103 of file paragraphs_internal.h.
◆ AddBodyLine()
void tesseract::RowScratchRegisters::AddBodyLine |
( |
const ParagraphModel * |
model | ) |
|
Definition at line 603 of file paragraphs.cpp.
603 {
604 hypotheses_.push_back_new(LineHypothesis(
LT_BODY, model));
605 int old_idx = hypotheses_.get_index(LineHypothesis(
LT_BODY,
nullptr));
606 if (old_idx >= 0)
607 hypotheses_.remove(old_idx);
608}
◆ AddStartLine()
void tesseract::RowScratchRegisters::AddStartLine |
( |
const ParagraphModel * |
model | ) |
|
Definition at line 596 of file paragraphs.cpp.
596 {
597 hypotheses_.push_back_new(LineHypothesis(
LT_START, model));
598 int old_idx = hypotheses_.get_index(LineHypothesis(
LT_START,
nullptr));
599 if (old_idx >= 0)
600 hypotheses_.remove(old_idx);
601}
◆ AlignsideIndent()
◆ AppendDebugHeaderFields()
void tesseract::RowScratchRegisters::AppendDebugHeaderFields |
( |
GenericVector< STRING > * |
header | ) |
|
|
static |
◆ AppendDebugInfo()
Definition at line 495 of file paragraphs.cpp.
496 {
497 char s[30];
498 snprintf(s, sizeof(s), "[%3d,%3d;%3d,%3d]",
503 model_string += ":";
504
505 int model_numbers = 0;
506 for (int h = 0; h < hypotheses_.size(); h++) {
507 if (hypotheses_[h].model == nullptr)
508 continue;
509 if (model_numbers > 0)
510 model_string += ",";
512 model_string += StrOf(1 + theory.IndexOf(hypotheses_[h].model));
513 }
else if (hypotheses_[h].model ==
kCrownLeft) {
514 model_string += "CrL";
516 model_string += "CrR";
517 }
518 model_numbers++;
519 }
520 if (model_numbers == 0)
521 model_string += "0";
522
524}
bool StrongModel(const ParagraphModel *model)
const ParagraphModel * kCrownLeft
const ParagraphModel * kCrownRight
LineType GetLineType() const
◆ DiscardNonMatchingHypotheses()
void tesseract::RowScratchRegisters::DiscardNonMatchingHypotheses |
( |
const SetOfModels & |
models | ) |
|
Definition at line 644 of file paragraphs.cpp.
645 {
646 if (models.empty())
647 return;
648 for (int h = hypotheses_.size() - 1; h >= 0; h--) {
649 if (!models.contains(hypotheses_[h].model)) {
650 hypotheses_.remove(h);
651 }
652 }
653}
◆ GetLineType() [1/2]
LineType tesseract::RowScratchRegisters::GetLineType |
( |
| ) |
const |
Definition at line 534 of file paragraphs.cpp.
534 {
535 if (hypotheses_.empty())
537 bool has_start = false;
538 bool has_body = false;
539 for (int i = 0; i < hypotheses_.size(); i++) {
540 switch (hypotheses_[i].ty) {
541 case LT_START: has_start =
true;
break;
542 case LT_BODY: has_body =
true;
break;
543 default:
544 tprintf(
"Encountered bad value in hypothesis list: %c\n",
545 hypotheses_[i].ty);
546 break;
547 }
548 }
549 if (has_start && has_body)
552}
DLLSYM void tprintf(const char *format,...)
◆ GetLineType() [2/2]
Definition at line 554 of file paragraphs.cpp.
554 {
555 if (hypotheses_.empty())
557 bool has_start = false;
558 bool has_body = false;
559 for (int i = 0; i < hypotheses_.size(); i++) {
560 if (hypotheses_[i].model != model)
561 continue;
562 switch (hypotheses_[i].ty) {
563 case LT_START: has_start =
true;
break;
564 case LT_BODY: has_body =
true;
break;
565 default:
566 tprintf(
"Encountered bad value in hypothesis list: %c\n",
567 hypotheses_[i].ty);
568 break;
569 }
570 }
571 if (has_start && has_body)
574}
◆ Init()
void tesseract::RowScratchRegisters::Init |
( |
const RowInfo & |
row | ) |
|
◆ NonNullHypotheses()
void tesseract::RowScratchRegisters::NonNullHypotheses |
( |
SetOfModels * |
models | ) |
const |
Definition at line 624 of file paragraphs.cpp.
624 {
625 for (int h = 0; h < hypotheses_.size(); h++) {
626 if (hypotheses_[h].model != nullptr)
627 models->push_back_new(hypotheses_[h].model);
628 }
629}
◆ OffsideIndent()
◆ SetBodyLine()
void tesseract::RowScratchRegisters::SetBodyLine |
( |
| ) |
|
Definition at line 586 of file paragraphs.cpp.
586 {
589 tprintf(
"Trying to set a line to be BODY when it's already START.\n");
590 }
592 hypotheses_.push_back_new(LineHypothesis(
LT_BODY,
nullptr));
593 }
594}
◆ SetStartLine()
void tesseract::RowScratchRegisters::SetStartLine |
( |
| ) |
|
Definition at line 576 of file paragraphs.cpp.
576 {
579 tprintf(
"Trying to set a line to be START when it's already BODY.\n");
580 }
582 hypotheses_.push_back_new(LineHypothesis(
LT_START,
nullptr));
583 }
584}
◆ SetUnknown()
void tesseract::RowScratchRegisters::SetUnknown |
( |
| ) |
|
|
inline |
◆ StartHypotheses()
void tesseract::RowScratchRegisters::StartHypotheses |
( |
SetOfModels * |
models | ) |
const |
Definition at line 610 of file paragraphs.cpp.
610 {
611 for (int h = 0; h < hypotheses_.size(); h++) {
613 models->push_back_new(hypotheses_[h].model);
614 }
615}
◆ StrongHypotheses()
void tesseract::RowScratchRegisters::StrongHypotheses |
( |
SetOfModels * |
models | ) |
const |
Definition at line 617 of file paragraphs.cpp.
617 {
618 for (int h = 0; h < hypotheses_.size(); h++) {
620 models->push_back_new(hypotheses_[h].model);
621 }
622}
◆ UniqueBodyHypothesis()
const ParagraphModel * tesseract::RowScratchRegisters::UniqueBodyHypothesis |
( |
| ) |
const |
Definition at line 637 of file paragraphs.cpp.
637 {
638 if (hypotheses_.size() != 1 || hypotheses_[0].ty !=
LT_BODY)
639 return nullptr;
640 return hypotheses_[0].model;
641}
◆ UniqueStartHypothesis()
const ParagraphModel * tesseract::RowScratchRegisters::UniqueStartHypothesis |
( |
| ) |
const |
Definition at line 631 of file paragraphs.cpp.
631 {
632 if (hypotheses_.size() != 1 || hypotheses_[0].ty !=
LT_START)
633 return nullptr;
634 return hypotheses_[0].model;
635}
◆ lindent_
int tesseract::RowScratchRegisters::lindent_ |
◆ lmargin_
int tesseract::RowScratchRegisters::lmargin_ |
◆ ri_
const RowInfo* tesseract::RowScratchRegisters::ri_ |
◆ rindent_
int tesseract::RowScratchRegisters::rindent_ |
◆ rmargin_
int tesseract::RowScratchRegisters::rmargin_ |
The documentation for this class was generated from the following files: