Python bindings for the Rust fuzzy-aho-corasick crate.
Project description
fuzzy-aho-corasick
Python bindings for the Rust fuzzy-aho-corasick crate using PyO3 and maturin.
The wrapper currently exposes the upstream crate's main global builder options and a Python-side Pattern type for per-pattern configuration:
- Build a fuzzy matcher from a list of patterns
- Configure per-pattern weights
- Configure per-pattern custom unique IDs
- Configure per-pattern fuzzy limits
- Configure global edit limits
- Configure global penalty weights
- Run fuzzy search, split, and text segmentation helpers
- Build a fuzzy replacer from
(pattern, replacement)pairs
Python API
from fuzzy_aho_corasick import FuzzyMatcher, FuzzyReplacer, Pattern
matcher = FuzzyMatcher(
[
Pattern("hello", edits=1, weight=1.5, custom_unique_id=7),
Pattern("world", substitutions=1),
],
case_insensitive=True,
)
matches = matcher.search("H3llo W0rld!", threshold=0.7)
for match in matches:
print(match.pattern, match.text, match.similarity, match.pattern_custom_unique_id)
split_matcher = FuzzyMatcher(
["FOO", "BAR"],
edits=1,
case_insensitive=True,
)
assert matcher.search("H3llo W0rld!", threshold=0.7)[0].pattern == "hello"
assert split_matcher.split("xxFo0yyBAARzz", threshold=0.8) == ["xx", "yy", "zz"]
assert matcher.pattern_specs[0].custom_unique_id == 7
replacer = FuzzyReplacer(
[
(Pattern("foo", substitutions=1), "bar"),
(Pattern("baz", custom_unique_id=2), "qux"),
],
case_insensitive=True,
)
assert replacer.replace("fo0 and BAZ!", threshold=0.7) == "bar and qux!"
Local development
-
Install Rust using
rustup. -
Install maturin:
py -m pip install --upgrade maturin. -
Build and install the extension into your active environment:
maturin develop
-
Run tests:
pytest
Build distributions
Build wheels and an sdist locally:
maturin build --release
maturin sdist
Artifacts will land under target/wheels/ or the --out directory if you set one.
Publish to PyPI
Manual publish
maturin publish --release
GitHub Actions publish
This repository includes a workflow at .github/workflows/release.yml that:
- builds wheels on Linux, macOS, and Windows
- builds a source distribution
- uploads them to PyPI on tag pushes like
v0.1.0
Recommended setup:
- Create the project on PyPI.
- Enable trusted publishing for your GitHub repository on PyPI.
- Replace the placeholder GitHub URLs in
pyproject.toml. - Push a version tag such as
v0.1.0.
Notes
- The Python wrapper is intentionally small and focused on the upstream crate's core operations.
- Before publishing, update the author and project URLs in
pyproject.toml.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fuzzy_aho_corasick_rs-0.1.0.tar.gz.
File metadata
- Download URL: fuzzy_aho_corasick_rs-0.1.0.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47f67011de4c0c9e951ce4b8485eb0d0ce5bb425ec7e965210133b86b04bafa8
|
|
| MD5 |
2b9eecb520e4e5c6779e90de8f7deaf4
|
|
| BLAKE2b-256 |
c7c82ed844be61b8aea6b680a3e60416c713e5fa4e831616db8134f6aa0c72c8
|
Provenance
The following attestation bundles were made for fuzzy_aho_corasick_rs-0.1.0.tar.gz:
Publisher:
release.yml on vineel7871/fuzzy-aho-corasick-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fuzzy_aho_corasick_rs-0.1.0.tar.gz -
Subject digest:
47f67011de4c0c9e951ce4b8485eb0d0ce5bb425ec7e965210133b86b04bafa8 - Sigstore transparency entry: 1455898388
- Sigstore integration time:
-
Permalink:
vineel7871/fuzzy-aho-corasick-rs@2f0d6096f81eefe1baece391bc915c76f9b7b553 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/vineel7871
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2f0d6096f81eefe1baece391bc915c76f9b7b553 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 255.8 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b467a35137cf74c790cb0ed935cdbe1c0e8efa91e220a81fc87d80ee29c42a1
|
|
| MD5 |
b78215ebeec7245520e8f211609fb04d
|
|
| BLAKE2b-256 |
e9d74acb83354fb9daba1438f0af46cb3446267c88dd1a5b33d5b0eae884eb55
|
Provenance
The following attestation bundles were made for fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on vineel7871/fuzzy-aho-corasick-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-win_amd64.whl -
Subject digest:
8b467a35137cf74c790cb0ed935cdbe1c0e8efa91e220a81fc87d80ee29c42a1 - Sigstore transparency entry: 1455898510
- Sigstore integration time:
-
Permalink:
vineel7871/fuzzy-aho-corasick-rs@2f0d6096f81eefe1baece391bc915c76f9b7b553 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/vineel7871
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2f0d6096f81eefe1baece391bc915c76f9b7b553 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 404.6 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d98cfd307ec01771fda406169704db4f184e4030d1c70fe41efa9baa9636a8ad
|
|
| MD5 |
23905015a63ae32bab0df554cf0dc432
|
|
| BLAKE2b-256 |
14ee462f24db1e63f1d8048bc10e39d1f60436645c37e10bf2dc184dcb5ed084
|
Provenance
The following attestation bundles were made for fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on vineel7871/fuzzy-aho-corasick-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
d98cfd307ec01771fda406169704db4f184e4030d1c70fe41efa9baa9636a8ad - Sigstore transparency entry: 1455898804
- Sigstore integration time:
-
Permalink:
vineel7871/fuzzy-aho-corasick-rs@2f0d6096f81eefe1baece391bc915c76f9b7b553 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/vineel7871
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2f0d6096f81eefe1baece391bc915c76f9b7b553 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 374.7 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2127e8890e1979cff8c78c9aba12d0ad8f15b6b321d6f05c631768376a08a9e3
|
|
| MD5 |
f362ea286eb6f7623d7fc6875ea070dd
|
|
| BLAKE2b-256 |
1feefc384c5cad72ac07cf3dc982ec6813606f053215f167368004a45ab1d83d
|
Provenance
The following attestation bundles were made for fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on vineel7871/fuzzy-aho-corasick-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fuzzy_aho_corasick_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
2127e8890e1979cff8c78c9aba12d0ad8f15b6b321d6f05c631768376a08a9e3 - Sigstore transparency entry: 1455898720
- Sigstore integration time:
-
Permalink:
vineel7871/fuzzy-aho-corasick-rs@2f0d6096f81eefe1baece391bc915c76f9b7b553 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/vineel7871
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2f0d6096f81eefe1baece391bc915c76f9b7b553 -
Trigger Event:
push
-
Statement type: