24#ifndef DISABLED_LEGACY_ENGINE
35#define CTRL_NEWLINE '\012'
36#define CTRL_HARDLINE '\015'
47 block_of_last_word =
nullptr;
48 while (page_res_it.
word() !=
nullptr) {
51 if (target_word_box) {
53 FCOORD center_pt((current_word_box.
right() + current_word_box.
left()) / 2,
54 (current_word_box.
bottom() + current_word_box.
top()) / 2);
55 if (!target_word_box->
contains(center_pt)) {
60 if (tessedit_write_block_separators && block_of_last_word != page_res_it.
block()) {
61 block_of_last_word = page_res_it.
block();
65 (tessedit_write_block_separators && (page_res_it.
block() != page_res_it.
next_block())) ||
104 bool need_reject =
false;
108 !tessedit_zero_kelvin_rejection && !tessedit_word_for_word) {
176 if (tessedit_rejection_debug) {
181 if (tessedit_zero_rejection) {
189 if (tessedit_minimal_rejection) {
222 if (next_word ==
nullptr || next_block ==
nullptr || block != next_block) {
225 if (next_word->
space() > 0) {
232 end_gap = block_box.
right() - word_box.
right();
233 end_gap -=
static_cast<int32_t
>(block->
space());
234 width = next_box.
right() - next_box.
left();
253 if (i < word->reject_map.length()) {
277 if (suspect_level == 0) {
278 for (
i = 0;
i < len;
i++) {
280 word_res->
reject_map[
i].setrej_minimal_rej_accept();
286 if (suspect_level >= 3) {
294 for (
i = 0;
i < len; ++
i) {
296 word_res->
reject_map[
i].setrej_minimal_rej_accept();
303 if (rating_per_ch >= suspect_rating_per_ch) {
307 if ((word_res->
tess_accepted) || (rating_per_ch < suspect_accept_rating)) {
309 for (
i = 0;
i < len; ++
i) {
311 word_res->
reject_map[
i].setrej_minimal_rej_accept();
316 for (
i = 0;
i < len;
i++) {
319 word_res->
reject_map[
i].setrej_minimal_rej_accept();
322 word_res->
reject_map[
i].setrej_minimal_rej_accept();
325 word_res->
reject_map[
i].setrej_minimal_rej_accept();
330 if (suspect_level == 2) {
334 if (!suspect_constrain_1Il || (word_res->
reject_map.
length() <= suspect_short_words)) {
335 for (
i = 0;
i < len;
i++) {
339 word_res->
reject_map[
i].setrej_minimal_rej_accept();
343 word_res->
reject_map[
i].setrej_minimal_rej_accept();
353 for (
i = 0;
i < len;
i++) {
358 word_res->
reject_map[
i].setrej_minimal_rej_accept();
367 for (
unsigned i = 0;
i < word.
length(); ++
i) {
377 for (
unsigned i = 0;
i < word.
length(); ++
i) {
387 bool prev_digit =
false;
389 if (*lengths == 1 && *s ==
'(') {
393 if (*lengths == 1 && ((*s ==
'$') || (*s ==
'.') || (*s ==
'+') || (*s ==
'-'))) {
397 for (; *s !=
'\0'; s += *(lengths++)) {
400 }
else if (prev_digit && (*lengths == 1 && ((*s ==
'.') || (*s ==
',') || (*s ==
'-')))) {
402 }
else if (prev_digit && *lengths == 1 && (*(s + *lengths) ==
'\0') &&
403 ((*s ==
'%') || (*s ==
')'))) {
405 }
else if (prev_digit && *lengths == 1 && (*s ==
'%') &&
406 (*(lengths + 1) == 1 && *(s + *lengths) ==
')') &&
407 (*(s + *lengths + *(lengths + 1)) ==
'\0')) {
@ AC_UNACCEPTABLE
Unacceptable word.
@ W_REP_CHAR
repeated character
@ W_FUZZY_NON
fuzzy nonspace
void tprintf(const char *format,...)
char determine_newline_type(WERD *word, BLOCK *block, WERD *next_word, BLOCK *next_block)
bool tilde_crunch_written
bool write_results_empty_block
bool last_char_was_newline
bool acceptable_number_string(const char *s, const char *lengths)
int16_t count_alphanums(const WERD_CHOICE &word)
void set_unlv_suspects(WERD_RES *word)
ACCEPTABLE_WERD_TYPE acceptable_word_string(const UNICHARSET &char_set, const char *s, const char *lengths)
void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box)
int16_t safe_dict_word(const WERD_RES *werd_res)
int16_t count_alphas(const WERD_CHOICE &word)
void write_results(PAGE_RES_IT &page_res_it, char newline_type, bool force_eol)
bool check_debug_pt(WERD_RES *word, int location)
UNICHAR_ID get_rep_char(WERD_RES *word)
PDBLK pdblk
Page Description Block.
int16_t space() const
return spacing
WERD_CHOICE * best_choice
CRUNCH_MODE unlv_crunch_mode
const UNICHARSET * uch_set
void MergeAdjacentBlobs(unsigned index)
BLOCK_RES * block() const
BLOCK_RES * next_block() const
WERD_RES * next_word() const
WERD_RES * restart_page()
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
std::string debug_string() const
UNICHAR_ID unichar_id(unsigned index) const
const UNICHARSET * unicharset() const
const std::string & unichar_lengths() const
std::string & unichar_string()
TDimension bottom() const
bool contains(const FCOORD pt) const
bool flag(WERD_FLAGS mask) const
TBOX bounding_box() const
bool get_isalpha(UNICHAR_ID unichar_id) const
bool get_isdigit(UNICHAR_ID unichar_id) const
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
bool eq(UNICHAR_ID unichar_id, const char *const unichar_repr) const
int dict_word(const WERD_CHOICE &word)