A persistent implementation of BM25 retrieval.
Project description
persistent_bm25
persistent_bm25 is a Python package that provides a persistent implementation of BM25 retrieval.
Installation
You can install it via pip:
pip install persistent_bm25
Usage
from persistent_bm25 import PersistentBM25Retriever
from langchain_core.documents import Document
docs = [
Document(page_content="LangChain makes AI powerful"),
Document(page_content="BM25 is a ranking function for search"),
]
# Create retriever
bm25_retriever = PersistentBM25Retriever.from_documents(docs)
bm25_retriever.persist("./bm25_retriever")
loaded_bm25_retriever = PersistentBM25Retriever.from_persist_dir("./bm25_retriever")
results = loaded_bm25_retriever.get_relevant_documents("AI search")
print(results)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bm25_retriever-0.1.tar.gz
(2.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bm25_retriever-0.1.tar.gz.
File metadata
- Download URL: bm25_retriever-0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ee8d8dbe042c494fbe679421a1973bf33cdecc1f34f0b85dacc063a92a80b1d
|
|
| MD5 |
384b78b4a9d9876dd7cd5e0283424b00
|
|
| BLAKE2b-256 |
a55af01c1bb03a67288e89939610aa37e722f72ae284d25d259e86e62586bdee
|
File details
Details for the file bm25_retriever-0.1-py3-none-any.whl.
File metadata
- Download URL: bm25_retriever-0.1-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
495866534456ac481bb0efe52c74c18d425973c916e864866c59219989ce8e4a
|
|
| MD5 |
42e7e7eb4b6c876dcf45e086fc57c355
|
|
| BLAKE2b-256 |
b210b4c0559e499de9d4ac83f1e586b0a885caf56a2883bed4b71994d391ce32
|