Skip to main content

The zero-dependency core protocol engine for MisakaNet Swarm Knowledge Network.

Project description

misakanet-core

Zero-dependency BM25 search engine with RRF fusion — extracted from MisakaNet.

  • Pure Python, stdlib only
  • BM25 ranking with configurable k1/b
  • Metadata-weighted scoring
  • RRF (Reciprocal Rank Fusion) for multi-query fusion
  • CJK-aware tokenization
  • Works in air-gapped environments

Installation

pip install misakanet-core

Usage

from misakanet_core import BM25, ScoredDocument, tokenize, rrf

# Prepare corpus
docs = [
    ScoredDocument("doc1", tokenize("the cat sat on the mat")),
    ScoredDocument("doc2", tokenize("the dog sat on the log")),
    ScoredDocument("doc3", tokenize("cats and dogs are friends")),
]

# Build index and search
engine = BM25(docs)
results = engine.search("cat dog", top_k=5)

for result in results:
    print(f"{result.doc_id}: {result.score:.4f}")

# Multi-query fusion with RRF
from misakanet_core import SearchResult, rrf
query1 = engine.search("cat")
query2 = engine.search("dog")
fused = rrf([query1, query2], top_k=3)

Why not use elasticsearch / tantivy / whoosh?

misakanet-core elasticsearch tantivy whoosh
Dependencies Zero JVM Rust toolchain Pure Python
Install time 0.5s 5min+ 2min+ 2s
Air-gapped
CJK support ⚠️ ⚠️

License

MIT

Project details


Download files

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

Source Distribution

misakanet_core-2.7.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

misakanet_core-2.7.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file misakanet_core-2.7.0.tar.gz.

File metadata

  • Download URL: misakanet_core-2.7.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for misakanet_core-2.7.0.tar.gz
Algorithm Hash digest
SHA256 0762e9835a79ac23d5323ec077c8d6a91c046fd62bdac9d40c5a5bb3325cf5ed
MD5 713eefbd9b4331e7f27c78f34ac455ca
BLAKE2b-256 3cd3d8d4d396740c13ec03da66159a6c3036cd063e04582c2fc78632cf479775

See more details on using hashes here.

Provenance

The following attestation bundles were made for misakanet_core-2.7.0.tar.gz:

Publisher: publish.yml on Ikalus1988/misakanet-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file misakanet_core-2.7.0-py3-none-any.whl.

File metadata

  • Download URL: misakanet_core-2.7.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for misakanet_core-2.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d658c0d7d54e271928eee1638937b1feae9067e8c1f82750c185e26ef90a063
MD5 60476ac460a76adacd927d45d0a82942
BLAKE2b-256 28d67f9887d17ccc57fd269b876c3e022cabd820efd78881bb2fc606aa2c0a52

See more details on using hashes here.

Provenance

The following attestation bundles were made for misakanet_core-2.7.0-py3-none-any.whl:

Publisher: publish.yml on Ikalus1988/misakanet-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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