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

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/v1/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)


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

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

Instance Attribute Details

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

Mindee Vision v1 results.



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

def mvision_v1
  @mvision_v1
end

Instance Method Details

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

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

Parameters:

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

    Polygon or bounding box where the reconstruction

  • 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:



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

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

#to_sString

Returns:

  • (String)


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

def to_s
  @mvision_v1.to_s
end