<commit_before>class WordListSanitizer
  def initialize
    @words ||= File.new(file_path).readlines.map(&:chomp)
  end

  def run!
    process_words
    write_file
  end

  private
  def file_path
    File.dirname(__FILE__) + '/../data/words.txt'
  end

  def process_words
    @processed = @words.reject { |w| w.match(/^\w+$/).nil? }.map(&:downcase).sort.uniq
  end

  def write_file
    File.open(file_path, 'w') { |f| @processed.each { |w| f.puts(w) } }
  end
end
<commit_msg>Clean up word file sanitizer a bit<commit_after>class WordListSanitizer
  def initialize
    @words ||= File.new(file_path).readlines.map(&:chomp)
  end

  def run!
    update_word_file
  end

  private
  def file_path
    File.dirname(__FILE__) + '/../data/words.txt'
  end

  def processed_words
    @words.reject { |w| w.match(/^\w+$/).nil? }.map(&:downcase).sort.uniq
  end

  def update_word_file
    File.open(file_path, 'w') { |f| processed_words.each { |w| f.puts(w) } }
  end
end

{'fraction_non_alphanumeric': 0.14963880288957687, 'fraction_numerical': 0.0, 'mean_word_length': 3.1810344827586206, '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': '6316148', 'n_tokens_mistral': 382, 'n_tokens_neox': 368, 'n_words': 76}