Class: Mindee::Parsing::Common::Extras::FullTextOCRExtra

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/parsing/common/extras/full_text_ocr_extra.rb

Overview

Full Text OCR result.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_prediction) ⇒ FullTextOCRExtra

Returns a new instance of FullTextOCRExtra.



18
19
20
21
22
23
# File 'lib/mindee/parsing/common/extras/full_text_ocr_extra.rb', line 18

def initialize(raw_prediction)
  @contents = raw_prediction['content'] if raw_prediction['content']
  return unless raw_prediction['language']

  @language = raw_prediction['language']
end

Instance Attribute Details

#contentsString? (readonly)

Contents of the full text OCR result.

Returns:

  • (String, nil)


13
14
15
# File 'lib/mindee/parsing/common/extras/full_text_ocr_extra.rb', line 13

def contents
  @contents
end

#languageString? (readonly)

Language used on the page.

Returns:

  • (String, nil)


16
17
18
# File 'lib/mindee/parsing/common/extras/full_text_ocr_extra.rb', line 16

def language
  @language
end

Instance Method Details

#to_sObject



25
26
27
# File 'lib/mindee/parsing/common/extras/full_text_ocr_extra.rb', line 25

def to_s
  @contents || ''
end