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)


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

def initialize(prediction)
  @mvision_v1 = MVisionV1.new(prediction['mvision-v1'])
end

Instance Attribute Details

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

Mindee Vision v1 results.



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

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:



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

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

#to_sString

Returns:

  • (String)


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

def to_s
  @mvision_v1.to_s
end