class Mindee::Product::Generated::GeneratedV1Document
Generated Document V1 prediction
def initialize(raw_prediction)
-
raw_prediction
(Hash
) --
def initialize(raw_prediction) # Generated document. # raw_prediction: Dictionary containing the JSON document response super() raw_prediction.each do |field_name, field_contents| if field_contents.is_a?(Array) @fields[field_name] = Parsing::Generated::GeneratedListField.new(field_contents) elsif field_contents.is_a?(Hash) && Parsing::Generated.generated_object?(field_contents) @fields[field_name] = Parsing::Generated::GeneratedObjectField.new(field_contents) else field_contents_str = field_contents.dup if field_contents_str.key?('value') && field_contents_str['value'].nil? == false field_contents_str['value'] = field_contents_str['value'].to_s end @fields[field_name] = StringField.new(field_contents_str) end end end