Class: Flesch_kincaid_GL

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

Instance Method Summary collapse

Instance Method Details

#calc_score(avg_words, avg_syllables) ⇒ Object



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

def calc_score(avg_words, avg_syllables)
  (((0.39 * avg_words) + (11.8 * avg_syllables)) - 15.59).round(1)
end

#nameObject



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

def name
  'Flesch-Kincaid Grade Level'
end

#score(text, stats) ⇒ Object



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

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