Created
February 25, 2019 05:27
-
-
Save drusepth/b9a566a2400f1a585c8ec0466d067917 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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