Skip to main content

FastFuzzy

A Python module for fuzzy string matching and similarity measuring with constant lookup time by building an in-memory index.

This package relies on abydos, providing a sheer endless amount of distance metrics.

Installation

pip install fuzzyfast

Usage

Create Index

from fastfuzzy import QGramIndex

index = QGramIndex(tokens=["word1", "word2"], q=2)

Or use the class methods to read the tokens from a file:

with open("file.txt") as f:
    index = QGramIndex.from_file(f)

Or:

index = QGramIndex.from_path("file.txt")

In both cases, the input file is expected to be a list of tokens line by line.

Query for most similar token

index.max_sim("word1")
("word1", 1.0)

If no token in the index as any overlap with the input token, it returns (None, 0.0).

Merge two indices

index1 = QGramIndex(tokens=["token1"])
index2 = QGramIndex(tokens=["token2"])
index3 = index1 + index2

Alternative distance metrics

By default, the index uses the standard QGram distance metric. Alternatively, all other metrics defined in the abydos distance package can be specified with the cmp argument:

QGramIndex(tokens=[...], cmp=abydos.distance.PositionalQGramDice)

Testing

In order to run the tests locally, install the test dependencies:

pip install -e .
pip install -e .[test]

And run the tests:

pytest -v --cov=src tests/

Metadata

Release files for fastfuzzy 0.0.6

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

Source distribution (sdist)

Source distribution for fastfuzzy 0.0.6
File Size Uploaded
fastfuzzy-0.0.6.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastfuzzy 0.0.6
File Interpreter ABI Platform
fastfuzzy-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / fastfuzzy-0.0.6.tar.gz

Download URL fastfuzzy-0.0.6.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
39bcf3d8b7628176675de8879d49027b4dfe6a44ebf081631738f325bcd2dc09
BLAKE2b-256 checksum
How to use checksums
b16589475642c89fdde8a30e4142b199bc4a45e79ac379e10918f219a710f13f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7

Release files / fastfuzzy-0.0.6-py3-none-any.whl

Download URL fastfuzzy-0.0.6-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d2e84ef72574a31e483e2aecd214a1f99c9a8f8ae8121a1ed352d027cd64b7f
BLAKE2b-256 checksum
How to use checksums
16d1d05b0a3f9a0954348b2ed77cc9b656897378ccace831a54a0f991201eaf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.1

3 release files

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