Update utils.py
Browse files
utils.py
CHANGED
@@ -6,17 +6,19 @@ def clean_pinecone(response):
|
|
6 |
|
7 |
for entry in response['matches']:
|
8 |
code = entry['metadata']['code']
|
|
|
9 |
# score =
|
10 |
-
if
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
20 |
return classes, additional_metadata
|
21 |
|
22 |
def build_filter(json_response):
|
|
|
6 |
|
7 |
for entry in response['matches']:
|
8 |
code = entry['metadata']['code']
|
9 |
+
score = float(entry['score'])
|
10 |
# score =
|
11 |
+
if score > 0.69:
|
12 |
+
if code not in unique_codes:
|
13 |
+
#Where class is unique
|
14 |
+
classes.append(entry)
|
15 |
+
unique_codes.add(code)
|
16 |
+
else:
|
17 |
+
#Class already added, but need to save alternate sessions
|
18 |
+
time = entry['metadata']['time']
|
19 |
+
days = entry['metadata']['days']
|
20 |
+
additional_metadata[code] = {'time': time, 'days': days}
|
21 |
+
|
22 |
return classes, additional_metadata
|
23 |
|
24 |
def build_filter(json_response):
|