ffzf
Fast fuzzy string matching for Python.
Installation
pip install ffzf
Usage
from ffzf import closest
best_match = closest("hello", ["harps", "apples", "jello"])
from ffzf import n_closest
best_matches = n_closest("hello", ["harps", "apples", "jello"], 2)
from ffzf import JAROWINKLER
best_match = closest("hello", ["harps", "apples", "jello"], algorithm=JAROWINKLER)
from ffzf import levenshtein_distance
dist = levenshtein_distance("hello", "jello")
dist = levenshtein_distance("Hello", "hello", case_sensitive=True)
best_match = closest("Hello", ["harps", "apples", "jello"], case_sensitive=True)
dist = levenshtein_distance("hello world", "helloworld", remove_whitespace=True)
from ffzf import n_closest_with_score
best_matches = n_closest_with_score("hello", ["harps", "apples", "jello"], 2)
Supported Algorithms
- Levenshtein Distance (default)
- Jaro Similarity ("JARO")
- Jaro-Winkler Similarity ("JAROWINKLER")
- Hamming Distance ("HAMMING")