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.



271
272
273
274
# File 'lib/kreuzberg/result.rb', line 271

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.



269
270
271
# File 'lib/kreuzberg/result.rb', line 269

def detection
  @detection
end

#recognitionObject (readonly)

Returns the value of attribute recognition.



269
270
271
# File 'lib/kreuzberg/result.rb', line 269

def recognition
  @recognition
end

Instance Method Details

#to_hObject



276
277
278
279
280
281
# File 'lib/kreuzberg/result.rb', line 276

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