tesseract  5.0.0-alpha-619-ge9db
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 191 of file paragraphs_internal.h.

Constructor & Destructor Documentation

◆ ParagraphTheory()

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

Definition at line 195 of file paragraphs_internal.h.

197  : models_(models) {}

Member Function Documentation

◆ AddModel()

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

Definition at line 1240 of file paragraphs.cpp.

◆ DiscardUnusedModels()

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

Definition at line 1251 of file paragraphs.cpp.

1251  {
1252  for (int m = 0; m < models_->size(); m++) {
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 1265 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;

◆ IndexOf()

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

Definition at line 1284 of file paragraphs.cpp.

1289  {
1290  if (!StrongModel(model)) {

◆ models() [1/2]

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

Definition at line 197 of file paragraphs_internal.h.

197 : models_(models) {}

◆ models() [2/2]

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

Definition at line 198 of file paragraphs_internal.h.

198 { return *models_; }

◆ NonCenteredModels()

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

Definition at line 1276 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) &&

The documentation for this class was generated from the following files:
tesseract::ParagraphTheory::models
GenericVector< ParagraphModel * > & models()
Definition: paragraphs_internal.h:197
ParagraphModel
Definition: ocrpara.h:114
tesseract::RowsFitModel
bool RowsFitModel(const GenericVector< RowScratchRegisters > *rows, int start, int end, const ParagraphModel *model)
Definition: paragraphs.cpp:1826
ParagraphModel::justification
tesseract::ParagraphJustification justification() const
Definition: ocrpara.h:164
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:34
GenericVector::size
int size() const
Definition: genericvector.h:71
tesseract::JUSTIFICATION_CENTER
Definition: publictypes.h:251
tesseract::StrongModel
bool StrongModel(const ParagraphModel *model)
Definition: paragraphs_internal.h:70