https://github.com/ariya/text-match
demo of text matching using BM25
https://github.com/ariya/text-match
bm25
Last synced: 1 day ago
JSON representation
demo of text matching using BM25
- Host: GitHub
- URL: https://github.com/ariya/text-match
- Owner: ariya
- Created: 2025-02-23T04:45:34.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-09-07T00:31:15.000Z (29 days ago)
- Last Synced: 2025-09-29T06:33:41.999Z (6 days ago)
- Topics: bm25
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Text Match
A simple demo of text matching using the [BM25 algorithm](https://en.wikipedia.org/wiki/Okapi_BM25).
Requirement: [Node.js](https://nodejs.org), [Deno](https://deno.com), or [Bun](https://bun.sh).
```bash
./text-match.js filename query
```* `filename`: Path to the text file you want to search.
* `query`: Search query, enclosed in double quotes.As an example, to find the most relevant lines in `solar-system.txt` related to "gas giants composition":
```bash
./text-match.js solar-system.txt "gas giants composition"
```This will output the top 3 most similar lines from `solar-system.txt` based on the provided query.