fix: add blocked language validation for osd and equ

Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
James R. Barlow
2025-12-21 12:21:48 -08:00
co-authored by aider
parent 95d9c3ed18
commit b89bb3b524
+11
View File
@@ -70,6 +70,17 @@ class ValidationCoordinator:
"The --tesseract-downsample-above argument will have no effect unless "
"--tesseract-downsample-large-images is also given."
)
# Check for blocked languages
from ocrmypdf.exceptions import BadArgsError
DENIED_LANGUAGES = {'equ', 'osd'}
if DENIED_LANGUAGES & set(options.languages):
raise BadArgsError(
"The following languages are for Tesseract's internal use and should not "
"be issued explicitly: "
f"{', '.join(DENIED_LANGUAGES & set(options.languages))}\n"
"Remove them from the -l/--language argument."
)
def _validate_optimize_options(self, options: OCROptions) -> None:
"""Validate optimization options."""