Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dorianbrown/rank_bm25
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianbrown committed Feb 16, 2022
2 parents 70c7314 + 97a38cf commit 2550648
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rank_bm25.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class BM25:
def __init__(self, corpus, tokenizer=None):
self.corpus_size = len(corpus)
self.corpus_size = 0
self.avgdl = 0
self.doc_freqs = []
self.idf = {}
Expand Down Expand Up @@ -47,6 +47,8 @@ def _initialize(self, corpus):
except KeyError:
nd[word] = 1

self.corpus_size += 1

self.avgdl = num_doc / self.corpus_size
return nd

Expand Down

0 comments on commit 2550648

Please sign in to comment.