Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def frequency_table(string)
- hash = {}
- string.downcase.split(" ").each do |word|
- if hash.has_key?(word)
- hash[word] += 1
- else
- hash[word] = 1
- end
- end
- hash
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement