Skip to content

Commit

Permalink
Expose rec_keys_path in RapidOcrOptions to support custom dictionaries
Browse files Browse the repository at this point in the history
- Added `rec_keys_path` to `RapidOcrOptions` to align with RapidOCR's capability to use custom character dictionaries.
- Passed `rec_keys_path` to `RapidOcrModel` initialization, ensuring the recognition model can load the correct dictionary (e.g., for Latin characters).

Signed-off-by: Yorick Terweijden <[email protected]>
  • Loading branch information
terwey committed Jan 23, 2025
1 parent c49b352 commit d2f9f05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions docling/datamodel/pipeline_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class RapidOcrOptions(OcrOptions):
det_model_path: Optional[str] = None # same default as rapidocr
cls_model_path: Optional[str] = None # same default as rapidocr
rec_model_path: Optional[str] = None # same default as rapidocr
rec_keys_path: Optional[str] = None # same default as rapidocr

model_config = ConfigDict(
extra="forbid",
Expand Down
1 change: 1 addition & 0 deletions docling/models/rapid_ocr_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def __init__(
det_model_path=self.options.det_model_path,
cls_model_path=self.options.cls_model_path,
rec_model_path=self.options.rec_model_path,
rec_keys_path=self.options.rec_keys_path,
)

def __call__(
Expand Down

0 comments on commit d2f9f05

Please sign in to comment.