Skip to content

Instantly share code, notes, and snippets.

@armandocanals
Last active December 28, 2015 09:29

Revisions

  1. armandocanals renamed this gist Jul 15, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. armandocanals created this gist Nov 15, 2013.
    15 changes: 15 additions & 0 deletions Character Frequency
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # 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