Add argument checks for --redo-ocr

This commit is contained in:
James R. Barlow 2018-10-30 16:19:13 -07:00
parent 8b61d2d521
commit 22a7cd3421

View File

@ -477,6 +477,13 @@ def check_options_output(options, log):
lossless_reconstruction = True
options.lossless_reconstruction = lossless_reconstruction
if not options.lossless_reconstruction and options.redo_ocr:
raise argparse.ArgumentError(
None,
"--redo-ocr is not currently compatible with --deskew, "
"--clean-final, and --remove-background"
)
def check_options_sidecar(options, log):
if options.sidecar == '\0':
@ -521,10 +528,15 @@ def check_options_preprocessing(options, log):
def check_options_ocr_behavior(options, log):
if options.force_ocr and options.skip_text:
exclusive_options = sum(
[(1 if opt else 0)
for opt in (options.force_ocr, options.skip_text, options.redo_ocr)
]
)
if exclusive_options >= 2:
raise argparse.ArgumentError(
None,
"Error: --force-ocr and --skip-text are mutually exclusive.")
"Error: choose only one of --force-ocr, --skip-text, --redo-ocr.")
def check_options_optimizing(options, log):