Skip to main content

Python port of the fzy fuzzy string matching algorithm

Project description

pfzy

CI Docs Build Coverage Version PyPi License

Python port of the fzy fuzzy string matching algorithm.

Requirements

python >= 3.7

Installation

pip install pfzy

Quick Start

Full documentation: https://pfzy.readthedocs.io/

import asyncio

from pfzy import fuzzy_match

result = asyncio.run(fuzzy_match("ab", ["acb", "acbabc"]))
>>> print(result)
[{'value': 'acbabc', 'indices': [3, 4]}, {'value': 'acb', 'indices': [0, 2]}]

Background

fuzzywuzzy is a famous python package for performing fuzzy matching between strings powered by python-Levenshtein. While it does its job well it doesn't calculate/provide the matching indices which is essential in a fuzzy finder applications.

The fzy fuzzy matching algorithm can calculate the matching score while also providing the matching indices which fuzzy finder applications can use to provide extra highlights.

The initial implementation of this algorithm can be found at sweep.py which is a python implementation of the terminal fuzzy finder. The code snippet is later used by the project vim-clap.

I found myself needing this logic across multiple projects hence decided to strip out the logic and publish a dedicated package with detailed documentation and unittest.

Credit

LICENSE

All 3 projects mentioned in Credit are all licensed under MIT.

This project is licensed under MIT. Copyright (c) 2021 Kevin Zhuang

Project details


Download files

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

Source Distribution

pfzy-0.3.3.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

pfzy-0.3.3-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file pfzy-0.3.3.tar.gz.

File metadata

  • Download URL: pfzy-0.3.3.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.5 Linux/4.14.243-185.433.amzn2.x86_64

File hashes

Hashes for pfzy-0.3.3.tar.gz
Algorithm Hash digest
SHA256 3efd83e49d854830369173b44e64a2cd9adcb9d5382698a792474c7d18e2fe32
MD5 17d314b19769c663c9b988db1cbd25ca
BLAKE2b-256 85c9ca3b9b0b0cb1488abedde4977d6d824c148f51d9149426e1c4aebf1a6b4b

See more details on using hashes here.

File details

Details for the file pfzy-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: pfzy-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.5 Linux/4.14.243-185.433.amzn2.x86_64

File hashes

Hashes for pfzy-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 33682ed1929c5ff85c0c57e3b3cfa5c355063138be3560a1797378cf08fb05a2
MD5 0835297c7516fa335ad01676672b2723
BLAKE2b-256 e4fa9c632d01a9f9f04f319a95270eb2176f80e1fb610131ed193b1c65eda067

See more details on using hashes here.

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