#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.
127
131 }
132 margin_ += added_margin;
133 first_indent_ -= added_margin;
134 body_indent_ -= added_margin;
135 }
tesseract::ParagraphJustification justification() const
◆ ParagraphModel() [2/2]
tesseract::ParagraphModel::ParagraphModel |
( |
| ) |
|
|
inline |
Definition at line 137 of file ocrpara.h.
139 , margin_(0)
140 , first_indent_(0)
141 , body_indent_(0)
142 , tolerance_(0) {}
◆ body_indent()
int tesseract::ParagraphModel::body_indent |
( |
| ) |
const |
|
inline |
Definition at line 175 of file ocrpara.h.
175 {
176 return body_indent_;
177 }
◆ Comparable()
bool tesseract::ParagraphModel::Comparable |
( |
const ParagraphModel & |
other | ) |
const |
Definition at line 73 of file ocrpara.cpp.
73 {
74 if (justification_ != other.justification_) {
75 return false;
76 }
78 return true;
79 }
80 int tolerance = (tolerance_ + other.tolerance_) / 4;
83}
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.
172 {
173 return first_indent_;
174 }
◆ is_flush()
bool tesseract::ParagraphModel::is_flush |
( |
| ) |
const |
|
inline |
Definition at line 181 of file ocrpara.h.
181 {
184 abs(first_indent_ - body_indent_) <= tolerance_;
185 }
◆ justification()
Definition at line 166 of file ocrpara.h.
166 {
167 return justification_;
168 }
◆ margin()
int tesseract::ParagraphModel::margin |
( |
| ) |
const |
|
inline |
Definition at line 169 of file ocrpara.h.
169 {
170 return margin_;
171 }
◆ tolerance()
int tesseract::ParagraphModel::tolerance |
( |
| ) |
const |
|
inline |
Definition at line 178 of file ocrpara.h.
178 {
179 return tolerance_;
180 }
◆ ToString()
std::string tesseract::ParagraphModel::ToString |
( |
| ) |
const |
Definition at line 85 of file ocrpara.cpp.
85 {
86 char buffer[200];
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);
91}
◆ ValidBodyLine()
bool tesseract::ParagraphModel::ValidBodyLine |
( |
int |
lmargin, |
|
|
int |
lindent, |
|
|
int |
rindent, |
|
|
int |
rmargin |
|
) |
| const |
Definition at line 59 of file ocrpara.cpp.
59 {
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);
67 default:
68
69 return false;
70 }
71}
◆ ValidFirstLine()
bool tesseract::ParagraphModel::ValidFirstLine |
( |
int |
lmargin, |
|
|
int |
lindent, |
|
|
int |
rindent, |
|
|
int |
rmargin |
|
) |
| const |
Definition at line 45 of file ocrpara.cpp.
45 {
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);
53 default:
54
55 return false;
56 }
57}
The documentation for this class was generated from the following files:
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/ccstruct/ocrpara.h
- /media/home/debian/src/github/tesseract-ocr/tesseract/src/ccstruct/ocrpara.cpp