I am trying to call ratio() function from the library fuzzywuzzy to match two string and get the following error message:
AttributeError: module 'fuzzywuzzy' has no attribute 'ratio'
Has the version changed? I tried to look for other functions within fuzz to see if it exists, but I am unable to find it.
import fuzzywuzzy as fuzz
from fuzzywuzzy import process
import Levenshtein
fuzz.ratio('Lord of the Rings', 'The Lord of the Rings')
ratio
is a method of fuzzywuzzy.fuzz
. Use:
from fuzzywuzzy import fuzz
Then you can use:
fuzz.ratio('Lord of the Rings', 'The Lord of the Rings')
Change import to:
from fuzzywuzzy as fuzz
from fuzzywuzzy import process
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With