class String def word_count self.split(" ").count end def unique_words self.split(" ").uniq end def unique_word_count unique_words.count end def word_frequencies frequencies = Hash.new(0) self.split(" ").each do |word| frequencies[word.to_sym] += 1 end return frequencies end end