x402 Forge Catalog

Catalog / bm25-rank

BM25 passage ranker

For research assistants: ranks passages an agent already has against a query, so it can keep only the relevant ones.

Benched Security-tested against the seller traps of our Agent Benchmark Exam.

Buy $1.00

What it does

Ranks up to 50 texts against a query with Okapi BM25 (k1=1.2, b=0.75, Lucene IDF ln(1+(N-n+0.5)/(n+0.5))) and returns the top matches as {index (0-based), score (4 decimals), preview (first 80 characters), matched_terms}. Texts arrive in one string, separated by lines holding only --- or, when no such line exists, by ||. Tokens are lowercase Unicode letter/digit runs (NFC, Turkish dotted I folded to i); there is no stemming, no stop-word list and no CJK word segmentation (a run of CJK characters is one token). Repeated query terms count once; ties go to the lower index; texts without any query term are left out. Empty pieces keep their index but are not counted in N or the average length; with no non-empty text the result is valid:false, reason no_texts.

Example input
{"query":"solar panel efficiency","texts":"Solar panel efficiency depends on temperature.||Wind turbines need steady wind.||Panel cleaning raises solar output.","top":3}
Answer
{"ok":true,"result":{"valid":true,"method":"Okapi BM25, k1=1.2, b=0.75, IDF=ln(1+(N-n+0.5)/(n+0.5))","separator":"||","total_texts":3,"nonempty_texts":3,"query_terms":["solar","panel","efficiency"],"count":2,"matches":[{"index":0,"score":1.8274,"preview":"Solar panel efficiency depends on temperature.","truncated":false,"matched_terms":["solar","panel","efficiency"]},{"index":2,"score":0.9647,"preview":"Panel cleaning raises solar output.","truncated":false,"matched_terms":["solar","panel"]}],"matching_texts":2},"warnings":[]}
Try it free
/try/bm25-rank

Buy

Price $1.00, once. One buyer only: the first one owns the tool, we stop selling it and list your copy, and every paid call to it goes to your wallet.

  1. Pay with an x402 walletThe buy link is https://forge.fizzl.eu/forge/packages/bm25-rank?format=zip. It answers with a payment request (HTTP 402) that an x402 wallet pays in USDC on Base. From Claude, ChatGPT or Grok with the Fizzl Agent Wallet: ask “buy https://forge.fizzl.eu/forge/packages/bm25-rank?format=zip”. From code:
    const pay = wrapFetchWithPayment(fetch, client); // see /llms.txt
    const zip = await pay("https://forge.fizzl.eu/forge/packages/bm25-rank?format=zip");
  2. Start it with your walletUnzip, npm install, then PAY_TO=0xYourWallet PUBLIC_URL=https://your-host npm start on any Node host.
  3. We list it for youYour copy tells us where it runs; we check it and add it to the x402 Trust Index and the Bazaar under your wallet.