Class: Kreuzberg::Result::OcrElement
- Inherits:
-
Object
- Object
- Kreuzberg::Result::OcrElement
- Defined in:
- lib/kreuzberg/result.rb
Overview
OCR text element with geometry and metadata
Instance Attribute Summary collapse
-
#backend_metadata ⇒ Object
readonly
Returns the value of attribute backend_metadata.
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#geometry ⇒ Object
readonly
Returns the value of attribute geometry.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#page_number ⇒ Object
readonly
Returns the value of attribute page_number.
-
#parent_id ⇒ Object
readonly
Returns the value of attribute parent_id.
-
#rotation ⇒ Object
readonly
Returns the value of attribute rotation.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:, geometry: nil, confidence: nil, level: nil, rotation: nil, page_number: nil, parent_id: nil, backend_metadata: nil) ⇒ OcrElement
constructor
A new instance of OcrElement.
- #to_h ⇒ Object
Constructor Details
#initialize(text:, geometry: nil, confidence: nil, level: nil, rotation: nil, page_number: nil, parent_id: nil, backend_metadata: nil) ⇒ OcrElement
Returns a new instance of OcrElement.
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/kreuzberg/result.rb', line 283 def initialize( text:, geometry: nil, confidence: nil, level: nil, rotation: nil, page_number: nil, parent_id: nil, backend_metadata: nil ) @text = text.to_s @geometry = geometry @confidence = confidence @level = level&.to_s @rotation = rotation @page_number = page_number&.to_i @parent_id = parent_id&.to_s @backend_metadata = end |
Instance Attribute Details
#backend_metadata ⇒ Object (readonly)
Returns the value of attribute backend_metadata.
280 281 282 |
# File 'lib/kreuzberg/result.rb', line 280 def @backend_metadata end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
280 281 282 |
# File 'lib/kreuzberg/result.rb', line 280 def confidence @confidence end |
#geometry ⇒ Object (readonly)
Returns the value of attribute geometry.
280 281 282 |
# File 'lib/kreuzberg/result.rb', line 280 def geometry @geometry end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
280 281 282 |
# File 'lib/kreuzberg/result.rb', line 280 def level @level end |
#page_number ⇒ Object (readonly)
Returns the value of attribute page_number.
280 281 282 |
# File 'lib/kreuzberg/result.rb', line 280 def page_number @page_number end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
280 281 282 |
# File 'lib/kreuzberg/result.rb', line 280 def parent_id @parent_id end |
#rotation ⇒ Object (readonly)
Returns the value of attribute rotation.
280 281 282 |
# File 'lib/kreuzberg/result.rb', line 280 def rotation @rotation end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
280 281 282 |
# File 'lib/kreuzberg/result.rb', line 280 def text @text end |
Instance Method Details
#to_h ⇒ Object
303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/kreuzberg/result.rb', line 303 def to_h { text: @text, geometry: @geometry&.to_h, confidence: @confidence&.to_h, level: @level, rotation: @rotation&.to_h, page_number: @page_number, parent_id: @parent_id, backend_metadata: @backend_metadata }.compact end |