#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 1271 of file paragraphs.cpp.
1271 {
1272 for (const auto &m : *models_) {
1273 if (m->Comparable(model)) {
1274 return m;
1275 }
1276 }
1277 auto *m = new ParagraphModel(model);
1278 models_->push_back(m);
1280 return m;
1281}
void push_back_new(std::vector< T > &vector, const T &data)
◆ DiscardUnusedModels()
void tesseract::ParagraphTheory::DiscardUnusedModels |
( |
const SetOfModels & |
used_models | ) |
|
Definition at line 1283 of file paragraphs.cpp.
1283 {
1284 size_t w = 0;
1285 for (size_t r = 0; r < models_->size(); r++) {
1286 ParagraphModel *m = (*models_)[r];
1287 if (!
contains(used_models,
static_cast<const ParagraphModel *
>(m)) &&
contains(models_we_added_, m)) {
1288 delete m;
1289 } else {
1290 if (r > w) {
1291 (*models_)[w] = m;
1292 }
1293 w++;
1294 }
1295 }
1296 models_->resize(w);
1297}
bool contains(const std::vector< T > &data, const T &value)
◆ Fits()
Definition at line 1302 of file paragraphs.cpp.
1303 {
1304 for (const auto *model : *models_) {
1306 return model;
1307 }
1308 }
1309 return nullptr;
1310}
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 1320 of file paragraphs.cpp.
1320 {
1322 for (const auto *m : *models_) {
1323 if (m == model) {
1325 }
1327 }
1328 return -1;
1329}
◆ 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 1312 of file paragraphs.cpp.
1312 {
1313 for (const auto *model : *models_) {
1316 }
1317 }
1318}
The documentation for this class was generated from the following files: