<commit_before>#require 'errors'

module FormattingHelper

  def format_params( hash=params, level=0 )
    output = ""
    hash.map do |k,v|
      level.times do
        output << " "
      end
      if v.is_a? Hash
        output << "#{k}:\n"
        output << format_params(v, level + 2) if v.is_a? Hash
      elsif v.is_a? Array
        output << "#{k}=[#{v.join(",")}]\n"
      else
        output << "#{k}='#{v}'\n"
      end
    end
    output
  end

  def format_errors(object)    
    if object and object.respond_to?("errors") and !(messages = object.errors.all_messages).empty?
      "<ul>" + messages.collect{|msg| "<li>#{msg}</li>"}.join + "</ul>"
    else
      ""
    end

=begin
    if object and object.respond_to? "errors"
      temp = "<ul>"
      object.errors.each do |k,v|
        temp << "<li>"
        temp << "<p>#{k.humanize} #{v}</p>"
        if object.respond_to? k
          value = object.send k
          temp << format_errors(value)
        end
        temp << "</li>"
      end
      temp << "</ul>"
    else
      ""
    end
=end
  end
  
end<commit_msg>removed commented out code<commit_after>#require 'errors'

module FormattingHelper

  def format_params( hash=params, level=0 )
    output = ""
    hash.map do |k,v|
      level.times do
        output << " "
      end
      if v.is_a? Hash
        output << "#{k}:\n"
        output << format_params(v, level + 2) if v.is_a? Hash
      elsif v.is_a? Array
        output << "#{k}=[#{v.join(",")}]\n"
      else
        output << "#{k}='#{v}'\n"
      end
    end
    output
  end

  def format_errors(object)    
    if object and object.respond_to?("errors") and !(messages = object.errors.all_messages).empty?
      "<ul>" + messages.collect{|msg| "<li>#{msg}</li>"}.join + "</ul>"
    else
      ""
    end
  end
  
end
{'fraction_non_alphanumeric': 0.17016574585635358, 'fraction_numerical': 0.0022099447513812156, 'mean_word_length': 2.0133111480865225, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 17, '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': '1171658', 'n_tokens_mistral': 631, 'n_tokens_neox': 634, 'n_words': 149}