Class: Mindee::V2::Product::OCR::OCRPage
- Defined in:
- lib/mindee/v2/product/ocr/ocr_page.rb,
sig/mindee/v2/product/ocr/ocr_page.rbs
Overview
OCR result for a single page.
Instance Attribute Summary collapse
-
#content ⇒ String
readonly
Full text content extracted from the document page.
-
#words ⇒ Array<OCRWord>
readonly
List of words extracted from the document page.
Instance Method Summary collapse
-
#initialize(server_response) ⇒ OCRPage
constructor
A new instance of OCRPage.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(server_response) ⇒ OCRPage
Returns a new instance of OCRPage.
17 18 19 20 |
# File 'lib/mindee/v2/product/ocr/ocr_page.rb', line 17 def initialize(server_response) @words = server_response['words'].map { |word| OCRWord.new(word) } @content = server_response['content'] end |
Instance Attribute Details
#content ⇒ String (readonly)
Returns Full text content extracted from the document page.
14 15 16 |
# File 'lib/mindee/v2/product/ocr/ocr_page.rb', line 14 def content @content end |
#words ⇒ Array<OCRWord> (readonly)
Returns List of words extracted from the document page.
12 13 14 |
# File 'lib/mindee/v2/product/ocr/ocr_page.rb', line 12 def words @words end |
Instance Method Details
#to_s ⇒ String
String representation.
24 25 26 27 28 |
# File 'lib/mindee/v2/product/ocr/ocr_page.rb', line 24 def to_s ocr_words = "\n" ocr_words += @words.join("\n\n") if @words&.any? "OCR Words\n======#{ocr_words}\n\n:Content: #{@content}" end |