tesseract v5.3.3.20231005
tesseract::REJMAP Class Reference

#include <rejctmap.h>

Public Member Functions

 REJMAP ()=default
 
 REJMAP (const REJMAP &rejmap)
 
REJMAPoperator= (const REJMAP &source)
 
void initialise (uint16_t length)
 
REJoperator[] (uint16_t index) const
 
uint16_t length () const
 
int16_t accept_count () const
 
int16_t reject_count () const
 
void remove_pos (uint16_t pos)
 
void print (FILE *fp) const
 
void full_print (FILE *fp) const
 
bool recoverable_rejects () const
 
bool quality_recoverable_rejects () const
 
void rej_word_small_xht ()
 
void rej_word_tess_failure ()
 
void rej_word_not_tess_accepted ()
 
void rej_word_contains_blanks ()
 
void rej_word_bad_permuter ()
 
void rej_word_xht_fixup ()
 
void rej_word_no_alphanums ()
 
void rej_word_mostly_rej ()
 
void rej_word_bad_quality ()
 
void rej_word_doc_rej ()
 
void rej_word_block_rej ()
 
void rej_word_row_rej ()
 

Detailed Description

Definition at line 310 of file rejctmap.h.

Constructor & Destructor Documentation

◆ REJMAP() [1/2]

tesseract::REJMAP::REJMAP ( )
default

◆ REJMAP() [2/2]

tesseract::REJMAP::REJMAP ( const REJMAP rejmap)
inline

Definition at line 317 of file rejctmap.h.

317 {
318 *this = rejmap;
319 }

Member Function Documentation

◆ accept_count()

int16_t tesseract::REJMAP::accept_count ( ) const

Definition at line 72 of file rejctmap.cpp.

72 { // How many accepted?
73 int16_t count = 0;
74 for (unsigned i = 0; i < len; i++) {
75 if (ptr[i].accepted()) {
76 count++;
77 }
78 }
79 return count;
80}
int * count

◆ full_print()

void tesseract::REJMAP::full_print ( FILE *  fp) const

Definition at line 120 of file rejctmap.cpp.

120 {
121 for (unsigned i = 0; i < len; i++) {
122 ptr[i].full_print(fp);
123 fprintf(fp, "\n");
124 }
125}

◆ initialise()

void tesseract::REJMAP::initialise ( uint16_t  length)

Definition at line 67 of file rejctmap.cpp.

67 {
68 ptr = std::make_unique<REJ[]>(length);
69 len = length;
70}
uint16_t length() const
Definition: rejctmap.h:333

◆ length()

uint16_t tesseract::REJMAP::length ( ) const
inline

Definition at line 333 of file rejctmap.h.

333 { // map length
334 return len;
335 }

◆ operator=()

REJMAP & tesseract::REJMAP::operator= ( const REJMAP source)

Definition at line 59 of file rejctmap.cpp.

59 {
60 initialise(source.len);
61 for (unsigned i = 0; i < len; i++) {
62 ptr[i] = source.ptr[i];
63 }
64 return *this;
65}
void initialise(uint16_t length)
Definition: rejctmap.cpp:67

◆ operator[]()

REJ & tesseract::REJMAP::operator[] ( uint16_t  index) const
inline

Definition at line 326 of file rejctmap.h.

328 {
329 ASSERT_HOST(index < len);
330 return ptr[index]; // no bounds checks
331 }
#define ASSERT_HOST(x)
Definition: errcode.h:54

◆ print()

void tesseract::REJMAP::print ( FILE *  fp) const

Definition at line 112 of file rejctmap.cpp.

112 {
113 fputc('"', fp);
114 for (unsigned i = 0; i < len; i++) {
115 fputc( ptr[i].display_char(), fp);
116 }
117 fputc('"', fp);
118}

◆ quality_recoverable_rejects()

bool tesseract::REJMAP::quality_recoverable_rejects ( ) const

Definition at line 91 of file rejctmap.cpp.

91 { // Any potential rejs?
92 for (unsigned i = 0; i < len; i++) {
93 if (ptr[i].accept_if_good_quality()) {
94 return true;
95 }
96 }
97 return false;
98}

◆ recoverable_rejects()

bool tesseract::REJMAP::recoverable_rejects ( ) const

Definition at line 82 of file rejctmap.cpp.

82 { // Any non perm rejs?
83 for (unsigned i = 0; i < len; i++) {
84 if (ptr[i].recoverable()) {
85 return true;
86 }
87 }
88 return false;
89}

◆ rej_word_bad_permuter()

void tesseract::REJMAP::rej_word_bad_permuter ( )

Definition at line 155 of file rejctmap.cpp.

