Class: Coleman_liau
Instance Method Summary collapse
- #calc_score(letter_count, word_count, sentence_count) ⇒ Object
- #name ⇒ Object
- #score(text, stats) ⇒ Object
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 |
#name ⇒ Object
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 |