Sha256: 9ee6e72854efceecd24ee9c691b16a3f23cf820fcd97fefbde40c822d3a429ea
Contents?: true
Size: 307 Bytes
Versions: 1
Compression:
Stored size: 307 Bytes
Contents
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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
string-stats-tc-2.0.0 | lib/string-stats-tc.rb |