Skip to content

Add EasyOCR wrapper with rotation correction - #11

Merged
Khubaib8281 merged 1 commit into
mainfrom
feat/ocr
Sep 7, 2026
Merged

Khubaib8281 merged 1 commit into
mainfrom
feat/ocr

Conversation

@M-O-J-U

@M-O-J-U M-O-J-U commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds ocr.py: wraps EasyOCR, tries all four right-angle rotations and keeps the best-scoring result, supports configurable languages per document type.

Which module(s) does it touch?

docling_pk/ocr.py. Depends on docling_pk/preprocessor.py.

How did you test it?

Tested against a real photo shot sideways: unusable output before rotation correction, correct output after. Also tested en+ur versus English-only on certificate images, since certificates are almost entirely English text and the combined model was introducing Arabic-script noise into English words.

Edge cases handled:

No detections returns empty text and 0.0 confidence rather than raising. Language list is configurable per call, defaults to en+ur.

Checklist:

  • Tests added or updated
  • Docstrings on all new public functions
  • No unused imports
  • README updated if public API changed (no public API change, internal module)
  • Lead Engineer has reviewed and approved before submitting to director (no separate Lead on this project currently, Khubaib and Khadija are aware and approved proceeding solo)

Note: this PR was pushed earlier but the GitHub PR itself was never opened. This is the actual fix for the current CI failure (docling_pk.ocr missing from main). Recommend reviewing and merging this before PR #9 (Copilot's auto-fix).

@Khubaib8281
Khubaib8281 merged commit b258c8f into main Sep 7, 2026
1 check failed
@Khubaib8281
Khubaib8281 deleted the feat/ocr branch September 7, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants