Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#!/usr/bin/env ruby
words = {}.tap{|h| h.default = 0}
corpus = %x[ls].split.select{|n| n =~ /\.txt/}
.map{|f| File.read(f)}.reduce(&:+).split
.map{|w| w.downcase.gsub(/[^a-z]/,'')}
corpus.each{|w| words[w] += 1}
ranked_words = words.select{|k,_| k.length > 3}.sort_by{|_,v| -v}[0..5000]
10.times do
puts ranked_words.sample(4).map(&:first).map(&:capitalize).join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.