Skip to content

Commit 3607d6d

Browse files
committed
Merge pull request #25 from rtoal/master
A first try at a Ruby golf
2 parents f96d66e + 3169b4b commit 3607d6d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

06-code-golf/tf-06.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env ruby
2+
require 'set'
3+
4+
stops = ((IO.read '../stop_words.txt').split ',').to_set
5+
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}"}
6+

0 commit comments

Comments
 (0)