{"id":29675045,"url":"https://github.com/patelvivekdev/fast-bm25","last_synced_at":"2026-01-20T17:28:11.470Z","repository":{"id":304455109,"uuid":"889801287","full_name":"patelvivekdev/fast-BM25","owner":"patelvivekdev","description":"BM25 (Okapi BM25) implementation in TypeScript with field boosting and parallel processing support.","archived":false,"fork":false,"pushed_at":"2025-07-10T21:41:01.000Z","size":295,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-13T08:52:22.221Z","etag":null,"topics":["bm25","bm25-okapi","fast-bm25"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/fast-bm25","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patelvivekdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-17T09:18:31.000Z","updated_at":"2025-07-10T21:41:59.000Z","dependencies_parsed_at":"2025-07-13T08:52:31.485Z","dependency_job_id":"eb40ab0a-3fec-40d4-8fc3-b0e5e7f2ff33","html_url":"https://github.com/patelvivekdev/fast-BM25","commit_stats":null,"previous_names":["patelvivekdev/fast-bm25"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/patelvivekdev/fast-BM25","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Ffast-BM25","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Ffast-BM25/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Ffast-BM25/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Ffast-BM25/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patelvivekdev","download_url":"https://codeload.github.com/patelvivekdev/fast-BM25/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patelvivekdev%2Ffast-BM25/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266586905,"owners_count":23952205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bm25","bm25-okapi","fast-bm25"],"created_at":"2025-07-22T23:04:53.714Z","updated_at":"2025-07-22T23:04:54.314Z","avatar_url":"https://github.com/patelvivekdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fast-bm25\n\nA high-performance BM25 (Okapi BM25) implementation in TypeScript with field boosting and parallel processing support.\n\n## Features\n\n- Fast BM25 ranking algorithm implementation\n- Field boosting support\n- Parallel document processing\n- Customizable tokenization\n- Stop words filtering\n- Minimum token length filtering\n- Optional stemming\n\n## Installation\n\n```bash\nnpm install fast-bm25\n# or\nyarn add fast-bm25\n```\n\n## Usage\n\n### Basic Usage\n\n```typescript\nimport { BM25 } from 'fast-bm25';\n\n// Sample documents for demonstration\nconst docs = [\n  { title: 'The quick brown fox', content: 'jumps over the lazy dog' },\n  { title: 'The lazy brown dog', content: 'sleeps all day long' },\n  { title: 'Quick fox', content: 'quick brown jumping' },\n];\n// Create a new BM25 instance\nconst bm25 = new BM25(docs);\n\n// Query example\nconst query = 'brown fox';\n\n// Get search results\nconst results = bm25.search(query, 2);\n\nconsole.log(results);\n// [\n//   {\n//     index: 2,\n//     score: 0.6666956543922424,\n//   }, {\n//     index: 0,\n//     score: 0.5762394666671753,\n//   }\n// ]\n```\n\n### Adding Documents\n\n```typescript\nconst bm25 = new BM25();\n\n// Add documents\nbm25.addDocument({ title: 'Document title', content: 'Document content' });\n\n// Add multiple documents\nbm25.addDocuments([\n  { title: 'Document 1', content: 'Content 1' },\n  { title: 'Document 2', content: 'Content 2' },\n]);\n\n// Add documents in parallel\n\nconst largeDocs = [\n  /* ... lots of documents ... */\n];\n\nawait bm25.addDocumentsParallel(largeDocs);\n```\n\n### Field Boosting\n\n```typescript\n// Initialize with field boosts\nconst bm25WithBoosts = new BM25(docs, {\n  fieldBoosts: {\n    title: 2.0, // Title field has 2x importance\n    content: 1.0,\n  },\n});\n```\n\n### Custom Options\n\n```typescript\nconst customBM25 = new BM25(docs, {\n  k1: 1.5, // Term frequency saturation parameter\n  b: 0.75, // Length normalization factor\n  minLength: 2, // Minimum token length\n  stopWords: new Set(['the', 'a', 'is']), // Custom stop words\n  stemming: true, // Enable word stemming\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatelvivekdev%2Ffast-bm25","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatelvivekdev%2Ffast-bm25","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatelvivekdev%2Ffast-bm25/lists"}