Module: Kreuzberg::OcrBackendProtocol
- Defined in:
- lib/kreuzberg/ocr_backend_protocol.rb
Overview
Instance Method Summary collapse
-
#name ⇒ String
Unique backend identifier.
-
#process_image(image_bytes, config) ⇒ String
Process image bytes and extract text via OCR.
Instance Method Details
#name ⇒ String
Returns Unique backend identifier.
9 10 11 |
# File 'lib/kreuzberg/ocr_backend_protocol.rb', line 9 def name raise NotImplementedError, "#{self.class} must implement #name" end |
#process_image(image_bytes, config) ⇒ String
Process image bytes and extract text via OCR.
This method receives raw image data (PNG, JPEG, TIFF, etc.) and an OCR configuration hash. It must return the extracted text as a string.
The config hash contains OCR settings such as:
-
“language” [String] - Language code (e.g., “eng”, “deu”, “fra”)
-
“backend” [String] - Backend name (same as #name)
-
Additional backend-specific settings
36 37 38 |
# File 'lib/kreuzberg/ocr_backend_protocol.rb', line 36 def process_image(image_bytes, config) raise NotImplementedError, "#{self.class} must implement #process_image(image_bytes, config)" end |