Class: Coleman_liau

Inherits:
Formula show all
Defined in:
lib/formulas/coleman_liau.rb

Instance Method Summary collapse

Instance Method Details

#calc_score(letter_count, word_count, sentence_count) ⇒ Object


7
8
9
# File 'lib/formulas/coleman_liau.rb', line 7

def calc_score(letter_count, word_count, sentence_count)
  ((5.89 * (letter_count.to_f / word_count.to_f)) - (0.3 * (sentence_count.to_f / word_count.to_f)) - 15.8).round(1)
end

#nameObject


11
12
13
# File 'lib/formulas/coleman_liau.rb', line 11

def name
  'Coleman-Liau Index'
end

#score(text, stats) ⇒ Object


3
4
5
# File 'lib/formulas/coleman_liau.rb', line 3

def score(text, stats)
  calc_score(stats['letter_count'], stats['word_count'], stats['sentence_count'])
end