Sha256: ba9f58caeb52df166a1e77e2f886a8887f4f81d214ea939a324069f7a34414ae
Contents?: true
Size: 326 Bytes
Versions: 7
Compression:
Stored size: 326 Bytes
Contents
class String def word_count return self.split.length end def unique_words return self.split.uniq end def unique_word_count return self.split.uniq.length end def word_frequencies freq = Hash.new(0) self.split.each do |word| freq[word.to_sym] += 1 end return freq end end
Version data entries
7 entries across 7 versions & 7 rubygems