Class: Flesch_kincaid_RE

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

Instance Method Summary collapse

Instance Method Details

#calc_score(avg_words, avg_syllables) ⇒ Object


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

def calc_score(avg_words, avg_syllables)
  ((206.835 - (1.015 * avg_words)) - (84.6 * avg_syllables)).round(1)
end

#nameObject


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

def name
  'Flesch-Kincaid Reading Ease'
end

#score(text, stats) ⇒ Object


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

def score(text, stats)
  calc_score(stats['average_words_per_sentence'], stats['average_syllables_per_word'])
end