BM25 is an algorithm used to rank documents based on their relevance to a given search query. It calculates a score for each document based on a given search query, indicating how relevant each document is to that query. The higher the BM25 score, the more relevant the document is considered.
The package can be installed by adding bm25
to your list of dependencies in
mix.exs
:
def deps do
[
{:bm25, "~> 1.0"}
]
end
Usage (documentation)
iex> documents = [
iex> "BM25 is a ranking function",
iex> "used by search engines",
iex> "to rank matching documents"
iex> ]
iex> query = ["ranking", "search", "function"]
iex> BM25.bm25(documents, query)
[1.8455076734299591, 1.0126973514850315, 0.0]
BM25
is released under the Apache License 2.0
.
This package was written by Elliot Jackson.
- Blog: https://elliotekj.com
- Email: elliot@elliotekj.com