Use rapidfuzz to compare strings
This commit is contained in:
@@ -64,14 +64,14 @@ from deezspot.models.callback.album import albumObject as albumCbObject
|
||||
from deezspot.models.callback.playlist import playlistObject as playlistCbObject
|
||||
from deezspot.models.callback.common import IDs
|
||||
from deezspot.models.callback.user import userObject
|
||||
|
||||
from rapidfuzz import fuzz
|
||||
|
||||
def _sim(a: str, b: str) -> float:
|
||||
a = (a or '').strip().lower()
|
||||
b = (b or '').strip().lower()
|
||||
if not a or not b:
|
||||
return 0.0
|
||||
return SequenceMatcher(None, a, b).ratio()
|
||||
return fuzz.partial_ratio(a, b) / 100
|
||||
|
||||
# Clean for searching on Deezer
|
||||
def _remove_parentheses(string: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user