class String

Public Instance Methods

unique_word_count() click to toggle source
# File lib/string-stats-dc.rb, line 11
def unique_word_count
  return self.split.uniq.length
end
unique_words() click to toggle source
# File lib/string-stats-dc.rb, line 7
def unique_words
  return self.split.uniq
end
word_count() click to toggle source
# File lib/string-stats-dc.rb, line 3
def word_count
  return self.split.length
end
word_frequencies() click to toggle source
# File lib/string-stats-dc.rb, line 15
def word_frequencies
  freq = Hash.new(0)
  self.split.each do |word|
    freq[word.to_sym] += 1
  end
  return freq
end