Python library: thefuzz

Fuzzy string matching

13 Nov 2022

New name for library fuzzywuzzy

Library resources
PyPI https://pypi.org/project/fuzzywuzzy/
Github https://github.com/seatgeek/thefuzz
Table of Contents

Getting Started

pip install thefuzz

Usage

from thefuzz import fuzz
from thefuzz import process

fuzz.ratio("this is a test", "this is a test!")

⬇︎

97

process

choices = ["Atlanta Falcons", "New York Jets", "New York Giants", "Dallas Cowboys"]

process.extract("new york jets", choices, limit=2)

⬇︎

[('New York Jets', 100), ('New York Giants', 78)]

or

process.extractOne("cowboys", choices)

⬇︎

("Dallas Cowboys", 90)

links

social