Spaces:
Sleeping
Sleeping
File size: 487 Bytes
3eed03b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fuzzywuzzy import fuzz
class isCache:
def __init__(self, status, closest_match) -> None:
self.status = status
self.closest_match = closest_match
def in_cache (message: str, keysList: list):
highest_score = 0
for s in keysList:
score = fuzz.partial_token_sort_ratio(message, s)
if score > highest_score:
highest_score = score
if highest_score > 90:
return isCache(True, s)
return isCache(False, None)
|