Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. def frequency_table(string)
  2.  
  3. hash = {}
  4.  
  5. string.downcase.split(" ").each do |word|
  6. if hash.has_key?(word)
  7. hash[word] += 1
  8. else
  9. hash[word] = 1
  10. end
  11. end
  12. hash
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement