dorianbrown / rank_bm25

A Collection of BM25 Algorithms in Python
Apache License 2.0
983 stars 83 forks source link

How can we get the percentage of matching for query string #12

Closed priyankagutte closed 2 years ago

priyankagutte commented 3 years ago

How can we get the Percentage of matching and its index value in a list for query string.

lavarthan commented 3 years ago

I don't think there is any straight way, but you can get the all scores and you can match with your results. for example

doc_scores = bm25.get_scores(tokenized_query)
doc_scores.sort()
doc_scores = doc_scores[::-1]

here doc_scores will be sorted so you can know the matching score of each doc of your search output