Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby
words = {}.tap{|h| h.default = 0}
corpus = %x[ls]{|n| n =~ /\.txt/}
.map{|w| w.downcase.gsub(/[^a-z]/,'')}
corpus.each{|w| words[w] += 1}
ranked_words ={|k,_| k.length > 3}.sort_by{|_,v| -v}[0..5000]
10.times do
puts ranked_words.sample(4).map(&:first).map(&:capitalize).join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment