Repository navigation
Releases
v2.6.0
For apps using preset: 'search' since 2.0 or 2.1: 2.2.0 added acronyms: true to this preset, so short queries can return more results. Pass { preset: 'search', acronyms: false } to get the old results back. Nothing in 2.6.0 changes a score.
Added
substringoption: likepartial, and a match may also start inside a word, sophonefindsiPhone 15andvillefindsBelleville. No moreincludes()next to a search. Opt-in: scores without it are unchanged. Also in the MCP server.- Extensions page on the docs site: the packs shipped with fuzzy-toolkit and community ones, found on npm by the keyword
fuzzy-toolkit-pluginor reviewed indocs/extensions.json, with a fuzzy search box. The site rebuilds weekly so new packages appear.
Changed
npx fuzzy-toolkit ai-setuponly writes when the project'spackage.jsonlists fuzzy-toolkit (--forceto write anyway), writes a shorter block that tells assistants to go through the project's existing calls, links the onlinellms.txtinstead of anode_modulespath that may not exist, and never replaces a block someone edited by hand (--forcedoes).- The MCP
checktool says in its description that it gives the engine's verdict, not the verdict of a given app, which adds its own rules.
Project
- A test freezes what each built-in preset sets: a preset only changes in a major version. New behavior comes as an option to turn on.
Docs
searchpreset: 2.2.0 addedacronyms: truein a minor version, which can return more results than 2.1. Documented, withacronyms: falseto get the old behavior back.- Size:
createMatchercarries every method (about 14 kB); import the functions you call for a smaller bundle. - New design for the documentation site. The home page has a live demo scored by the real library, benchmarks and examples for each function.
- New Playground page.
- Getting started shows pnpm, yarn, bun and CDN installs; the search recipe covers React.
- A shorter README that points to the documentation.
v2.5.0
Added
- Dutch language pack:
fuzzy-toolkit/lang/nl. Numbers in words with units first (eenentwintig,een en twintig), ordinals, articles, stop words and phonetic rules (ij/ei, au/ou, v/f, z/s, ch/g). Also in the CLI (--lang nl) and the MCP server. Thanks to @techkayacodes, the first outside contribution!
Project
- Property-based tests (fast-check): random Unicode input against the laws of distances, scores and
normalize. - Each GitHub release carries the npm tarball with its SLSA provenance. See "Verifying a release" in SECURITY.md.
- Ko-fi link for those who want to support the project (
npm fund).
New Contributors
- @techkayacodes made their first contribution in #31
v2.4.0
Added
- Spanish, German and Italian language packs:
fuzzy-toolkit/lang/es,/deand/it. Numbers in words (treinta y dos,einundzwanzig,ventitré), ordinals, articles, stop words and phonetic rules. Import one and pass it inlanguages; bundles only carry the packs they import. See Languages and presets. fuzzy-toolkit/testing, a kit for people who write language packs and presets:assertLanguage(pack, { numbers, articles, stopwords, sounds, distinct })andassertPreset(preset, { matches, differs, normalized })check the cases you expect and list every one that fails, with any test runner. See Testing your pack.
Project
- RELEASING.md: the npm trusted publisher needs Allow npm publish ticked.
- Releases are automatic: merging a version bump creates the tag, the GitHub release and the npm publish.
- CI checks test coverage (95% of lines, 90% of branches) and runs the OpenSSF Scorecard.
- The tests pass on Windows.
v2.3.0
v2.3.0
Added
- MCP server for AI agents:
npx fuzzy-toolkit mcpgives Claude, Cursor, VS Code and other agents the toolscompare,closest,search,dedupe,join,checkandfind. Local, no dependency, no file access. See AI agents and assistants. npx fuzzy-toolkit ai-setup: adds a short usage block to your project'sAGENTS.md,CLAUDE.md, Cursor rules or Copilot instructions, and updates it in place next time.llms-full.txtin the package: the whole documentation in one file for coding assistants. Context7 configuration.- Warnings for common mistakes, printed once each: an unknown option (with "did you mean"), a
0.8threshold when scores go to 100, akeysname no item has. Results are unchanged. - Clearer error when options are not an object.
Project
- Contributing guide, code of conduct, security policy and issue forms for bug reports, wrong results, language requests and preset proposals.
- CI on every pull request: tests on Node 18 to 24, golden results so scores never change by accident, accuracy on real data, bundle size budgets, zero runtime dependencies and
npm audit. - Releases are published from GitHub with npm provenance.
Size
- About 0.9 kB (min+gzip) more per import for the warnings.
v2.2.0
v2.2.0
Added
fuzzy-toolkit/string-similarity: drop-in replacement for the unmaintainedstring-similaritypackage.compareTwoStrings()andfindBestMatch()give the same results; only the import changes.- Classic metrics:
dice(),jaccard(),cosine()(on chunks ofnletters),hamming()andlcs()(longest common subsequence). - Nested keys:
keys: ['artist.name', 'tags.label'], arrays included, checked by TypeScript. includeMatchesoption ofsearch(),closest()and indexes: each result getskey(the property that matched) andranges(the parts oftextto highlight, to the character:New Yo|rk).acronymsoption, on with thesearchpreset:nycfinds New York City, one typo allowed from 3 letters on.index.toJSON()andloadIndex(): save an index as JSON and load it 2.5 times faster than rebuilding it.fingerprint()andgroup/dedupemethod: 'fingerprint': instant grouping of texts with the same words in any order.levenshtein(a, b, { max })anddamerau(a, b, { max }): stop early above a distance.- More metrics:
jaro(),overlap(),tversky(),ratcliffObershelp()(Python's difflib ratio). fuzzy-toolkit/react:useFuzzySearch()and<Highlight>. React is an optional peer dependency.- Minified browser builds for CDNs:
<script src="https://cdn.jsdelivr.net/npm/fuzzy-toolkit">givesfuzzyToolkit.npm run sizereports what each import weighs. npm run bench:versus: speed and accuracy against string-similarity, Fuse.js, fuzzysort and fastest-levenshtein on public data. See Compared with other libraries.llms.txtin the package and the repository, so AI coding assistants know the API.- Extension API:
defineLanguage()anddefinePreset(). Anyone can write a language pack (numbers in words, articles, stop words, phonetic rules) or a preset for one kind of data, and publish it on npm. See Languages and presets. languagesoption:['en', 'fr']by default, built-in codes or packs.stopwordsoption: ignore the stop words of the active languages.stripPatternsoption: your own regular expressions of noise to remove.presetaccepts a preset made withdefinePreset(), which canextendsa built-in one.fuzzy-toolkit/lang/enandfuzzy-toolkit/lang/fr: the built-in packs, to extend or read as examples.- CLI:
--presettakes a package or a file,--langpicks languages.
Changed
- English, French and the
music,searchandstrictpresets now run on the extension API. Results are identical: checked on 320,000 comparisons of real data against the previous code. The bundle grows by about 1.4 kB (min+gzip) forsimilarity. ResolvedOptions.presetis now the preset's name as astring, built-in or not.
Faster
levenshtein()anddamerau()on texts over 32 characters: blocked bit-parallel algorithms, 15 to 25 times faster, on par with fastest-levenshtein.- Searching skips items that lack too many of the query's letters, with the same results: up to 2.3 times faster.
compareTwoStrings/dice()2.2 times faster thanstring-similarity,findBestMatch3.5 times.dedupe(),group()andjoin()skip pairs that cannot match, with the same results: 3 to 5 times faster on real lists (5,000 song titles: 4.5 s → 1 s). The command line tool benefits too.
guess-rater 2.0.0: fuzzy matching that just works
guess-rater 2.0.0: fuzzy matching that just works
A full rewrite. One smart score that forgives typos, accents, word order, missing spaces and numbers written in words, plus one function per job: check answers, search as you type, suggest "did you mean…?", spot a name in a message, clean up duplicates, match two lists.
npm install guess-rater@2import { check, checkAll, search, closest, find, highlight, dedupe, join } from 'guess-rater'
check('bohemian rapsody', 'Bohemian Rhapsody').verdict // 'correct'
checkAll('bohemian rapsody de queen', { title: 'Bohemian Rhapsody', artist: 'Queen' }).found // ['title', 'artist']
closest('javascrpt', ['java', 'javascript', 'typescript'])?.item // 'javascript'📖 Documentation: https://tfoucher5.github.io/guess-rater/
✨ New
check()grades a guess ascorrect,close("almost!") orwrong, against one or several accepted answers.checkAll()grades a guess that names several things at once, such as a title and an artist, in any order.search(),closest(),dedupe(),group()work with strings or objects (keys, with optional weights:['title', { name: 'artist', weight: 0.8 }]).createIndex()prepares a list once, so each keystroke only scores the query.find()finds fuzzy occurrences of a text inside a longer one, with their positions.highlight()splits a text into matching and non-matching pieces, ready to render.join()pairs each item of a list with its best match in another;unique: trueuses each one at most once.- Presets:
music(dropsfeat.,- Remastered 2011,(Live), leading articles),search(prefixes and partial matches),strict. numbers(on by default):two,deux,IIand2compare equal.strip,replaceandignoreWordsoptions to clean up text, all on whole words.compare()shows the normalized texts and the score of each strategy, to tune your options.- Written in TypeScript: every option autocompletes, and
keysonly accepts properties that hold text. - ESM and CommonJS builds, zero dependencies, Node 18+ and every browser.
📊 Measured on real data
| Test | v2 |
|---|---|
| Blind test, 26,230 Spotify tracks: right guesses accepted | 97.6 % (v1: 70.1 %), 0 % of wrong songs |
check() per guess |
~25 µs |
| Search 26,230 songs, wanted song in top 10 | 82.3 % in ~40 ms per keystroke (Fuse.js: ~240 ms) |
| 150,653 cities, one typo, no accents: right city in top 5 | 100 % in ~70 ms |
| 20,000 English words, one typo: right word in top 3 | 98.8 % in ~6 ms |
Reproduce with npm run bench:real.
⚠️ Breaking changes
- New default algorithm
smart(Damerau-Levenshtein, word order and missing spaces ignored): similar texts generally score higher than in v1. Re-check your thresholds. - Options are flat: no more
normalize: { ... }block. - Each function always returns the same type (no more
explainorreturn: 'entries'switches). - Removed:
rate,getSimilarityScore,rankCandidates,findBestMatch,filterMatches,extract,normalizeString,getLevenshteinDistance,getLevenshteinScore,getJaroScore,getJaroWinklerScore,getTokenSortScore,getTokenSetScore, and thehybridalgorithm.
| v1 | v2 |
|---|---|
rate(a, b) / getSimilarityScore(a, b) |
similarity(a, b) |
rate(a, b, { explain: true }) |
compare(a, b) |
findBestMatch(q, list) |
closest(q, list) |
rankCandidates(q, list) |
search(q, list, { threshold: 0 }) |
filterMatches(q, list) / extract(q, list, { limit }) |
search(q, list, { limit }) |
getLevenshteinDistance(a, b) |
levenshtein(a, b) |
Full guide: https://tfoucher5.github.io/guess-rater/guide/migration
🐛 Fixes
replaceno longer replaces text inside words (stnever touchesstairs).- Texts made only of punctuation no longer score 100 against each other.
Full changelog: #8
v1.5.0 — Matcher completeness & docs overhaul
What's new
Added
filterMatches()andextract()are now accessible oncreateMatcher()instances:matcher.filterMatches(input, candidates, options?)matcher.extract(input, candidates, options?)
Fixed
spaceInsensitiveexplain in hybrid mode — when usinghybridwith bothtokenSortandtokenSetsub-algorithms andexplain: true, thespaceInsensitivepayload was writing thetokenSet
entry under the wrong key (tokenSort), causingtokenSetto be missing andtokenSortto be overwritten in the explain output. Both keys are now correctly populated.
Improved
- Documentation overhaul — complete rewrite of all guide and API pages:
- No repeated option descriptions — API pages link to canonical guide sections
- New List helpers guide with comparison table for
rankCandidates,findBestMatch,filterMatches,extract - Hybrid algorithm documentation merged into the Algorithms guide
- All recipe pages rewritten with real examples and cross-links
- Explain mode, normalization, algorithms, and threshold guides significantly improved
- Test structure:
spaceInsensitivetests were incorrectly nested inside a parent test callback — moved to top level for proper isolation
No breaking changes — fully backward compatible
v1.4.0 — extract() list helper (top N matches with threshold + optional details)
✨ Highlights
This release adds a new list utility: extract().
extract() is the “top matches” helper for list workflows:
rank → filter (threshold) → limit (top N)
It is designed to be simple by default, with optional detailed output when needed.
✅ Added: extract()
extract() compares an input string against a list of candidates and returns the top N matches.
Simple by default (values only)
By default, it returns a string[]:
import { extract } from 'guess-rater'
const results = extract('hello', ['hello', 'world'], {
threshold: 90,
limit: 5
})
console.log(results) // ['hello']Detailed on demand
If you need scores and indices, request entries:
const results = extract('hello', ['hello', 'world'], {
threshold: 90,
limit: 5,
return: 'entries'
})
// [{ value, score, index }, ...]Explain output (debug/tuning)
Explain details are available when using return: 'entries':
const results = extract('hello', ['hello', 'world'], {
threshold: 90,
limit: 5,
return: 'entries',
explain: true
})
// Each entry includes normalized strings + breakdown (like rate(..., { explain:true }))Notes:
explainis ignored when using the defaultreturn: 'values'(values-only mode).- No behavior changes to existing functions.
📚 Documentation
- Added a new API page documenting
extract() - Updated the exports list and navigation
🧪 Tests & quality
- Added unit tests covering:
- default values-only return (
string[]) - limit handling (
limit) - detailed entries return (
{ value, score, index }[]) - explain output behavior
- default values-only return (
🔄 Compatibility
- No breaking changes
- Backward compatible
- Existing behavior remains unchanged unless you call
extract()
v1.3.0 — filterMatches() list helper (pandas-like filtering for candidates)
✨ Highlights
This release adds a new list utility: filterMatches().
It is built for the common “dataset workflow”:
rank → filter → (optionally) inspect details
While staying simple by default.
✅ Added: filterMatches()
filterMatches() compares an input string against a list of candidates and keeps only the ones
that score at or above a threshold.
Simple by default
By default, it returns a string[] (values only):
import { filterMatches } from 'guess-rater'
const hits = filterMatches('hello', ['hello', 'world'], { threshold: 90 })
console.log(hits) // ['hello']Detailed on demand
If you need scores and indices, request entries:
const hits = filterMatches('hello', ['hello', 'world'], {
threshold: 90,
return: 'entries'
})
// [{ value, score, index }, ...]Explain output (debug/tuning)
Explain details are available when using return: 'entries':
const hits = filterMatches('hello', ['hello', 'world'], {
threshold: 90,
return: 'entries',
explain: true
})
// Each entry includes normalized strings + breakdownNotes:
explainis ignored when using the defaultreturn: 'values'(values-only mode).- No behavior changes to existing functions.
📚 Documentation
- Added a new API page documenting
filterMatches() - Updated exports list and navigation
🧪 Tests & quality
- Added unit tests covering:
- default values-only return (
string[]) - detailed entries return (
{ value, score, index }[]) - explain output behavior
- threshold filtering correctness
- default values-only return (
🔄 Compatibility
- No breaking changes
- Backward compatible
- Existing behavior remains unchanged unless you call
filterMatches()
v1.2.1 — Major DX upgrade: smarter autocomplete & clearer TypeScript typings
✨ Highlights
This release is focused on developer experience: improved IDE autocomplete, safer configuration objects,
and clearer “hover docs” — without changing runtime behavior.
If you use VS Code / WebStorm (or any TypeScript-powered editor), you’ll immediately notice:
- better suggestions for options (
algorithm,normalize,hybrid, etc.) - clearer inline documentation for each option
- smarter return types when using
explain: true
✅ What changed
1) Stronger TypeScript declarations (.d.ts)
- Expanded and clarified public API types
- Improved descriptions on key options and behavior
- Added more precise types for algorithm-specific options (
jaroWinkler,tokenSort,tokenSet,hybrid)
2) Overloads for better IDE inference
The typings now correctly infer return values based on explain:
rate(..., { explain: true })→ returns an object (RateExplainResult)rate(..., { explain: false })or without explain → returns a number
Same improvement applies to:
rankCandidates()(returns explained items whenexplain: true)findBestMatch()(returns explained best match whenexplain: true)
3) Clearer documentation in tooltips
Key options are now documented directly in hover tooltips, including:
- algorithm guidance (when to use what)
- normalization behavior
spaceInsensitivebehavior (opt-in, char-based only)
🛠 Runtime impact
- No runtime changes
- No behavior changes unless you update your own code usage
- This is a DX-only release: safer types + better autocomplete
🔄 Versioning
- 1.2.0 → 1.2.1
- Patch release (backward compatible)
❤️ Thanks
Thanks to everyone testing and providing feedback -- keep the issues and PRs coming!