Skip to content

Commit

Permalink
Replace division in log() with subtraction of two log()s (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed May 28, 2024
1 parent 990470e commit b447cc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rank_bm25.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def __init__(self, corpus, tokenizer=None, k1=1.5, b=0.75, delta=1):

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

def get_scores(self, query):
Expand Down

0 comments on commit b447cc9

Please sign in to comment.