Class: Mindee::Parsing::Standard::Field

Inherits:
AbstractField show all
Defined in:
lib/mindee/parsing/standard/base_field.rb

Overview

Base field object.

Instance Attribute Summary collapse

Attributes inherited from AbstractField

#bounding_box, #confidence, #page_id, #polygon

Instance Method Summary collapse

Methods inherited from AbstractField

array_confidence, array_sum, float_to_string, #to_s

Constructor Details

#initialize(prediction, page_id, reconstructed: false) ⇒ Field

Returns a new instance of Field.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)
  • reconstructed (Boolean) (defaults to: false)


82
83
84
85
86
# File 'lib/mindee/parsing/standard/base_field.rb', line 82

def initialize(prediction, page_id, reconstructed: false)
  super(prediction, page_id)
  @value = prediction['value']
  @reconstructed = reconstructed
end

Instance Attribute Details

#reconstructedBoolean (readonly)

true if the field was reconstructed or computed using other fields.

Returns:

  • (Boolean)


77
78
79
# File 'lib/mindee/parsing/standard/base_field.rb', line 77

def reconstructed
  @reconstructed
end

#valueString, ... (readonly)

Returns:

  • (String, Float, Integer, Boolean)


74
75
76
# File 'lib/mindee/parsing/standard/base_field.rb', line 74

def value
  @value
end