Today you build BM25's term-frequency component, which saturates - the fifth occurrence of a word adds far less than the first, approaching a ceiling instead of growing forever. It is a sharper answer to repetition than the logarithm.
Compute BM25's saturating term-frequency factor, tf*(k1+1)/(tf+k1) with k1 = 1.5.
BM25 is the ranking function most modern search engines reach for, and its
handling of term frequency is the heart of it. Instead of growing without bound,
its term factor saturates: tf * (k1 + 1) / (tf + k1). As tf climbs, the
value rises quickly then flattens, approaching a ceiling of k1 + 1. A single
occurrence already earns 1.0; three earn only about 1.67.
The parameter k1 (commonly 1.2 to 2.0; use 1.5) tunes how fast it saturates
k1 flattens sooner. This is a more principled curve than the logarithm:
it directly encodes “the first mention matters most, and beyond a point more
mentions barely move the needle.” Tomorrow you fold in document length to complete
the formula.K1 = 1.5def bm25_tf(tf):# rises fast at first, then flattens toward k1 + 1return tf * (K1 + 1) / (tf + K1)
Robertson & Zaragoza, "The Probabilistic Relevance Framework: BM25 and Beyond" (2009).