Skip to main content

matchr

PyPI

Fast fuzzy string matching — written in Rust, usable from Python.

Install

pip install matchr

Python quick start

from matchr import best_match, rank_matches, batch_best_match

# find the closest match
best_match("oatly oat drink", ["Oatly Oat Drink 1L", "Oat Milk", "Oatly Barista"])
# → ('Oatly Oat Drink 1L', 0.902)

# filter weak matches with a threshold
best_match("xyz gibberish", ["Oatly Oat Drink 1L"], threshold=0.7)
# → None

# match many queries at once
batch_best_match(["oatly oat drink", "felix cat food"], catalog, threshold=0.7)
# → [('Oatly Oat Drink 1L', 0.902), ('Felix Cat Food 400g', 0.843)]

Rust usage

use matchr::{levenshtein, jaro_winkler, trigram_similarity};

fn main() {
    println!("{}", levenshtein("cat", "bat"));           // 1
    println!("{}", jaro_winkler("martha", "marhta"));    // 0.961
    println!("{}", trigram_similarity("hello", "helo")); // 0.4
}

Algorithms

  • Levenshtein — minimum edit distance between two strings. Lower = more similar.
  • Jaro-Winkler — similarity score from 0.0 to 1.0, optimised for names and short strings. Gives a bonus for shared prefixes.
  • Trigram — splits strings into overlapping 3-character chunks, scores overlap using the Dice coefficient. Good for longer strings and typo detection.
  • Token sort / token set — order-invariant scorers built on top of combined_score. Sorts (and optionally deduplicates) whitespace-separated tokens before comparing, so "Oat Drink Oatly 1L" and "Oatly Oat Drink 1L" come out equal.
  • Combined score — weighted blend of Levenshtein, Jaro-Winkler, and trigram. Used internally by best_match, rank_matches, and batch_best_match.

Benchmarks

See benchmarks/ for the criterion suite (cargo bench) and a Python comparison vs rapidfuzz. There's also a demo notebook that walks through deduping a synthetic 10k-product catalog end-to-end.

Notes

  • All functions normalise input (trim + lowercase + strip diacritics) before comparing — "Café" and "cafe" are treated as equal
  • levenshtein returns usize (edit distance), all others return f64 (0.0–1.0)
  • Python functions accept an optional threshold parameter — results below it are filtered out
  • batch_best_match is parallelised via rayon and pre-normalises the candidate list once, so it scales with available cores

Metadata

Release files for matchr 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for matchr 0.1.3
File Interpreter ABI Platform Actions
matchr-0.1.3-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for matchr-0.1.3-cp38-abi3-win_amd64.whl
matchr-0.1.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for matchr-0.1.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
matchr-0.1.3-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for matchr-0.1.3-cp38-abi3-macosx_11_0_arm64.whl

Total release size: 1.1 MB

Release files / matchr-0.1.3-cp38-abi3-win_amd64.whl

Download URL matchr-0.1.3-cp38-abi3-win_amd64.whl
Size 261.8 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2827870bf7a560c666af518b6c363c5c79d03bcecc20e650e5ce08701be0ce15
BLAKE2b-256 checksum
How to use checksums
ca2d9f3b0ba55faad029dadd1947faba6a2a2784e103cc24f617fb49d53e139b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / matchr-0.1.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL matchr-0.1.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 419.3 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
420d34c05621b881e0a25f0e0735b413f46dbeba13109fd0c5fc99f8e704c54f
BLAKE2b-256 checksum
How to use checksums
b6bf331a2b2f176dc0ba323a6234227f27863fecce4e98b34ebd0a70cf15d980
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / matchr-0.1.3-cp38-abi3-macosx_11_0_arm64.whl

Download URL matchr-0.1.3-cp38-abi3-macosx_11_0_arm64.whl
Size 377.1 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
28a3465c0a36a746a77a984fd84a5c8fd0911030ffb50a7becb16ef2b7e4c6ec
BLAKE2b-256 checksum
How to use checksums
b39d5a170d316d8e6ecb02cad5eb87fadb60b3ee5a5d5899c12a0eba410245ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Security for matchr 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for matchr-0.1.3-cp38-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page