docling-project / docling-project/docling.rs

ocr: accept BCP-47 language tags

Closed Beginner friendly
#388 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
72
Forks
17
Avg merge
3h 44m
Merged PRs (30d)
100

Description

Upstream canonicalized OCR language input across every engine in 9a2d947 (docling#4075, unreleased): a requested language is normalized to BCP-47 or to the engine's own native code, --ocr-lang "" reaches the engine as an empty list, and the advertised language lists were corrected to only what can be requested back.
Most of that change is per-engine mapping tables for EasyOCR, RapidOCR, Tesseract and ocrmac, which we have no analogue for. The portable part is the input surface: OcrLang::parse in crates/docling-pdf/src/ocr.rs accepts only en and ch, so en-US, eng, zh, zh-Hans all warn and silently fall back to English.
To do: canonicalize the tag before matching, map the Chinese range onto our ch model and the English range onto en, keep the warning for anything genuinely unsupported, and document the accepted spellings next to DOCLING_RS_OCR_LANG in the README.
Small and self-contained; the lowest priority of the batch.

Contributor guide

Open the contributing guide

Research direction

Start in crates/docling-pdf/src/ocr.rs at OcrLang::parse and inspect the DOCLING_RS_OCR_LANG documentation in the README. Verify how language tags are matched and how unsupported values warn, then update the accepted spellings so English and Chinese BCP-47 ranges map correctly while unsupported tags still warn. Done means the documented forms are accepted without fallback warnings and the README matches the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-vision, documentation
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.