Class: ActsAsFerret::MoreLikeThis::DefaultAAFSimilarity

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_ferret/more_like_this.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) idf(doc_freq, num_docs)



201
202
203
204
# File 'lib/acts_as_ferret/more_like_this.rb', line 201

def idf(doc_freq, num_docs)
  return 0.0 if num_docs == 0
  return Math.log(num_docs.to_f/(doc_freq+1)) + 1.0
end