155 { // Reject whole word
156 for (unsigned i = 0; i < len; i++) {
157 if (ptr[i].accepted()) {
158 ptr[i].setrej_bad_permuter();
159 }
160 }
161}

◆ rej_word_bad_quality()

void tesseract::REJMAP::rej_word_bad_quality ( )

Definition at line 187 of file rejctmap.cpp.

187 { // Reject whole word
188 for (unsigned i = 0; i < len; i++) {
189 if (ptr[i].accepted()) {
190 ptr[i].setrej_bad_quality();
191 }
192 }
193}

◆ rej_word_block_rej()

void tesseract::REJMAP::rej_word_block_rej ( )

Definition at line 203 of file rejctmap.cpp.

203 { // Reject whole word
204 for (unsigned i = 0; i < len; i++) {
205 if (ptr[i].accepted()) {
206 ptr[i].setrej_block_rej();
207 }
208 }
209}

◆ rej_word_contains_blanks()

void tesseract::REJMAP::rej_word_contains_blanks ( )

Definition at line 147 of file rejctmap.cpp.

147 { // Reject whole word
148 for (unsigned i = 0; i < len; i++) {
149 if (ptr[i].accepted()) {
150 ptr[i].setrej_contains_blanks();
151 }
152 }
153}

◆ rej_word_doc_rej()

void tesseract::REJMAP::rej_word_doc_rej ( )

Definition at line 195 of file rejctmap.cpp.

195 { // Reject whole word
196 for (unsigned i = 0; i < len; i++) {
197 if (ptr[i].accepted()) {
198 ptr[i].setrej_doc_rej();
199 }
200 }
201}

◆ rej_word_mostly_rej()

void tesseract::REJMAP::rej_word_mostly_rej ( )

Definition at line 179 of file rejctmap.cpp.

179 { // Reject whole word
180 for (unsigned i = 0; i < len; i++) {
181 if (ptr[i].accepted()) {
182 ptr[i].setrej_mostly_rej();
183 }
184 }
185}

◆ rej_word_no_alphanums()

void tesseract::REJMAP::rej_word_no_alphanums ( )

Definition at line 171 of file rejctmap.cpp.

171 { // Reject whole word
172 for (unsigned i = 0; i < len; i++) {
173 if (ptr[i].accepted()) {
174 ptr[i].setrej_no_alphanums();
175 }
176 }
177}

◆ rej_word_not_tess_accepted()

void tesseract::REJMAP::rej_word_not_tess_accepted ( )

Definition at line 139 of file rejctmap.cpp.

139 { // Reject whole word
140 for (unsigned i = 0; i < len; i++) {
141 if (ptr[i].accepted()) {
142 ptr[i].setrej_not_tess_accepted();
143 }
144 }
145}

◆ rej_word_row_rej()

void tesseract::REJMAP::rej_word_row_rej ( )

Definition at line 211 of file rejctmap.cpp.

211 { // Reject whole word
212 for (unsigned i = 0; i < len; i++) {
213 if (ptr[i].accepted()) {
214 ptr[i].setrej_row_rej();
215 }
216 }
217}

◆ rej_word_small_xht()

void tesseract::REJMAP::rej_word_small_xht ( )

Definition at line 127 of file rejctmap.cpp.

127 { // Reject whole word
128 for (unsigned i = 0; i < len; i++) {
129 ptr[i].setrej_small_xht();
130 }
131}

◆ rej_word_tess_failure()

void tesseract::REJMAP::rej_word_tess_failure ( )

Definition at line 133 of file rejctmap.cpp.

133 { // Reject whole word
134 for (unsigned i = 0; i < len; i++) {
135 ptr[i].setrej_tess_failure();
136 }
137}

◆ rej_word_xht_fixup()

void tesseract::REJMAP::rej_word_xht_fixup ( )

Definition at line 163 of file rejctmap.cpp.

163 { // Reject whole word
164 for (unsigned i = 0; i < len; i++) {
165 if (ptr[i].accepted()) {
166 ptr[i].setrej_xht_fixup();
167 }
168 }
169}

◆ reject_count()

int16_t tesseract::REJMAP::reject_count ( ) const
inline

Definition at line 339 of file rejctmap.h.

339 { // How many rejects?
340 return len - accept_count();
341 }
int16_t accept_count() const
Definition: rejctmap.cpp:72

◆ remove_pos()

void tesseract::REJMAP::remove_pos ( uint16_t  pos)

Definition at line 100 of file rejctmap.cpp.

102 {
103 ASSERT_HOST(pos < len);
104 ASSERT_HOST(len > 0);
105
106 len--;
107 for (; pos < len; pos++) {
108 ptr[pos] = ptr[pos + 1];
109 }
110}

The documentation for this class was generated from the following files: