Last active
December 28, 2015 09:29
-
-
Save armandocanals/398a00036611ae035632 to your computer and use it in GitHub Desktop.
Most frequent letters, in order, occurring in the 1000 most common words (http://www.giwersworld.org/computers/linux/common-words.phtml)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a dump of the word list | |
text = File.read ARGV[0] | |
words = text.split("\n") | |
hash = {} | |
words.each do |word| | |
word.each_char do |l| | |
hash[l] ||= 0 | |
if hash.keys.include?(l) | |
hash[l] += 1 | |
end | |
end | |
end | |
p hash.sort_by {|k, v| v}.reverse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment