From a3d3305d4b97fe91cd08b4f77eb4f58ea9fec0f8 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Sat, 16 Mar 2024 15:50:38 +0100 Subject: [PATCH] Finally implement the search --- memory.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/memory.py b/memory.py index bac5b69..ef57d52 100644 --- a/memory.py +++ b/memory.py @@ -60,6 +60,4 @@ def scalar(a, b): def find_best_quote(db, user_input): indexed_input = index(user_input) - max_score = None - for entry in db: - score = scalar(indexed_input, entry + return max(db, key=lambda row: scalar(indexed_input, row['index']))