tesseract  4.1.1
tesseract::ParagraphTheory Class Reference

#include <paragraphs_internal.h>

Public Member Functions

 ParagraphTheory (GenericVector< ParagraphModel * > *models)
 
GenericVector< ParagraphModel * > & models ()
 
const GenericVector< ParagraphModel * > & models () const
 
const ParagraphModelAddModel (const ParagraphModel &model)
 
void DiscardUnusedModels (const SetOfModels &used_models)
 
void NonCenteredModels (SetOfModels *models)
 
const ParagraphModelFits (const GenericVector< RowScratchRegisters > *rows, int start, int end) const
 
int IndexOf (const ParagraphModel *model) const
 

Detailed Description

Definition at line 192 of file paragraphs_internal.h.

Constructor & Destructor Documentation

◆ ParagraphTheory()

tesseract::ParagraphTheory::ParagraphTheory ( GenericVector< ParagraphModel * > *  models)
inlineexplicit

Definition at line 196 of file paragraphs_internal.h.

197  : models_(models) {}

Member Function Documentation

◆ AddModel()

const ParagraphModel * tesseract::ParagraphTheory::AddModel ( const ParagraphModel model)

Definition at line 1241 of file paragraphs.cpp.

1251  {

◆ DiscardUnusedModels()

void tesseract::ParagraphTheory::DiscardUnusedModels ( const SetOfModels used_models)

Definition at line 1252 of file paragraphs.cpp.

1252  {
1253  const ParagraphModel *model = (*models_)[m];
1254  if (model->justification() != JUSTIFICATION_CENTER &&
1255  RowsFitModel(rows, start, end, model))
1256  return model;
1257  }
1258  return nullptr;
1259 }
1260 

◆ Fits()

const ParagraphModel * tesseract::ParagraphTheory::Fits ( const GenericVector< RowScratchRegisters > *  rows,
int  start,
int  end 
) const

Definition at line 1266 of file paragraphs.cpp.

1269  {
1270  for (int i = 0; i < models_->size(); i++) {
1271  if ((*models_)[i] == model)
1272  return i;
1273  }
1274  return -1;
1275 }

◆ IndexOf()

int tesseract::ParagraphTheory::IndexOf ( const ParagraphModel model) const

Definition at line 1285 of file paragraphs.cpp.

1289  {
1290  if (!StrongModel(model)) {
1291  tprintf("ValidBodyLine() should only be called with strong models!\n");

◆ models() [1/2]

GenericVector<ParagraphModel *>& tesseract::ParagraphTheory::models ( )
inline

Definition at line 198 of file paragraphs_internal.h.

198 { return *models_; }

◆ models() [2/2]

const GenericVector<ParagraphModel *>& tesseract::ParagraphTheory::models ( ) const
inline

Definition at line 199 of file paragraphs_internal.h.

199 { return *models_; }

◆ NonCenteredModels()

void tesseract::ParagraphTheory::NonCenteredModels ( SetOfModels models)

Definition at line 1277 of file paragraphs.cpp.

1278  {
1279  if (!StrongModel(model)) {
1280  tprintf("ValidFirstLine() should only be called with strong models!\n");
1281  }
1282  return StrongModel(model) &&
1283  model->ValidFirstLine(

The documentation for this class was generated from the following files:
tesseract::ParagraphTheory::NonCenteredModels
void NonCenteredModels(SetOfModels *models)
Definition: paragraphs.cpp:1277
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:35
tesseract::RowsFitModel
bool RowsFitModel(const GenericVector< RowScratchRegisters > *rows, int start, int end, const ParagraphModel *model)
Definition: paragraphs.cpp:1827
GenericVector::size
int size() const
Definition: genericvector.h:72
tesseract::ParagraphTheory::models
GenericVector< ParagraphModel * > & models()
Definition: paragraphs_internal.h:198
ParagraphModel::justification
tesseract::ParagraphJustification justification() const
Definition: ocrpara.h:164
tesseract::JUSTIFICATION_CENTER
@ JUSTIFICATION_CENTER
Definition: publictypes.h:254
tesseract::SetOfModels
GenericVectorEqEq< const ParagraphModel * > SetOfModels
Definition: paragraphs_internal.h:99
tesseract::StrongModel
bool StrongModel(const ParagraphModel *model)
Definition: paragraphs_internal.h:71
ParagraphModel
Definition: ocrpara.h:114