Sha256: bf478dacf1d330a3e53cea6299379d4b3c1f2483b57406270fb07cc63223bafa

Contents?: true

Size: 383 Bytes

Versions: 4

Compression:

Stored size: 383 Bytes

Contents

class TfIdfSimilarity::Document
  # @return [Float] the maximum term count of any term in the document
  def maximum_term_count
    @maximum_term_count ||= term_counts.values.max.to_f
  end

  # @return [Float] the average term count of all terms in the document
  def average_term_count
    @average_term_count ||= term_counts.values.reduce(0, :+) / term_counts.size.to_f
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tf-idf-similarity-0.1.3 lib/tf-idf-similarity/extras/document.rb
tf-idf-similarity-0.1.2 lib/tf-idf-similarity/extras/document.rb
tf-idf-similarity-0.1.1 lib/tf-idf-similarity/extras/document.rb
tf-idf-similarity-0.1.0 lib/tf-idf-similarity/extras/document.rb