class Bable::StatisticString

Constants

SENTENCE_REGEX
WORD_REGEX

Public Instance Methods

average_sentence_length() click to toggle source
# File lib/bable/statistic_string.rb, line 32
def average_sentence_length
  characters_count / sentences_count.to_f
end
average_word_length() click to toggle source
# File lib/bable/statistic_string.rb, line 28
def average_word_length
  characters_count / words_count.to_f
end
characters_count() click to toggle source
# File lib/bable/statistic_string.rb, line 16
def characters_count
  words.join.size
end
sentences() click to toggle source
# File lib/bable/statistic_string.rb, line 12
def sentences
  scan(SENTENCE_REGEX)
end
sentences_count() click to toggle source
# File lib/bable/statistic_string.rb, line 24
def sentences_count
  sentences.size
end
words() click to toggle source
# File lib/bable/statistic_string.rb, line 8
def words
  scan(WORD_REGEX)
end
words_count() click to toggle source
# File lib/bable/statistic_string.rb, line 20
def words_count
  words.size
end