Skip to content

Commit d8d2f6f

Browse files
committed
Fix broken shell scripts for training
Signed-off-by: Stefan Weil <[email protected]>
1 parent aaf8c50 commit d8d2f6f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/training/language-specific.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ set_lang_specific_parameters() {
902902
BIGRAM_DAWG_FACTOR=0.015
903903
TRAINING_DATA_ARGUMENTS=""
904904
FRAGMENTS_DISABLED="y"
905-
RUN_SHAPE_CLUSTERING=0
905+
RUN_SHAPE_CLUSTERING=false
906906
AMBIGS_FILTER_DENOMINATOR="100000"
907907
LEADING="32"
908908
MEAN_COUNT="40" # Default for latin script.

src/training/tesstrain.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ initialize_fontconfig
8181

8282
phase_I_generate_image 8
8383
phase_UP_generate_unicharset
84-
if ((LINEDATA)); then
84+
if $LINEDATA; then
8585
phase_E_extract_features " --psm 6 lstm.train " 8 "lstmf"
8686
make__lstmdata
8787
tlog "\nCreated starter traineddata for LSTM training of language '${LANG_CODE}'\n"

src/training/tesstrain_utils.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ generate_font_image() {
267267
common_args+=" --leading=${LEADING} --xsize=${X_SIZE}"
268268
common_args+=" --char_spacing=${CHAR_SPACING} --exposure=${EXPOSURE}"
269269
common_args+=" --outputbase=${outbase} --max_pages=${MAX_PAGES}"
270-
if ((DISTORT_IMAGE)); then
270+
if $DISTORT_IMAGE; then
271271
common_args+=" --distort_image "
272272
fi
273-
273+
274274
# add --writing_mode=vertical-upright to common_args if the font is
275275
# specified to be rendered vertically.
276276
for vfont in "${VERTICAL_FONTS[@]}"; do
@@ -284,7 +284,7 @@ generate_font_image() {
284284
--text=${TRAINING_TEXT} ${TEXT2IMAGE_EXTRA_ARGS:-}
285285
check_file_readable ${outbase}.box ${outbase}.tif
286286

287-
if ((EXTRACT_FONT_PROPERTIES)) &&
287+
if $EXTRACT_FONT_PROPERTIES &&
288288
[[ -r ${TRAIN_NGRAMS_FILE} ]]; then
289289
tlog "Extracting font properties of ${font}"
290290
run_command text2image ${common_args} --font="${font}" \
@@ -307,7 +307,7 @@ phase_I_generate_image() {
307307
CHAR_SPACING="0.0"
308308

309309
for EXPOSURE in $EXPOSURES; do
310-
if ((EXTRACT_FONT_PROPERTIES)) && [[ -r ${BIGRAM_FREQS_FILE} ]]; then
310+
if $EXTRACT_FONT_PROPERTIES && [[ -r ${BIGRAM_FREQS_FILE} ]]; then
311311
# Parse .bigram_freqs file and compose a .train_ngrams file with text
312312
# for tesseract to recognize during training. Take only the ngrams whose
313313
# combined weight accounts for 95% of all the bigrams in the language.
@@ -485,7 +485,7 @@ phase_C_cluster_prototypes() {
485485

486486
# Phase S : (S)hape clustering
487487
phase_S_cluster_shapes() {
488-
if ((! RUN_SHAPE_CLUSTERING)); then
488+
if ! $RUN_SHAPE_CLUSTERING; then
489489
tlog "\n=== Shape Clustering disabled ==="
490490
return
491491
fi
@@ -575,7 +575,7 @@ make__lstmdata() {
575575
--output_dir "${OUTPUT_DIR}" --lang "${LANG_CODE}" \
576576
"${pass_through}" "${lang_is_rtl}"
577577

578-
if ((SAVE_BOX_TIFF)); then
578+
if $SAVE_BOX_TIFF; then
579579
tlog "\n=== Saving box/tiff pairs for training data ==="
580580
for f in "${TRAINING_DIR}/${LANG_CODE}".*.box; do
581581
tlog "Moving ${f} to ${OUTPUT_DIR}"
@@ -620,7 +620,7 @@ make__traineddata() {
620620
mkdir -p ${OUTPUT_DIR}
621621
fi
622622
local destfile=${OUTPUT_DIR}/${LANG_CODE}.traineddata;
623-
if [[ -f ${destfile} ]] && ((! OVERWRITE)); then
623+
if [[ -f ${destfile} ]] && ! $OVERWRITE; then
624624
err_exit "File ${destfile} exists and no --overwrite specified";
625625
fi
626626
tlog "Moving ${TRAINING_DIR}/${LANG_CODE}.traineddata to ${OUTPUT_DIR}"

0 commit comments

Comments
 (0)