Class: Mindee::Parsing::Common::OCR::OCR

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/parsing/common/ocr/ocr.rb

Overview

OCR extraction from the entire document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction) ⇒ OCR

Returns a new instance of OCR.

Parameters:

  • prediction (Hash)


156
157
158
# File 'lib/mindee/parsing/common/ocr/ocr.rb', line 156

def initialize(prediction)
  @mvision_v1 = Mindee::Parsing::Common::OCR::MVisionV1.new(prediction['mvision-v1'])
end

Instance Attribute Details

#mvision_v1Mindee::Parsing::Common::OCR::MVisionV1 (readonly)

Mindee Vision v1 results.



153
154
155
# File 'lib/mindee/parsing/common/ocr/ocr.rb', line 153

def mvision_v1
  @mvision_v1
end

Instance Method Details

#reconstruct_vertically(coordinates, page_id, x_margin = 0.05) ⇒ Mindee::Parsing::Common::OCR::OCRLine

Constructs a line from a column, located underneath given coordinates start

Parameters:

  • coordinates (Array<Mindee::Geometry::Point>)

    Polygon or bounding box where the reconstruction should

  • page_id (Integer)

    ID of the page to start at

  • x_margin (Float) (defaults to: 0.05)

    Margin of misalignment for the x coordinate (default 10%)

Returns:



171
172
173
# File 'lib/mindee/parsing/common/ocr/ocr.rb', line 171

def reconstruct_vertically(coordinates, page_id, x_margin = 0.05)
  @mvision_v1.reconstruct_vertically(coordinates, page_id, x_margin)
end

#to_sString

Returns:

  • (String)


161
162
163
# File 'lib/mindee/parsing/common/ocr/ocr.rb', line 161

def to_s
  @mvision_v1.to_s
end