Meilleure recherche
This commit is contained in:
parent
c61098c06c
commit
5cae58907c
3
pages.py
3
pages.py
|
@ -81,7 +81,8 @@ def search(texte):
|
||||||
r = 1
|
r = 1
|
||||||
if key=="nom":
|
if key=="nom":
|
||||||
r = 3
|
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.sort(key=lambda x : x["score"])
|
||||||
totals.reverse()
|
totals.reverse()
|
||||||
totals = totals[:8]
|
totals = totals[:8]
|
||||||
|
|
Loading…
Reference in New Issue