#include <ocrpara.h>
|
| ParagraphModel (tesseract::ParagraphJustification justification, int margin, int first_indent, int body_indent, int tolerance) |
|
| ParagraphModel () |
|
bool | ValidFirstLine (int lmargin, int lindent, int rindent, int rmargin) const |
|
bool | ValidBodyLine (int lmargin, int lindent, int rindent, int rmargin) const |
|
tesseract::ParagraphJustification | justification () const |
|
int | margin () const |
|
int | first_indent () const |
|
int | body_indent () const |
|
int | tolerance () const |
|
bool | is_flush () const |
|
bool | Comparable (const ParagraphModel &other) const |
|
std::string | ToString () const |
|
Definition at line 118 of file ocrpara.h.
◆ ParagraphModel() [1/2]
Definition at line 120 of file ocrpara.h.
132 margin_ += added_margin;
133 first_indent_ -= added_margin;
134 body_indent_ -= added_margin;
tesseract::ParagraphJustification justification() const
◆ ParagraphModel() [2/2]
tesseract::ParagraphModel::ParagraphModel |
( |
| ) |
|
|
inline |
◆ body_indent()
int tesseract::ParagraphModel::body_indent |
( |
| ) |
const |
|
inline |
◆ Comparable()
bool tesseract::ParagraphModel::Comparable |
( |
const ParagraphModel & |
other | ) |
const |
Definition at line 73 of file ocrpara.cpp.
74 if (justification_ != other.justification_) {
80 int tolerance = (tolerance_ + other.tolerance_) / 4;
bool NearlyEqual(T x, T y, T tolerance)
◆ first_indent()
int tesseract::ParagraphModel::first_indent |
( |
| ) |
const |
|
inline |
Definition at line 172 of file ocrpara.h.
173 return first_indent_;
◆ is_flush()
bool tesseract::ParagraphModel::is_flush |
( |
| ) |
const |
|
inline |
Definition at line 181 of file ocrpara.h.
184 abs(first_indent_ - body_indent_) <= tolerance_;
◆ justification()
Definition at line 166 of file ocrpara.h.
167 return justification_;
◆ margin()
int tesseract::ParagraphModel::margin |
( |
| ) |
const |
|
inline |
◆ tolerance()
int tesseract::ParagraphModel::tolerance |
( |
| ) |
const |
|
inline |
◆ ToString()
std::string tesseract::ParagraphModel::ToString |
( |
| ) |
const |
Definition at line 85 of file ocrpara.cpp.
87 const char *alignment = ParagraphJustificationToString(justification_);
88 snprintf(buffer,
sizeof(buffer),
"margin: %d, first_indent: %d, body_indent: %d, alignment: %s",
89 margin_, first_indent_, body_indent_, alignment);
90 return std::string(buffer);
◆ ValidBodyLine()
bool tesseract::ParagraphModel::ValidBodyLine |
( |
int |
lmargin, |
|
|
int |
lindent, |
|
|
int |
rindent, |
|
|
int |
rmargin |
|
) |
| const |
Definition at line 59 of file ocrpara.cpp.
60 switch (justification_) {
62 return NearlyEqual(lmargin + lindent, margin_ + body_indent_, tolerance_);
64 return NearlyEqual(rmargin + rindent, margin_ + body_indent_, tolerance_);
66 return NearlyEqual(lindent, rindent, tolerance_ * 2);
◆ ValidFirstLine()
bool tesseract::ParagraphModel::ValidFirstLine |
( |
int |
lmargin, |
|
|
int |
lindent, |
|
|
int |
rindent, |
|
|
int |
rmargin |
|
) |
| const |
Definition at line 45 of file ocrpara.cpp.
46 switch (justification_) {
48 return NearlyEqual(lmargin + lindent, margin_ + first_indent_, tolerance_);
50 return NearlyEqual(rmargin + rindent, margin_ + first_indent_, tolerance_);
52 return NearlyEqual(lindent, rindent, tolerance_ * 2);
The documentation for this class was generated from the following files: