bm25-mojo
A drop-in faster replacement for the rank_bm25
package, powered by a clean-room Mojo kernel — with a vendored pure-Python
fallback for platforms without a native build (including Windows — tested there in CI: windows-fallback).
from bm25_mojo import BM25Okapi # same API as rank_bm25.BM25Okapi
bm25 = BM25Okapi(tokenized_corpus)
scores = bm25.get_scores(tokenized_query) # np.ndarray, float64
top = bm25.get_top_n(tokenized_query, documents, n=5)
panel = bm25.get_scores_batch(list_of_queries) # batch API: bit-identical rows
- Same results: scores match
rank_bm25element-wise (last-ulp level; the differential suite asserts agreement within 1e-8 on both the native and fallback backends).BM25Okapi,BM25L, andBM25Plusare provided. - Much faster scoring: the kernel walks postings lists with the
idf-weighted scores baked in at index time — 149x-13,137x faster
get_scoresthan rank_bm25, and 1.1x-1.95x faster than bm25s 0.3.11 (numba, its recommended config) across the whole 1k-100k doc grid (Apple M4 Max; full method and numbers in the repository README andbenchmarks/AUTOPSY-bm25s.md). - No toolchain needed: per-platform wheels ship the compiled kernel. Everywhere else the package transparently uses its pure-Python fallback.
- Force the fallback with
BM25_MOJO_DISABLE_NATIVE=1; inspect the active backend withbm25_mojo.backend_info().
Source, benchmarks, and development: https://github.com/thyn-ai/mojo-kernels
License: Apache-2.0, © 2026 Algenta
Metadata
Release files for bm25-mojo 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bm25_mojo-0.2.5-py3-none-manylinux_2_35_x86_64.whl | Python 3 | none | Linux glibc 2.35+ x86-64 | Details for bm25_mojo-0.2.5-py3-none-manylinux_2_35_x86_64.whl |
| bm25_mojo-0.2.5-py3-none-macosx_14_0_arm64.whl | Python 3 | none | macOS 14.0+ ARM64 | Details for bm25_mojo-0.2.5-py3-none-macosx_14_0_arm64.whl |
| bm25_mojo-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for bm25_mojo-0.2.5-py3-none-any.whl |
Total release size: 2.0 MB
Release files / bm25_mojo-0.2.5-py3-none-manylinux_2_35_x86_64.whl
| Download URL | bm25_mojo-0.2.5-py3-none-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 845.8 kB |
| Tags | Linux glibc 2.35+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
496ae3e537fef824539baaf5a684ffa2fe7189539327ca9931bac1592b818cee
|
|
BLAKE2b-256 checksum How to use checksums |
dd01b52f463fca9b6bdffe543ae7ef98d881add9f1229ec5e7e5b8308e788882
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / bm25_mojo-0.2.5-py3-none-macosx_14_0_arm64.whl
| Download URL | bm25_mojo-0.2.5-py3-none-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
de53a0d343ced0d4579573857dd613654ea5626d82c705069a527fee7f25f5ce
|
|
BLAKE2b-256 checksum How to use checksums |
aeedfa013f61b85a490c0c5a0a56e963de53a89e27ff58807983cb8c0090af7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / bm25_mojo-0.2.5-py3-none-any.whl
| Download URL | bm25_mojo-0.2.5-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fab5079d52e474989cc963b2261c5142cb1814cade63877b153b36e11316e8a
|
|
BLAKE2b-256 checksum How to use checksums |
ad72c030223bd32e9bf8c0492ef64ebd95d0973e1c47c4bebe6888cf5a9fe5d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for bm25-mojo 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.