I am trying to implement Okapi BM25 to search documents by query using python whoosh library.
My understanding is that whoosh calculates the scores for each documents using BM25 according to the query and then sorts it to give the best result.
I use
results = searcher.search(query)
to get the document best matched to the query.
How can I get the scores for each document? Is there any other way to get scores for BM25 ranking?
You can get the computed score by using the score
attribute:
for r in results:
print r, r.score