Method: String#word_freqs

Defined in:
lib/textstats.rb

#word_freqsObject



36
37
38
39
40
# File 'lib/textstats.rb', line 36

def word_freqs
  wl = Hash.new(0)
  words.each{|w|wl[w] +=1}
  wl.sort{|a,b| a[1]<=>b[1]}.reverse
end