Skip to content

Commit b447cc9

Browse files
authored
Replace division in log() with subtraction of two log()s (#23)
1 parent 990470e commit b447cc9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rank_bm25.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __init__(self, corpus, tokenizer=None, k1=1.5, b=0.75, delta=1):
182182

183183
def _calc_idf(self, nd):
184184
for word, freq in nd.items():
185-
idf = math.log((self.corpus_size + 1) / freq)
185+
idf = math.log(self.corpus_size + 1) - math.log(freq)
186186
self.idf[word] = idf
187187

188188
def get_scores(self, query):

0 commit comments

Comments
 (0)