Class: Kreuzberg::Config::OCR
- Inherits:
-
Object
- Object
- Kreuzberg::Config::OCR
- Defined in:
- lib/kreuzberg/config.rb
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#element_config ⇒ Object
readonly
Returns the value of attribute element_config.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#paddle_ocr_config ⇒ Object
readonly
Returns the value of attribute paddle_ocr_config.
-
#tesseract_config ⇒ Object
readonly
Returns the value of attribute tesseract_config.
Instance Method Summary collapse
-
#initialize(backend: 'tesseract', language: 'eng', tesseract_config: nil, paddle_ocr_config: nil, element_config: nil) ⇒ OCR
constructor
A new instance of OCR.
- #to_h ⇒ Object
Constructor Details
#initialize(backend: 'tesseract', language: 'eng', tesseract_config: nil, paddle_ocr_config: nil, element_config: nil) ⇒ OCR
Returns a new instance of OCR.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kreuzberg/config.rb', line 11 def initialize( backend: 'tesseract', language: 'eng', tesseract_config: nil, paddle_ocr_config: nil, element_config: nil ) @backend = backend.to_s @language = language.to_s @tesseract_config = normalize_tesseract_config(tesseract_config) @paddle_ocr_config = normalize_paddle_ocr_config(paddle_ocr_config) @element_config = normalize_element_config(element_config) end |
Instance Attribute Details
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
9 10 11 |
# File 'lib/kreuzberg/config.rb', line 9 def backend @backend end |
#element_config ⇒ Object (readonly)
Returns the value of attribute element_config.
9 10 11 |
# File 'lib/kreuzberg/config.rb', line 9 def element_config @element_config end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
9 10 11 |
# File 'lib/kreuzberg/config.rb', line 9 def language @language end |
#paddle_ocr_config ⇒ Object (readonly)
Returns the value of attribute paddle_ocr_config.
9 10 11 |
# File 'lib/kreuzberg/config.rb', line 9 def paddle_ocr_config @paddle_ocr_config end |
#tesseract_config ⇒ Object (readonly)
Returns the value of attribute tesseract_config.
9 10 11 |
# File 'lib/kreuzberg/config.rb', line 9 def tesseract_config @tesseract_config end |
Instance Method Details
#to_h ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/kreuzberg/config.rb', line 25 def to_h { backend: @backend, language: @language, tesseract_config: @tesseract_config&.to_h, paddle_ocr_config: @paddle_ocr_config&.to_h, element_config: @element_config&.to_h }.compact end |