Class: Retab::ExtractionConsensus
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::ExtractionConsensus
- Defined in:
- lib/retab/extractions/extraction_consensus.rb
Constant Summary collapse
- HASH_ATTRS =
{ choices: :choices, likelihoods: :likelihoods }.freeze
Instance Attribute Summary collapse
-
#choices ⇒ Object
Returns the value of attribute choices.
-
#likelihoods ⇒ Object
Returns the value of attribute likelihoods.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ ExtractionConsensus
constructor
A new instance of ExtractionConsensus.
Methods inherited from Types::BaseModel
#inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ ExtractionConsensus
Returns a new instance of ExtractionConsensus.
17 18 19 20 21 |
# File 'lib/retab/extractions/extraction_consensus.rb', line 17 def initialize(json) hash = self.class.normalize(json) @choices = (hash[:choices] || []).map { |item| item || {} } @likelihoods = hash[:likelihoods] || {} end |
Instance Attribute Details
#choices ⇒ Object
Returns the value of attribute choices.
13 14 15 |
# File 'lib/retab/extractions/extraction_consensus.rb', line 13 def choices @choices end |
#likelihoods ⇒ Object
Returns the value of attribute likelihoods.
13 14 15 |
# File 'lib/retab/extractions/extraction_consensus.rb', line 13 def likelihoods @likelihoods end |