@@ -55,7 +55,7 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
55
55
WERD_RES *word_res;
56
56
WERD_RES_LIST fuzzy_space_words;
57
57
int16_t new_length;
58
- BOOL8 prevent_null_wd_fixsp; // DON'T process blobless wds
58
+ bool prevent_null_wd_fixsp; // DON'T process blobless wds
59
59
int32_t word_index; // current word
60
60
61
61
block_res_it.set_to_list (&page_res->block_res_list );
@@ -108,13 +108,13 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
108
108
if (check_debug_pt (word_res, 60 ))
109
109
debug_fix_space_level.set_value (10 );
110
110
if (word_res->word ->cblob_list ()->empty ())
111
- prevent_null_wd_fixsp = TRUE ;
111
+ prevent_null_wd_fixsp = true ;
112
112
word_res = word_res_it_to.forward ();
113
113
}
114
114
if (check_debug_pt (word_res, 60 ))
115
115
debug_fix_space_level.set_value (10 );
116
116
if (word_res->word ->cblob_list ()->empty ())
117
- prevent_null_wd_fixsp = TRUE ;
117
+ prevent_null_wd_fixsp = true ;
118
118
if (prevent_null_wd_fixsp) {
119
119
word_res_it_from = word_res_it_to;
120
120
} else {
@@ -148,7 +148,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
148
148
int16_t best_score;
149
149
WERD_RES_LIST current_perm;
150
150
int16_t current_score;
151
- BOOL8 improved = FALSE ;
151
+ bool improved = false ;
152
152
153
153
best_score = eval_word_spacing (best_perm); // default score
154
154
dump_words (best_perm, best_score, 1 , improved);
@@ -164,7 +164,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
164
164
best_perm.clear ();
165
165
best_perm.deep_copy (¤t_perm, &WERD_RES::deep_copy);
166
166
best_score = current_score;
167
- improved = TRUE ;
167
+ improved = true ;
168
168
}
169
169
if (current_score < PERFECT_WERDS)
170
170
transform_to_next_perm (current_perm);
@@ -246,15 +246,15 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
246
246
int16_t offset;
247
247
WERD_RES *word; // current word
248
248
int16_t prev_word_score = 0 ;
249
- BOOL8 prev_word_done = FALSE ;
250
- BOOL8 prev_char_1 = FALSE ; // prev ch a "1/I/l"?
251
- BOOL8 prev_char_digit = FALSE ; // prev ch 2..9 or 0
252
- BOOL8 current_char_1 = FALSE ;
253
- BOOL8 current_word_ok_so_far;
249
+ bool prev_word_done = false ;
250
+ bool prev_char_1 = false ; // prev ch a "1/I/l"?
251
+ bool prev_char_digit = false ; // prev ch 2..9 or 0
252
+ bool current_char_1 = false ;
253
+ bool current_word_ok_so_far;
254
254
STRING punct_chars = " !\" `',.:;" ;
255
- BOOL8 prev_char_punct = FALSE ;
256
- BOOL8 current_char_punct = FALSE ;
257
- BOOL8 word_done = FALSE ;
255
+ bool prev_char_punct = false ;
256
+ bool current_char_punct = false ;
257
+ bool word_done = false ;
258
258
259
259
do {
260
260
word = word_res_it.data ();
@@ -265,17 +265,17 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
265
265
if (prev_word_done)
266
266
done_word_count++;
267
267
prev_word_score = 0 ;
268
- prev_char_1 = FALSE ;
269
- prev_char_digit = FALSE ;
270
- prev_word_done = FALSE ;
268
+ prev_char_1 = false ;
269
+ prev_char_digit = false ;
270
+ prev_word_done = false ;
271
271
} else {
272
272
/*
273
273
Can we add the prev word score and potentially count this word?
274
274
Yes IF it didn't end in a 1 when the first char of this word is a digit
275
275
AND it didn't end in a digit when the first char of this word is a 1
276
276
*/
277
277
word_len = word->reject_map .length ();
278
- current_word_ok_so_far = FALSE ;
278
+ current_word_ok_so_far = false ;
279
279
if (!((prev_char_1 && digit_or_numeric_punct (word, 0 )) ||
280
280
(prev_char_digit && (
281
281
(word_done &&
@@ -290,16 +290,16 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
290
290
}
291
291
292
292
if (current_word_ok_so_far) {
293
- prev_word_done = TRUE ;
293
+ prev_word_done = true ;
294
294
prev_word_score = word_len;
295
295
} else {
296
- prev_word_done = FALSE ;
296
+ prev_word_done = false ;
297
297
prev_word_score = 0 ;
298
298
}
299
299
300
300
/* Add 1 to total score for every joined 1 regardless of context and
301
301
rejtn */
302
- for (i = 0 , prev_char_1 = FALSE ; i < word_len; i++) {
302
+ for (i = 0 , prev_char_1 = false ; i < word_len; i++) {
303
303
current_char_1 = word->best_choice ->unichar_string ()[i] == ' 1' ;
304
304
if (prev_char_1 || (current_char_1 && (i > 0 )))
305
305
total_score++;
@@ -309,7 +309,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
309
309
/* Add 1 to total score for every joined punctuation regardless of context
310
310
and rejtn */
311
311
if (tessedit_prefer_joined_punct) {
312
- for (i = 0 , offset = 0 , prev_char_punct = FALSE ; i < word_len;
312
+ for (i = 0 , offset = 0 , prev_char_punct = false ; i < word_len;
313
313
offset += word->best_choice ->unichar_lengths ()[i++]) {
314
314
current_char_punct =
315
315
punct_chars.contains (word->best_choice ->unichar_string ()[offset]);
@@ -340,7 +340,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
340
340
return total_score;
341
341
}
342
342
343
- BOOL8 Tesseract::digit_or_numeric_punct (WERD_RES *word, int char_position) {
343
+ bool Tesseract::digit_or_numeric_punct (WERD_RES *word, int char_position) {
344
344
int i;
345
345
int offset;
346
346
@@ -447,7 +447,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
447
447
448
448
namespace tesseract {
449
449
void Tesseract::dump_words (WERD_RES_LIST &perm, int16_t score,
450
- int16_t mode, BOOL8 improved) {
450
+ int16_t mode, bool improved) {
451
451
WERD_RES_IT word_res_it (&perm);
452
452
453
453
if (debug_fix_space_level > 0 ) {
@@ -500,9 +500,9 @@ void Tesseract::dump_words(WERD_RES_LIST &perm, int16_t score,
500
500
}
501
501
}
502
502
503
- BOOL8 Tesseract::fixspace_thinks_word_done (WERD_RES *word) {
503
+ bool Tesseract::fixspace_thinks_word_done (WERD_RES *word) {
504
504
if (word->done )
505
- return TRUE ;
505
+ return true ;
506
506
507
507
/*
508
508
Use all the standard pass 2 conditions for mode 5 in set_done() in
@@ -518,9 +518,9 @@ BOOL8 Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
518
518
(word->best_choice ->permuter () == FREQ_DAWG_PERM) ||
519
519
(word->best_choice ->permuter () == USER_DAWG_PERM) ||
520
520
(word->best_choice ->permuter () == NUMBER_PERM))) {
521
- return TRUE ;
521
+ return true ;
522
522
} else {
523
- return FALSE ;
523
+ return false ;
524
524
}
525
525
}
526
526
@@ -574,7 +574,7 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
574
574
WERD_RES_IT current_perm_it (¤t_perm);
575
575
WERD_RES *old_word_res;
576
576
int16_t current_score;
577
- BOOL8 improved = FALSE ;
577
+ bool improved = false ;
578
578
579
579
best_score = fp_eval_word_spacing (best_perm); // default score
580
580
@@ -597,7 +597,7 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
597
597
best_perm.clear ();
598
598
best_perm.deep_copy (¤t_perm, &WERD_RES::deep_copy);
599
599
best_score = current_score;
600
- improved = TRUE ;
600
+ improved = true ;
601
601
}
602
602
if (current_score < PERFECT_WERDS) {
603
603
break_noisiest_blob_word (current_perm);
@@ -794,7 +794,7 @@ float Tesseract::blob_noise_score(TBLOB *blob) {
794
794
795
795
void fixspace_dbg (WERD_RES *word) {
796
796
TBOX box = word->word ->bounding_box ();
797
- BOOL8 show_map_detail = FALSE ;
797
+ bool show_map_detail = false ;
798
798
int16_t i;
799
799
800
800
box.print ();
0 commit comments