Skip to content

Instantly share code, notes, and snippets.

@drusepth
Created February 25, 2019 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drusepth/b9a566a2400f1a585c8ec0466d067917 to your computer and use it in GitHub Desktop.
Save drusepth/b9a566a2400f1a585c8ec0466d067917 to your computer and use it in GitHub Desktop.
def self.combined_average_grade_level corpus
scores = [
automated_readability_index(corpus),
coleman_liau_index(corpus),
FleschKincaidService.grade_level(corpus),
forcast_grade_level(corpus),
gunning_fog_index(corpus),
smog_grade(corpus)
]
scores.reject! &:nan?
scores.reject! { |hasselhoff| hasselhoff.abs == Float::INFINITY }
return unless scores.length > 2
scores.sort.slice(1..-2).sum.to_f / 4
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment