Sha256: c68f98bd682eeccb50a5737ab810c4199e23b52a9b5e5057aa5b6da12a2cace3
Contents?: true
Size: 709 Bytes
Versions: 6
Compression:
Stored size: 709 Bytes
Contents
module LinkThumbnailer module Graders class Length < ::LinkThumbnailer::Graders::Base def call return 0.0 if too_short? y / ideal_description_gaussian_value end private def get_gaussian_value_for(x) Math.sqrt(2.0 * Math::PI ** 2) * Math.exp(-(x - ideal_description_length) ** 2 / 2.0 * 0.005 ** 2) end def x text.length end def y get_gaussian_value_for(x) end def ideal_description_length 120.0 end def ideal_description_gaussian_value 4.442882938158366 end def too_short? text.length < config.description_min_length end end end end
Version data entries
6 entries across 6 versions & 1 rubygems