<commit_before>class RuneBook

  attr_reader :pages, :value_of_book, :champion_roles_pages

  def initialize(pages, champion_role_list, rune_combinations)
    @pages = pages
    @champion_roles_pages = Hash.new
    @value_of_book = value(champion_role_list, rune_combinations)
  end

  def value(champion_role_list, rune_combinations)
    book_value = 0
    champion_role_list.each do |champion_role|
      page_values = Hash.new
      @pages.each do |page|
        page_values[page.to_s] = rune_combinations[page.quint][page.mark][page.seal][page.glyph][champion_role]
      end
      max_element = page_values.max_by{ |k,v| v }
      book_value += max_element.last
      @champion_roles_pages[champion_role] = max_element.first
    end
    book_value/champion_role_list.size/47.4
  end

  def to_s
    string = ''
    @champion_roles_pages.each do |page|
      string += "#{page.first.first} #{page.first.last}\n"
      string += "#{page.last}\n\n"
    end
    string += "Value: #{value_of_book.to_f}"
  end
end<commit_msg>Beautify book output<commit_after>class RuneBook

  attr_reader :pages, :value_of_book, :champion_roles_pages

  def initialize(pages, champion_role_list, rune_combinations)
    @pages = pages
    @champion_roles_pages = Hash.new
    @value_of_book = value(champion_role_list, rune_combinations)
  end

  def value(champion_role_list, rune_combinations)
    book_value = 0
    champion_role_list.each do |champion_role|
      page_values = Hash.new
      @pages.each do |page|
        page_values[page.to_s] = rune_combinations[page.quint][page.mark][page.seal][page.glyph][champion_role]
      end
      max_element = page_values.max_by{ |k,v| v }
      book_value += max_element.last
      @champion_roles_pages[champion_role] = max_element.first
    end
    book_value/champion_role_list.size/47.4
  end

  def to_s
    string = ''
    @champion_roles_pages.each do |page|
      string += "#{page.first.first} #{page.first.last}\n"
      string += "#{page.last.first}\n"
      string += "Page value for champion: #{page.last.last}\n\n"
    end
    string += "Book value: #{value_of_book}"
  end
end
{'fraction_non_alphanumeric': 0.11147695202257761, 'fraction_numerical': 0.0037629350893697085, 'mean_word_length': 3.623913043478261, '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': '6152736', 'n_tokens_mistral': 789, 'n_tokens_neox': 790, 'n_words': 132}