Created
March 16, 2016 23:09
-
-
Save jonatas/c1b83d2a5bf8a6dc7f1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| dictionary = Hash.new { |hash, key| hash[key] = 0 } | |
| Dir["*.md"].each do |filename| | |
| File.readlines(filename).each do |line| | |
| line.split(" ").each do |word| | |
| dictionary[word] += 1 if word.length > 3 | |
| end | |
| end | |
| end | |
| dictionary.reject! { |_,counter| counter < 10 } | |
| p dictionary.sort_by{|k,v|v} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment