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.



251
252
253
254
# File 'lib/kreuzberg/result.rb', line 251

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.



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

def detection
  @detection
end

#recognitionObject (readonly)

Returns the value of attribute recognition.



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

def recognition
  @recognition
end

Instance Method Details

#to_hObject



256
257
258
259
260
261
# File 'lib/kreuzberg/result.rb', line 256

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