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.
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/kreuzberg/result.rb', line 306 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.
303 304 305 |
# File 'lib/kreuzberg/result.rb', line 303 def @backend_metadata end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
303 304 305 |
# File 'lib/kreuzberg/result.rb', line 303 def confidence @confidence end |
#geometry ⇒ Object (readonly)
Returns the value of attribute geometry.
303 304 305 |
# File 'lib/kreuzberg/result.rb', line 303 def geometry @geometry end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
303 304 305 |
# File 'lib/kreuzberg/result.rb', line 303 def level @level end |
#page_number ⇒ Object (readonly)
Returns the value of attribute page_number.
303 304 305 |
# File 'lib/kreuzberg/result.rb', line 303 def page_number @page_number end |
#parent_id ⇒ Object (readonly)
Returns the value of attribute parent_id.
303 304 305 |
# File 'lib/kreuzberg/result.rb', line 303 def parent_id @parent_id end |
#rotation ⇒ Object (readonly)
Returns the value of attribute rotation.
303 304 305 |
# File 'lib/kreuzberg/result.rb', line 303 def rotation @rotation end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
303 304 305 |
# File 'lib/kreuzberg/result.rb', line 303 def text @text end |
Instance Method Details
#to_h ⇒ Object
326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/kreuzberg/result.rb', line 326 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 |