class Mindee::Parsing::Standard::LocaleField

Represents locale information

def initialize(prediction, _page_id = nil)

Parameters:
  • prediction (Hash) --
def initialize(prediction, _page_id = nil)
  value_key = if !prediction.include?('value') || prediction['value'].nil?
                'language'
              else
                'value'
              end
  @confidence = prediction['confidence']
  @value = prediction[value_key]
  @language = prediction['language']
  @country = prediction['country']
  @currency = prediction['currency']
end

def to_s

Returns:
  • (String) -
def to_s
  out_str = String.new
  out_str << "#{@value}; " unless @value.nil?
  out_str << "#{@language}; " if @language
  out_str << "#{@country}; " if @country
  out_str << "#{@currency}; " if @currency
  out_str.strip
end