Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

persistent_bm25_v2-1.0.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file persistent_bm25_v2-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for persistent_bm25_v2-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e85dffcd771bce8384140f40859d6f5767d00adb7fa8da0eb474dbe8df50c422
MD5 457f044b26e35a149447aceea619f969
BLAKE2b-256 fb850f493d4a2a351e495b74a1428101886c3268ce8c536796342fa1f181c4d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page