class FleschKincaidGl
Public Instance Methods
calc_score(avg_words, avg_syllables)
click to toggle source
# File lib/odyssey/formulas/flesch_kincaid_gl.rb, line 17 def calc_score(avg_words, avg_syllables) (((0.39 * avg_words) + (11.8 * avg_syllables)) - 15.59).round(1) end
name()
click to toggle source
# File lib/odyssey/formulas/flesch_kincaid_gl.rb, line 21 def name 'Flesch-Kincaid Grade Level' end
score(text, stats)
click to toggle source
# File lib/odyssey/formulas/flesch_kincaid_gl.rb, line 3 def score(text, stats) calc_score(stats['average_words_per_sentence'], stats['average_syllables_per_word']) end
score_by_sentence(text, stats_split)
click to toggle source
# File lib/odyssey/formulas/flesch_kincaid_gl.rb, line 7 def score_by_sentence(text, stats_split) res = [] for i in 0..text['sentences'].length-1 res.push(calc_score(stats_split['word_count'][i], stats_split['average_syllables_per_word'][i])) end res end