#include <paragraphs_internal.h>
Definition at line 191 of file paragraphs_internal.h.
◆ ParagraphTheory()
tesseract::ParagraphTheory::ParagraphTheory |
( |
std::vector< ParagraphModel * > * |
models | ) |
|
|
inlineexplicit |
◆ AddModel()
Definition at line 1267 of file paragraphs.cpp.
1267 {
1268 for (const auto &m : *models_) {
1269 if (m->Comparable(model)) {
1270 return m;
1271 }
1272 }
1273 auto *m = new ParagraphModel(model);
1274 models_->push_back(m);
1276 return m;
1277}
void push_back_new(std::vector< T > &vector, const T &data)
◆ DiscardUnusedModels()
void tesseract::ParagraphTheory::DiscardUnusedModels |
( |
const SetOfModels & |
used_models | ) |
|
Definition at line 1279 of file paragraphs.cpp.
1279 {
1280 size_t w = 0;
1281 for (size_t r = 0; r < models_->size(); r++) {
1282 ParagraphModel *m = (*models_)[r];
1283 if (!
contains(used_models,
static_cast<const ParagraphModel *
>(m)) &&
contains(models_we_added_, m)) {
1284 delete m;
1285 } else {
1286 if (r > w) {
1287 (*models_)[w] = m;
1288 }
1289 w++;
1290 }
1291 }
1292 models_->resize(w);
1293}
bool contains(const std::vector< T > &data, const T &value)
◆ Fits()
Definition at line 1298 of file paragraphs.cpp.
1299 {
1300 for (const auto *model : *models_) {
1301 if (model->justification() != JUSTIFICATION_CENTER &&
RowsFitModel(rows, start, end, model)) {
1302 return model;
1303 }
1304 }
1305 return nullptr;
1306}
bool RowsFitModel(const std::vector< RowScratchRegisters > *rows, int start, int end, const ParagraphModel *model)
◆ IndexOf()
int tesseract::ParagraphTheory::IndexOf |
( |
const ParagraphModel * |
model | ) |
const |
Definition at line 1316 of file paragraphs.cpp.
1316 {
1317 int i = 0;
1318 for (const auto *m : *models_) {
1319 if (m == model) {
1320 return i;
1321 }
1322 i++;
1323 }
1324 return -1;
1325}
◆ models() [1/2]
std::vector< ParagraphModel * > & tesseract::ParagraphTheory::models |
( |
| ) |
|
|
inline |
◆ models() [2/2]
const std::vector< ParagraphModel * > & tesseract::ParagraphTheory::models |
( |
| ) |
const |
|
inline |
◆ NonCenteredModels()
void tesseract::ParagraphTheory::NonCenteredModels |
( |
SetOfModels * |
models | ) |
|
Definition at line 1308 of file paragraphs.cpp.
1308 {
1309 for (const auto *model : *models_) {
1310 if (model->justification() != JUSTIFICATION_CENTER) {
1312 }
1313 }
1314}
The documentation for this class was generated from the following files: