Add warning if problematic --tesseract-pagesegmode is selected

Fixes #549
This commit is contained in:
James R. Barlow
2020-04-30 04:12:11 -07:00
parent 8f5c95f0f4
commit 016dfd420c
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -276,6 +276,11 @@ def check_options_advanced(options):
"Tesseract 4.0 ignores --user-words and --user-patterns, so these "
"arguments have no effect."
)
if options.tesseract_pagesegmode in (0, 2):
log.warning(
"The --tesseract-pagesegmode argument you select will disable OCR. "
"This may cause processing to fail."
)
def check_options_metadata(options):
+6
View File
@@ -210,3 +210,9 @@ def test_version_comparison():
version_checker=lambda: '1.0',
need_version='2.0',
)
def test_pagesegmode_warning(caplog):
opts = make_opts(tesseract_pagesegmode='0')
vd.check_options_advanced(opts)
assert 'disable OCR' in caplog.text