Don't warn about --user-words in Tesseract 4.1 or later
This commit is contained in:
@@ -253,10 +253,13 @@ def check_options_advanced(options):
|
||||
"--pdfa-image-compression argument has no effect when "
|
||||
"--output-type is not 'pdfa', 'pdfa-1', or 'pdfa-2'"
|
||||
)
|
||||
if tesseract.v4(options.tesseract_env) and (
|
||||
if not tesseract.has_user_words(options.tesseract_env) and (
|
||||
options.user_words or options.user_patterns
|
||||
):
|
||||
log.warning('Tesseract 4.x ignores --user-words, so this has no effect')
|
||||
log.warning(
|
||||
"Tesseract 4.0 ignores --user-words and --user-patterns, so these "
|
||||
"arguments have no effect."
|
||||
)
|
||||
|
||||
|
||||
def check_options_metadata(options):
|
||||
|
||||
@@ -88,6 +88,15 @@ def has_textonly_pdf(tesseract_env=None):
|
||||
return False
|
||||
|
||||
|
||||
def has_user_words(tesseract_env=None):
|
||||
"""Does Tesseract have --user-words capability?
|
||||
|
||||
Not available in 4.0, but available in 4.1. Also available in 3.x, but
|
||||
we no longer support 3.x.
|
||||
"""
|
||||
return version(tesseract_env) >= '4.1'
|
||||
|
||||
|
||||
def languages(tesseract_env=None):
|
||||
def lang_error(output):
|
||||
msg = (
|
||||
|
||||
Reference in New Issue
Block a user