Skip to main content

No project description provided

Project description

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.
  • Combined score — weighted blend of all three, used internally by best_match and rank_matches.

Notes

  • All functions normalise input (lowercase + trim) before comparing
  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

matchr-0.1.1-cp38-abi3-win_amd64.whl (133.8 kB view details)

Uploaded CPython 3.8+Windows x86-64

matchr-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (265.7 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

matchr-0.1.1-cp38-abi3-macosx_11_0_arm64.whl (237.6 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file matchr-0.1.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: matchr-0.1.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 133.8 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for matchr-0.1.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9ec9d025c4401322679c80b756e7b899c97e037daadf61ab02bc05efd0a33106
MD5 e2c55c98dbce5a7b7da60b1f2f393f6c
BLAKE2b-256 ad49bf94c551853d0d42b3f80d762b3a1f83bf9816dfb8a3c368a5e9e4ca3ca4

See more details on using hashes here.

Provenance

The following attestation bundles were made for matchr-0.1.1-cp38-abi3-win_amd64.whl:

Publisher: release.yml on mommo-codes/matchr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file matchr-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for matchr-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 14c7ef97ffd3e6214be94f9503d3ec7346d22858766e93b4c8cdcaaaab204273
MD5 25c6944d3af9a4fef2586956d8a3320c
BLAKE2b-256 64a0afdcb0039f782e7f352e8e0eac38f7a06db0feaf44615152b076d2f59537

See more details on using hashes here.

Provenance

The following attestation bundles were made for matchr-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on mommo-codes/matchr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file matchr-0.1.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for matchr-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86ad497fb85187a1b010686e3149669f045dd011192e35767566d90875f84e67
MD5 0609d632b5ab8d153fabb52e683bc6ca
BLAKE2b-256 517f85c22130f0fddf55d2a08519b6972b9692acb96b094cafafd38c54aae6a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for matchr-0.1.1-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on mommo-codes/matchr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page