Meilleure recherche

This commit is contained in:
theo@manjaro 2021-12-03 04:45:58 +01:00
parent c61098c06c
commit 5cae58907c
1 changed files with 2 additions and 1 deletions

View File

@ -81,7 +81,8 @@ def search(texte):
r = 1
if key=="nom":
r = 3
i["score"] += SequenceMatcher(None, texte, str(i[key])).ratio()*r
i["score"] += SequenceMatcher(None, texte.lower(), str(i[key]).lower()).ratio()*r
print(i["nom"],i["score"])
totals.sort(key=lambda x : x["score"])
totals.reverse()
totals = totals[:8]