Sha256: 9b2776cc32bbdb4c09463a6e5239a5d0436f74241e86f107ce2b861d2476296a

Contents?: true

Size: 282 Bytes

Versions: 6

Compression:

Stored size: 282 Bytes

Contents

module Lunar
  # @private internally used by Lunar::Index to count the words
  # of a given text.
  class Scoring
    def initialize(words)
      @words = Words.new(words)
    end

    def scores
      @words.inject(Hash.new(0)) { |a, w| a[w.downcase] += 1 and a }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lunar-0.5.5 lib/lunar/scoring.rb
lunar-0.5.4 lib/lunar/scoring.rb
lunar-0.5.3 lib/lunar/scoring.rb
lunar-0.5.2 lib/lunar/scoring.rb
lunar-0.5.1 lib/lunar/scoring.rb
lunar-0.5.0 lib/lunar/scoring.rb