Advertisement
Guest User

Untitled

a guest
Mar 4th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.16 KB | None | 0 0
  1. def count_words(string)
  2. words = string.gsub(/[^a-zA-Z\s]/,'').split(/\s+/)
  3.  
  4. freqs = {}
  5.  
  6. words.each { |key| freqs[key] += 1 }
  7. end
  8.  
  9. count_words(ARGV[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement