dorianbrown / rank_bm25

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

add function `get_batch_scores` to compute sub-docs' bm25 score #6

Closed nlp4whp closed 4 years ago

nlp4whp commented 4 years ago

Hi, I add a new function named get_batch_scores to compute score between query and a subset of all corpus; because get_scores is a little bit slow when user pass huge number of corpus into bm25 model; For instance, my corpus includes about 40w docs, and get_scores will cost more than 1 second,

dorianbrown commented 4 years ago

Thanks for the merge request, looks like useful functionality and fits nicely with the rest. This will help with performance, but it might be worthwhile to investigate making it perform faster on larger corpuses, which should be feasible.