<commit_before>require 'rubygems'
require 'bundler'

Bundler.require

def param_with_default(key, default)
  params[key] ? params[key] : default
end

def fixnum_param_with_default(key, default)
  param_with_default(key, default).to_i
end

def color_param_with_default(key, default)
  params[key]
  if params[key] === "transparent" 
   return params[key]
  elsif /^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ === params[key] 
    return "##{params[key]}"
  else
    return "##{default}"
  end
end


def generate_image(file_type)
  values = params[:values].split(',').map(&:to_f)
  background_color = color_param_with_default(:background_color, 'FFFFFF')
  line_color = param_with_default(:line_color, '4A8FED')<commit_msg>cleaned up rb file<commit_after>require 'rubygems'
require 'bundler'

Bundler.require

def param_with_default(key, default)
  params[key] ? params[key] : default
end

def fixnum_param_with_default(key, default)
  param_with_default(key, default).to_i
end

def color_param_with_default(key, default)
  if params[key] === "transparent" 
   return params[key]
  elsif /^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ === params[key] 
    return "##{params[key]}"
  else
    return "##{default}"
  end
end


def generate_image(file_type)
  values = params[:values].split(',').map(&:to_f)
  background_color = color_param_with_default(:background_color, 'FFFFFF')
  line_color = param_with_default(:line_color, '4A8FED')
{'fraction_non_alphanumeric': 0.15286624203821655, 'fraction_numerical': 0.01132342533616419, 'mean_word_length': 5.76555023923445, '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': '6042814', 'n_tokens_mistral': 541, 'n_tokens_neox': 530, 'n_words': 95}