Skip to content

Commit

Permalink
Merge pull request #25 from rtoal/master
Browse files Browse the repository at this point in the history
A first try at a Ruby golf
  • Loading branch information
crista committed Feb 1, 2015
2 parents f96d66e + 3169b4b commit 3607d6d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 06-code-golf/tf-06.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require 'set'

stops = ((IO.read '../stop_words.txt').split ',').to_set
ARGF.read.downcase.scan(/[a-z]{2,}/).each_with_object(Hash.new 0){|w,c|c[w]+=1 if not stops.member? w}.sort_by{|w,c|-c}[0,25].each{|w,c|puts "#{w} - #{c}"}

0 comments on commit 3607d6d

Please sign in to comment.