find similar strings in list python using fuzzy code example
Example 1: fuzzy lookup in python
from fuzzywuzzy import process
str2Match = "apple inc"
strOptions = ["Apple Inc.","apple park","apple incorporated","iphone"]
Ratios = process.extract(str2Match,strOptions)
print(Ratios)
highest = process.extractOne(str2Match,strOptions)
print(highest)
Example 2: approximate string matching python
pip install fuzzywuzzy
from fuzzywuzzy import fuzz
fuzz.ratio("Catherine M Gitau","Catherine Gitau")
fuzz.partial_ratio("Catherine M. Gitau","Catherine Gitau")