Class: Datalab::OcrPage
- Inherits:
-
Object
- Object
- Datalab::OcrPage
- Defined in:
- lib/datalab/ocr_page.rb
Instance Method Summary collapse
- #bounding_rectangle ⇒ Object
-
#initialize(attributes) ⇒ OcrPage
constructor
A new instance of OcrPage.
- #languages ⇒ Object
- #number ⇒ Object
- #text_lines ⇒ Object
Constructor Details
#initialize(attributes) ⇒ OcrPage
Returns a new instance of OcrPage.
3 4 5 |
# File 'lib/datalab/ocr_page.rb', line 3 def initialize( attributes ) @attributes = attributes&.dup || {} end |
Instance Method Details
#bounding_rectangle ⇒ Object
19 20 21 |
# File 'lib/datalab/ocr_page.rb', line 19 def bounding_rectangle @attributes[ :image_bbox ] end |
#languages ⇒ Object
11 12 13 |
# File 'lib/datalab/ocr_page.rb', line 11 def languages @attributes[ :languages ] end |
#number ⇒ Object
15 16 17 |
# File 'lib/datalab/ocr_page.rb', line 15 def number @attributes[ :page ] end |
#text_lines ⇒ Object
7 8 9 |
# File 'lib/datalab/ocr_page.rb', line 7 def text_lines ( @attributes[ :text_lines ] || [] ).map( &OcrTextLine.method( :new ) ) end |