Class: MiniSearch::Bm25
- Inherits:
-
Object
- Object
- MiniSearch::Bm25
- Defined in:
- lib/mini_search/bm_25.rb
Overview
Class Method Summary collapse
Class Method Details
.calculate(tf:, idf:, k1: 1.2, b: 0.75, document_length:, document_length_average:) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/mini_search/bm_25.rb', line 6 def self.calculate(tf:, idf:, k1: 1.2, b: 0.75, document_length:, document_length_average:) idf * ( (tf * (k1 + 1)) \ (tf + k1 * (1 - b + b * (document_length.to_f / document_length_average))) ) end |