<commit_before>$: << 'lib'
require 'frequent-algorithm'

if __FILE__ == $0
  f = File.join(File.expand_path(File.dirname(__FILE__)),
                                 'corpora',
                                 'odyssey.mb.txt')
  enum = File.foreach(f)
  # the Odyssey begins at line 12 and spans 10412 lines
  12.times { enum.next }
  puts enum.next
  10411.times { enum.next }
  puts enum.next

end<commit_msg>Adding logic to normalize the text by downcasing and removing punctuation<commit_after>$: << 'lib'
require 'frequent-algorithm'

PUNCT = /(\.|\"|\'s|,|\?|!|;|:")/

if __FILE__ == $0
  f = File.join(File.expand_path(File.dirname(__FILE__)),
                                 'corpora',
                                 'odyssey.mb.txt')
  enum = File.foreach(f)
  # the Odyssey begins at line 12 and spans 10412 lines
  12.times { enum.next }
  10412.times do 
    line = enum.next.strip.downcase
    words = line.gsub(PUNCT, '').split
    words.each do |w|
      #puts w
      # at this point, feed in the word w into the process method
    end
  end
end
{'fraction_non_alphanumeric': 0.12582159624413145, 'fraction_numerical': 0.028169014084507043, 'mean_word_length': 2.1169590643274856, 'pattern_counts': {'":': 0, '<': 7, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '169443', 'n_tokens_mistral': 381, 'n_tokens_neox': 349, 'n_words': 95}