<commit_before>class Array
  # Sorts an array of strings with 'dictionary sort' logic.
  # Produces the same order as the Linux command `sort --dictionary-order`.
  # (Note that `--dictionary-order` is the default order for the `sort` command.)
  def dict_sort
    sorting_cache = {}
    sort do |a, b|
      c, d = [a, b].map do |f|
        sorting_cache[f] ||= f.gsub /\W|[_\s]/, ''
      end
      c <=> d
    end
  end
end<commit_msg>Call #to_s on each array element.<commit_after>class Array
  # Sorts an array of strings with 'dictionary sort' logic.
  # Produces the same order as the Linux command `sort --dictionary-order`.
  # (Note that `--dictionary-order` is the default order for the `sort` command.)
  def dict_sort
    sorting_cache = {}
    sort do |a, b|
      c, d = [a, b].map do |el|
        str = el.to_s
        sorting_cache[str] ||= str.gsub /\W|[_\s]/, ''
      end
      c <=> d
    end
  end
end
{'fraction_non_alphanumeric': 0.13001083423618634, 'fraction_numerical': 0.0, 'mean_word_length': 2.4349442379182156, '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': '6593722', 'n_tokens_mistral': 322, 'n_tokens_neox': 313, 'n_words': 114}