Class: Mindee::Product::MultiReceiptsDetector::MultiReceiptsDetectorV1Document

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb

Overview

Multi Receipts Detector API version 1.1 document data.

Direct Known Subclasses

MultiReceiptsDetectorV1PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ MultiReceiptsDetectorV1Document

Returns a new instance of MultiReceiptsDetectorV1Document.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)


17
18
19
20
21
22
23
# File 'lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb', line 17

def initialize(prediction, page_id)
  super()
  @receipts = []
  prediction['receipts'].each do |item|
    @receipts.push(PositionField.new(item, page_id))
  end
end

Instance Attribute Details

#receiptsArray<Mindee::Parsing::Standard::PositionField> (readonly)

Positions of the receipts on the document.



13
14
15
# File 'lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb', line 13

def receipts
  @receipts
end

Instance Method Details

#to_sString

Returns:

  • (String)


26
27
28
29
30
31
# File 'lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb', line 26

def to_s
  receipts = @receipts.join("\n #{' ' * 18}")
  out_str = String.new
  out_str << "\n:List of Receipts: #{receipts}".rstrip
  out_str[1..].to_s
end