Fuzzy string matching like a boss. It uses Levenshtein Distance to calculate the differences between sequences in a simple-to-use package.
- Python 3.8 or higher
- rapidfuzz
- pycodestyle
- hypothesis
- pytest
Using pip via PyPI
Using pip via GitHub
Adding to your requirements.txt
file (run pip install -r requirements.txt
afterwards)
Manually via GIT
You can also pass additional parameters to extractOne
method to make it use a specific scorer. A typical use case is to match file paths:
>>> process.extractOne("System of a down - Hypnotize - Heroin", songs)
('/music/library/good/System of a Down/2005 - Hypnotize/01 - Attack.mp3', 86)
>>> process.extractOne("System of a down - Hypnotize - Heroin", songs, scorer=fuzz.token_sort_ratio)
("/music/library/good/System of a Down/2005 - Hypnotize/10 - She's Like Heroin.mp3", 61)