#include <paragraphs_internal.h>
Definition at line 95 of file paragraphs_internal.h.
◆ AddBodyLine()
void tesseract::RowScratchRegisters::AddBodyLine |
( |
const ParagraphModel * |
model | ) |
|
Definition at line 637 of file paragraphs.cpp.
639 auto found = std::find(hypotheses_.begin(), hypotheses_.end(), LineHypothesis(
LT_BODY,
nullptr));
640 if (found != hypotheses_.end()) {
641 hypotheses_.erase(found);
void push_back_new(std::vector< T > &vector, const T &data)
◆ AddStartLine()
void tesseract::RowScratchRegisters::AddStartLine |
( |
const ParagraphModel * |
model | ) |
|
Definition at line 629 of file paragraphs.cpp.
631 auto found = std::find(hypotheses_.begin(), hypotheses_.end(), LineHypothesis(
LT_START,
nullptr));
632 if (found != hypotheses_.end()) {
633 hypotheses_.erase(found);
◆ AlignsideIndent()
◆ AppendDebugHeaderFields()
void tesseract::RowScratchRegisters::AppendDebugHeaderFields |
( |
std::vector< std::string > & |
header | ) |
|
|
static |
Definition at line 510 of file paragraphs.cpp.
511 header.emplace_back(
"[lmarg,lind;rind,rmarg]");
512 header.emplace_back(
"model");
◆ AppendDebugInfo()
void tesseract::RowScratchRegisters::AppendDebugInfo |
( |
const ParagraphTheory & |
theory, |
|
|
std::vector< std::string > & |
dbg |
|
) |
| const |
Definition at line 515 of file paragraphs.cpp.
520 std::string model_string;
524 int model_numbers = 0;
525 for (
const auto &hypothese : hypotheses_) {
526 if (hypothese.model ==
nullptr) {
529 if (model_numbers > 0) {
533 model_string += std::to_string(1 + theory.IndexOf(hypothese.model));
535 model_string +=
"CrL";
537 model_string +=
"CrR";
541 if (model_numbers == 0) {
545 dbg.push_back(model_string);
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 684 of file paragraphs.cpp.
685 if (models.empty()) {
688 for (
int h = hypotheses_.size() - 1; h >= 0; h--) {
689 if (!
contains(models, hypotheses_[h].model)) {
690 hypotheses_.erase(hypotheses_.begin() + h);
bool contains(const std::vector< T > &data, const T &value)
◆ GetLineType() [1/2]
LineType tesseract::RowScratchRegisters::GetLineType |
( |
| ) |
const |
Definition at line 556 of file paragraphs.cpp.
557 if (hypotheses_.empty()) {
560 bool has_start =
false;
561 bool has_body =
false;
562 for (
const auto &hypothese : hypotheses_) {
563 switch (hypothese.ty) {
571 tprintf(
"Encountered bad value in hypothesis list: %c\n", hypothese.ty);
575 if (has_start && has_body) {
void tprintf(const char *format,...)
◆ GetLineType() [2/2]
Definition at line 581 of file paragraphs.cpp.
582 if (hypotheses_.empty()) {
585 bool has_start =
false;
586 bool has_body =
false;
587 for (
const auto &hypothese : hypotheses_) {
588 if (hypothese.model != model) {
591 switch (hypothese.ty) {
599 tprintf(
"Encountered bad value in hypothesis list: %c\n", hypothese.ty);
603 if (has_start && has_body) {
◆ Init()
void tesseract::RowScratchRegisters::Init |
( |
const RowInfo & |
row | ) |
|
◆ NonNullHypotheses()
void tesseract::RowScratchRegisters::NonNullHypotheses |
( |
SetOfModels * |
models | ) |
const |
Definition at line 661 of file paragraphs.cpp.
662 for (
const auto &hypothese : hypotheses_) {
663 if (hypothese.model !=
nullptr) {
◆ OffsideIndent()
◆ SetBodyLine()
void tesseract::RowScratchRegisters::SetBodyLine |
( |
| ) |
|
Definition at line 619 of file paragraphs.cpp.
622 tprintf(
"Trying to set a line to be BODY when it's already START.\n");
◆ SetStartLine()
void tesseract::RowScratchRegisters::SetStartLine |
( |
| ) |
|
Definition at line 609 of file paragraphs.cpp.
612 tprintf(
"Trying to set a line to be START when it's already BODY.\n");
◆ SetUnknown()
void tesseract::RowScratchRegisters::SetUnknown |
( |
| ) |
|
|
inline |
◆ StartHypotheses()
void tesseract::RowScratchRegisters::StartHypotheses |
( |
SetOfModels * |
models | ) |
const |
Definition at line 645 of file paragraphs.cpp.
646 for (
const auto &hypothese : hypotheses_) {
◆ StrongHypotheses()
void tesseract::RowScratchRegisters::StrongHypotheses |
( |
SetOfModels * |
models | ) |
const |
Definition at line 653 of file paragraphs.cpp.
654 for (
const auto &hypothese : hypotheses_) {
◆ UniqueBodyHypothesis()
const ParagraphModel * tesseract::RowScratchRegisters::UniqueBodyHypothesis |
( |
| ) |
const |
Definition at line 676 of file paragraphs.cpp.
677 if (hypotheses_.size() != 1 || hypotheses_[0].ty !=
LT_BODY) {
680 return hypotheses_[0].model;
◆ UniqueStartHypothesis()
const ParagraphModel * tesseract::RowScratchRegisters::UniqueStartHypothesis |
( |
| ) |
const |
Definition at line 669 of file paragraphs.cpp.
670 if (hypotheses_.size() != 1 || hypotheses_[0].ty !=
LT_START) {
673 return hypotheses_[0].model;
◆ 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: