<commit_before>class QuestionPresenter < NodePresenter
  extend Forwardable
  delegate [
    :translate!,
    :translate_and_render,
    :translate_option
  ] => :@renderer

  def initialize(i18n_prefix, node, state = nil, options = {})
    super(i18n_prefix, node, state)
    @renderer = options[:renderer] || SmartAnswer::I18nRenderer.new(
      i18n_prefix: @i18n_prefix,
      node: @node,
      state: @state
    )
  end

  def title
    translate!('title', rescue_exception: false)
  end

  def error
    if @state.error.present?
      error_message_for(@state.error.to_sym) || error_message_for('error_message') || I18n.translate('flow.defaults.error_message')
    end
  end

  def error_message_for(key)
    translate!(key)
  end

  def hint
    translate!('hint')
  end<commit_msg>Treat error key consistently as a String<commit_after>class QuestionPresenter < NodePresenter
  extend Forwardable
  delegate [
    :translate!,
    :translate_and_render,
    :translate_option
  ] => :@renderer

  def initialize(i18n_prefix, node, state = nil, options = {})
    super(i18n_prefix, node, state)
    @renderer = options[:renderer] || SmartAnswer::I18nRenderer.new(
      i18n_prefix: @i18n_prefix,
      node: @node,
      state: @state
    )
  end

  def title
    translate!('title', rescue_exception: false)
  end

  def error
    if @state.error.present?
      error_message_for(@state.error) || error_message_for('error_message') || I18n.translate('flow.defaults.error_message')
    end
  end

  def error_message_for(key)
    translate!(key)
  end

  def hint
    translate!('hint')
  end
{'fraction_non_alphanumeric': 0.111875, 'fraction_numerical': 0.015, 'mean_word_length': 3.6271676300578033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5611611', 'n_tokens_mistral': 544, 'n_tokens_neox': 522, 'n_words': 109}