Skip to content

Instantly share code, notes, and snippets.

@armandocanals
Last active December 28, 2015 09:29
Show Gist options
  • Save armandocanals/398a00036611ae035632 to your computer and use it in GitHub Desktop.
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 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