Sample input:
\"I was 09809 home -- Yes! yes! You was\"
and output:
{ \'yes\' => 2, \'was\' => 2, \'i\' => 1, \'home\
class String def frequency self.scan(/[a-zA-Z]+/).each.with_object(Hash.new(0)) do |word, hash| hash[word.downcase] += 1 end end end
puts "I was 09809 home -- Yes! yes! You was".frequency