Class: Mindee::Product::Cropper::CropperV1PagePrediction

Inherits:
CropperV1Document show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/cropper/cropper_v1_page.rb

Overview

Cropper V1 page prediction.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ CropperV1PagePrediction

Returns a new instance of CropperV1PagePrediction.

Parameters:

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


31
32
33
34
35
36
37
# File 'lib/mindee/product/cropper/cropper_v1_page.rb', line 31

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

Instance Attribute Details

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

List of documents found in the image.



27
28
29
# File 'lib/mindee/product/cropper/cropper_v1_page.rb', line 27

def cropping
  @cropping
end

Instance Method Details

#to_sString

Returns:

  • (String)


40
41
42
43
44
45
# File 'lib/mindee/product/cropper/cropper_v1_page.rb', line 40

def to_s
  cropping = @cropping.join("\n #{' ' * 18}")
  out_str = String.new
  out_str << "\n:Document Cropper: #{cropping}".rstrip
  out_str
end