Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,11 +134,14 @@ def answer_lecturer_query(query):
|
|
| 134 |
|
| 135 |
if max_score >= 1:
|
| 136 |
if any(word in query for word in ["cosc", "geds", "ged"]):
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
| 142 |
else:
|
| 143 |
return process_query(query, best_match)
|
| 144 |
else:
|
|
|
|
| 134 |
|
| 135 |
if max_score >= 1:
|
| 136 |
if any(word in query for word in ["cosc", "geds", "ged"]):
|
| 137 |
+
for i, word in enumerate(query.split()):
|
| 138 |
+
if word.isdigit():
|
| 139 |
+
# Retrieve the prefix from the previous word
|
| 140 |
+
query_course_code = f"{query.split()[i - 1]} {word}"
|
| 141 |
+
if query_course_code.upper() == best_match['course_code']:
|
| 142 |
+
return process_query(query, best_match)
|
| 143 |
+
else:
|
| 144 |
+
return "Sorry, I couldn't find info about the course you've mentioned."
|
| 145 |
else:
|
| 146 |
return process_query(query, best_match)
|
| 147 |
else:
|