Repository: DS4SD/docling
Issue category: Feature Request

Issue:
Specific language for easyOCR
### Question
Well, this library perform pretty good tasks, but for some cases, the languages is incorrect (in my Vietnamese language)
Just want to ask `How can I specific language parser to make result more concise?`




Hints:
the same question?
Hey, I want to work on this. Can a mentor explain me please?
"Temporary use before completion of work"
You can change language at docling/datamodel/pipeline_options.py
ocr options class is not made yet, but you can change lang: list directly and save.

class EasyOcrOptions(OcrOptions):
    kind: Literal["easyocr"] = "easyocr"
    lang: List[str] = ['ko','en']#["fr", "de", "es", "en"]
Oh i see. Thank you
EasyOCR does NOT support Hebrew. Any work-around to process Hebrew image files in Docling? Thank you.

[https://www.jaided.ai/easyocr/](https://www.jaided.ai/easyocr/)
@danhertztech Docling supports multiple OCR engines (and the possibility to also bring your own). Out-of-the-box we have already Tesseract which could cover your use case. See more here https://ds4sd.github.io/docling/installation/

Patch:
diff --git a/docling/cli/main.py b/docling/cli/main.py
index c95128ac..a2a86bf4 100644
--- a/docling/cli/main.py
+++ b/docling/cli/main.py
@@ -1,6 +1,7 @@
 import importlib
 import json
 import logging
+import re
 import time
 import warnings
 from enum import Enum
@@ -129,6 +130,12 @@ def export_documents(
     )
 
 
+def _split_list(raw: Optional[str]) -> Optional[List[str]]:
+    if raw is None:
+        return None
+    return re.split(r"[;,]", raw)
+
+
 @app.command(no_args_is_help=True)
 def convert(
     input_sources: Annotated[
@@ -163,6 +170,13 @@ def convert(
     ocr_engine: Annotated[
         OcrEngine, typer.Option(..., help="The OCR engine to use.")
     ] = OcrEngine.EASYOCR,
+    ocr_lang: Annotated[
+        Optional[str],
+        typer.Option(
+            ...,
+            help="Provide a comma-separated list of languages used by the OCR engine. Note that each OCR engine has different values for the language names.",
+        ),
+    ] = None,
     pdf_backend: Annotated[
         PdfBackend, typer.Option(..., help="The PDF backend to use.")
     ] = PdfBackend.DLPARSE_V1,
@@ -248,6 +262,10 @@ def convert(
         case _:
             raise RuntimeError(f"Unexpected OCR engine type {ocr_engine}")
 
+    ocr_lang_list = _split_list(ocr_lang)
+    if ocr_lang_list is not None:
+        ocr_options.lang = ocr_lang_list
+
     pipeline_options = PdfPipelineOptions(
         do_ocr=ocr,
         ocr_options=ocr_options,
diff --git a/docling/datamodel/pipeline_options.py b/docling/datamodel/pipeline_options.py
index 2b9d228c..6c0711cc 100644
--- a/docling/datamodel/pipeline_options.py
+++ b/docling/datamodel/pipeline_options.py
@@ -22,6 +22,7 @@ class TableStructureOptions(BaseModel):
 
 class OcrOptions(BaseModel):
     kind: str
+    lang: List[str]
     force_full_page_ocr: bool = False  # If enabled a full page OCR is always applied
     bitmap_area_threshold: float = (
         0.05  # percentage of the area for a bitmap to processed with OCR


Test patch: