Class: Kreuzberg::Result::OcrConfidence

Inherits:
Object
  • Object
show all
Defined in:
lib/kreuzberg/result.rb

Overview

OCR confidence scores for detection and recognition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(detection: nil, recognition: nil) ⇒ OcrConfidence

Returns a new instance of OcrConfidence.



248
249
250
251
# File 'lib/kreuzberg/result.rb', line 248

def initialize(detection: nil, recognition: nil)
  @detection = detection&.to_f
  @recognition = recognition&.to_f
end

Instance Attribute Details

#detectionObject (readonly)

Returns the value of attribute detection.



246
247
248
# File 'lib/kreuzberg/result.rb', line 246

def detection
  @detection
end

#recognitionObject (readonly)

Returns the value of attribute recognition.



246
247
248
# File 'lib/kreuzberg/result.rb', line 246

def recognition
  @recognition
end

Instance Method Details

#to_hObject



253
254
255
256
257
258
# File 'lib/kreuzberg/result.rb', line 253

def to_h
  {
    detection: @detection,
    recognition: @recognition
  }.compact
end