Class: Mindee::V2::Product::OCR::OCRWord

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/v2/product/ocr/ocr_word.rb

Overview

OCR result for a single word extracted from the document page.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_response) ⇒ OCRWord

Returns a new instance of OCRWord.

Parameters:

  • server_response (Hash)

    Hash representation of the JSON returned by the service.



15
16
17
18
# File 'lib/mindee/v2/product/ocr/ocr_word.rb', line 15

def initialize(server_response)
  @content = server_response['content']
  @polygon = Mindee::Geometry::Polygon.new(server_response['polygon'])
end

Instance Attribute Details

#contentString (readonly)

Returns Text content of the word.

Returns:

  • (String)

    Text content of the word.



10
11
12
# File 'lib/mindee/v2/product/ocr/ocr_word.rb', line 10

def content
  @content
end

#polygonMindee::Geometry::Polygon (readonly)

Returns Position information as a list of points in clockwise order.

Returns:



12
13
14
# File 'lib/mindee/v2/product/ocr/ocr_word.rb', line 12

def polygon
  @polygon
end

Instance Method Details

#to_sString

String representation.

Returns:

  • (String)


22
23
24
# File 'lib/mindee/v2/product/ocr/ocr_word.rb', line 22

def to_s
  @content
end