Class: Mindee::V2::Product::OCR::OCRResult
- Inherits:
-
Object
- Object
- Mindee::V2::Product::OCR::OCRResult
- Defined in:
- lib/mindee/v2/product/ocr/ocr_result.rb
Overview
Result of a ocr utility inference.
Instance Attribute Summary collapse
-
#pages ⇒ Array<OCRPage>
readonly
List of OCR results for each page in the document.
Instance Method Summary collapse
-
#initialize(server_response) ⇒ OCRResult
constructor
A new instance of OCRResult.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(server_response) ⇒ OCRResult
Returns a new instance of OCRResult.
15 16 17 18 19 20 21 |
# File 'lib/mindee/v2/product/ocr/ocr_result.rb', line 15 def initialize(server_response) @pages = if server_response.key?('pages') server_response['pages'].map do |pages| OCRPage.new(pages) end end end |
Instance Attribute Details
#pages ⇒ Array<OCRPage> (readonly)
Returns List of OCR results for each page in the document.
12 13 14 |
# File 'lib/mindee/v2/product/ocr/ocr_result.rb', line 12 def pages @pages end |
Instance Method Details
#to_s ⇒ String
String representation.
25 26 27 28 29 |
# File 'lib/mindee/v2/product/ocr/ocr_result.rb', line 25 def to_s pages_str = @pages.join("\n") "Pages\n======\n#{pages_str}" end |