Skip to content

Releases

v2.6.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 21:47
8a1d122

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

  • substring option: like partial, and a match may also start inside a word, so phone finds iPhone 15 and ville finds Belleville. No more includes() 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-plugin or reviewed in docs/extensions.json, with a fuzzy search box. The site rebuilds weekly so new packages appear.

Changed

  • npx fuzzy-toolkit ai-setup only writes when the project's package.json lists fuzzy-toolkit (--force to write anyway), writes a shorter block that tells assistants to go through the project's existing calls, links the online llms.txt instead of a node_modules path that may not exist, and never replaces a block someone edited by hand (--force does).
  • The MCP check tool 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

  • search preset: 2.2.0 added acronyms: true in a minor version, which can return more results than 2.1. Documented, with acronyms: false to get the old behavior back.
  • Size: createMatcher carries 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

Choose a tag to compare

@github-actions github-actions released this 26 Nov 17:52
a9f2c1f

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

v2.4.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 16:53
7ca0be0

Added

  • Spanish, German and Italian language packs: fuzzy-toolkit/lang/es, /de and /it. Numbers in words (treinta y dos, einundzwanzig, ventitré), ordinals, articles, stop words and phonetic rules. Import one and pass it in languages; 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 }) and assertPreset(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

Choose a tag to compare

@Tfoucher5 Tfoucher5 released this 26 Nov 15:21
8d7184d

v2.3.0

Added

  • MCP server for AI agents: npx fuzzy-toolkit mcp gives Claude, Cursor, VS Code and other agents the tools compare, closest, search, dedupe, join, check and find. Local, no dependency, no file access. See AI agents and assistants.
  • npx fuzzy-toolkit ai-setup: adds a short usage block to your project's AGENTS.md, CLAUDE.md, Cursor rules or Copilot instructions, and updates it in place next time.
  • llms-full.txt in 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.8 threshold when scores go to 100, a keys name 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

Choose a tag to compare

@Tfoucher5 Tfoucher5 released this 26 Nov 14:47
e9a0ae2

v2.2.0

Added

  • fuzzy-toolkit/string-similarity: drop-in replacement for the unmaintained string-similarity package. compareTwoStrings() and findBestMatch() give the same results; only the import changes.
  • Classic metrics: dice(), jaccard(), cosine() (on chunks of n letters), hamming() and lcs() (longest common subsequence).
  • Nested keys: keys: ['artist.name', 'tags.label'], arrays included, checked by TypeScript.
  • includeMatches option of search(), closest() and indexes: each result gets key (the property that matched) and ranges (the parts of text to highlight, to the character: New Yo|rk).
  • acronyms option, on with the search preset: nyc finds New York City, one typo allowed from 3 letters on.
  • index.toJSON() and loadIndex(): save an index as JSON and load it 2.5 times faster than rebuilding it.
  • fingerprint() and group/dedupe method: 'fingerprint': instant grouping of texts with the same words in any order.
  • levenshtein(a, b, { max }) and damerau(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"> gives fuzzyToolkit. npm run size reports 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.txt in the package and the repository, so AI coding assistants know the API.
  • Extension API: defineLanguage() and definePreset(). 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.
  • languages option: ['en', 'fr'] by default, built-in codes or packs.
  • stopwords option: ignore the stop words of the active languages.
  • stripPatterns option: your own regular expressions of noise to remove.
  • preset accepts a preset made with definePreset(), which can extends a built-in one.
  • fuzzy-toolkit/lang/en and fuzzy-toolkit/lang/fr: the built-in packs, to extend or read as examples.
  • CLI: --preset takes a package or a file, --lang picks languages.

Changed

  • English, French and the music, search and strict presets 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) for similarity.
  • ResolvedOptions.preset is now the preset's name as a string, built-in or not.

Faster

  • levenshtein() and damerau() 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 than string-similarity, findBestMatch 3.5 times.
  • dedupe(), group() and join() 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

Choose a tag to compare

@Tfoucher5 Tfoucher5 released this 16 Oct 14:02
ee5f108

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@2
import { 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 as correct, close ("almost!") or wrong, 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: true uses each one at most once.
  • Presets: music (drops feat., - Remastered 2011, (Live), leading articles), search (prefixes and partial matches), strict.
  • numbers (on by default): two, deux, II and 2 compare equal.
  • strip, replace and ignoreWords options 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 keys only 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 explain or return: 'entries' switches).
  • Removed: rate, getSimilarityScore, rankCandidates, findBestMatch, filterMatches, extract, normalizeString, getLevenshteinDistance, getLevenshteinScore, getJaroScore, getJaroWinklerScore, getTokenSortScore, getTokenSetScore, and the hybrid algorithm.
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

  • replace no longer replaces text inside words (st never touches stairs).
  • Texts made only of punctuation no longer score 100 against each other.

Full changelog: #8

v1.5.0 — Matcher completeness & docs overhaul

Choose a tag to compare

@Tfoucher5 Tfoucher5 released this 22 Apr 17:50

What's new

Added

  • filterMatches() and extract() are now accessible on createMatcher() instances:
    • matcher.filterMatches(input, candidates, options?)
    • matcher.extract(input, candidates, options?)

Fixed

  • spaceInsensitive explain in hybrid mode — when using hybrid with both tokenSort and tokenSet sub-algorithms and explain: true, the spaceInsensitive payload was writing the tokenSet
    entry under the wrong key (tokenSort), causing tokenSet to be missing and tokenSort to 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: spaceInsensitive tests 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)

Choose a tag to compare

@Tfoucher5 Tfoucher5 released this 22 Apr 13:34

✨ 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:

  • explain is ignored when using the default return: '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

🔄 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)

Choose a tag to compare

@Tfoucher5 Tfoucher5 released this 22 Apr 13:07

✨ 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 + breakdown

Notes:

  • explain is ignored when using the default return: '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

🔄 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

Choose a tag to compare

@Tfoucher5 Tfoucher5 released this 22 Apr 09:26

✨ 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 when explain: true)
  • findBestMatch() (returns explained best match when explain: true)

3) Clearer documentation in tooltips

Key options are now documented directly in hover tooltips, including:

  • algorithm guidance (when to use what)
  • normalization behavior
  • spaceInsensitive behavior (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!