tesseract 3.04.01

tesseract::RowScratchRegisters Class Reference

#include <paragraphs_internal.h>

List of all members.

Public Member Functions

void Init (const RowInfo &row)
LineType GetLineType () const
LineType GetLineType (const ParagraphModel *model) const
void SetStartLine ()
void SetBodyLine ()
void AddStartLine (const ParagraphModel *model)
void AddBodyLine (const ParagraphModel *model)
void SetUnknown ()
void StartHypotheses (SetOfModels *models) const
void StrongHypotheses (SetOfModels *models) const
void NonNullHypotheses (SetOfModels *models) const
void DiscardNonMatchingHypotheses (const SetOfModels &models)
const ParagraphModelUniqueStartHypothesis () const
const ParagraphModelUniqueBodyHypothesis () const
int OffsideIndent (tesseract::ParagraphJustification just) const
int AlignsideIndent (tesseract::ParagraphJustification just) const
void AppendDebugInfo (const ParagraphTheory &theory, GenericVector< STRING > *dbg) const

Static Public Member Functions

static void AppendDebugHeaderFields (GenericVector< STRING > *header)

Public Attributes

const RowInfori_
int lmargin_
int lindent_
int rindent_
int rmargin_

Detailed Description

Definition at line 100 of file paragraphs_internal.h.


Member Function Documentation

void tesseract::RowScratchRegisters::AddBodyLine ( const ParagraphModel model)

Definition at line 592 of file paragraphs.cpp.

                                                                   {
  for (int h = 0; h < hypotheses_.size(); h++) {
void tesseract::RowScratchRegisters::AddStartLine ( const ParagraphModel model)

Definition at line 585 of file paragraphs.cpp.

                                                                 {
  hypotheses_.push_back_new(LineHypothesis(LT_BODY, model));
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 478 of file paragraphs.cpp.

                                                                            {
void tesseract::RowScratchRegisters::AppendDebugInfo ( const ParagraphTheory theory,
GenericVector< STRING > *  dbg 
) const

Definition at line 484 of file paragraphs.cpp.

                   :";

  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 RowScratchRegisters::Init(const RowInfo &row) {
  ri_ = &row;
void tesseract::RowScratchRegisters::DiscardNonMatchingHypotheses ( const SetOfModels models)

Definition at line 633 of file paragraphs.cpp.

                                                    {
    if (!models.contains(hypotheses_[h].model)) {
      hypotheses_.remove(h);
    }
  }
}

// ============ Geometry based Paragraph Detection Algorithm =================

LineType tesseract::RowScratchRegisters::GetLineType ( const ParagraphModel model) const

Definition at line 543 of file paragraphs.cpp.

                                               {
    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 RowScratchRegisters::SetStartLine() {
  LineType current_lt = GetLineType();
LineType tesseract::RowScratchRegisters::GetLineType ( ) const

Definition at line 523 of file paragraphs.cpp.

                                               {
    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 RowScratchRegisters::GetLineType(const ParagraphModel *model) const {
  if (hypotheses_.empty())
void tesseract::RowScratchRegisters::Init ( const RowInfo row)

Definition at line 515 of file paragraphs.cpp.

                                                {
  if (hypotheses_.empty())
void tesseract::RowScratchRegisters::NonNullHypotheses ( SetOfModels models) const

Definition at line 613 of file paragraphs.cpp.

                                                                       {
  if (hypotheses_.size() != 1 || hypotheses_[0].ty != LT_START)
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 575 of file paragraphs.cpp.

                                                          {
    hypotheses_.push_back_new(LineHypothesis(LT_BODY, NULL));
  }
}

void RowScratchRegisters::AddStartLine(const ParagraphModel *model) {
  hypotheses_.push_back_new(LineHypothesis(LT_START, model));
void tesseract::RowScratchRegisters::SetStartLine ( )

Definition at line 565 of file paragraphs.cpp.

                                                         {
    hypotheses_.push_back_new(LineHypothesis(LT_START, NULL));
  }
}

void RowScratchRegisters::SetBodyLine() {
  LineType current_lt = GetLineType();
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 599 of file paragraphs.cpp.

                                                                    {
  for (int h = 0; h < hypotheses_.size(); h++) {
void tesseract::RowScratchRegisters::StrongHypotheses ( SetOfModels models) const

Definition at line 606 of file paragraphs.cpp.

                                                                     {
  for (int h = 0; h < hypotheses_.size(); h++) {
const ParagraphModel * tesseract::RowScratchRegisters::UniqueBodyHypothesis ( ) const

Definition at line 626 of file paragraphs.cpp.

                               {
const ParagraphModel * tesseract::RowScratchRegisters::UniqueStartHypothesis ( ) const

Definition at line 620 of file paragraphs.cpp.

                                                                      {
  if (hypotheses_.size() != 1 || hypotheses_[0].ty != LT_BODY)

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines