<commit_before>module ErrorItemsHelper
  def error_items(error_messages, field)
    if error_messages.key?(field)
      error_messages[field].map { |message| "#{field.to_s.titleize} #{message}".capitalize }.join("\n")
    end
  end

  def errors_for(object, attribute)
    object.errors.errors.filter_map do |error|
      if error.attribute == attribute
        {
          text: error.options[:message],
        }
      end
    end
  end<commit_msg>Update error items helper to handle checkbox component<commit_after>module ErrorItemsHelper
  def error_items(error_messages, field)
    if error_messages.key?(field)
      error_messages[field].map { |message| "#{field.to_s.titleize} #{message}".capitalize }.join("\n")
    end
  end

  def errors_for(object, attribute)
    return nil if object.errors.blank?

    object.errors.errors.filter_map do |error|
      if error.attribute == attribute
        {
          text: error.options[:message],
        }
      end
    end
  end
{'fraction_non_alphanumeric': 0.1111111111111111, 'fraction_numerical': 0.0, 'mean_word_length': 3.0411522633744856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4870949', 'n_tokens_mistral': 299, 'n_tokens_neox': 294, 'n_words': 66}