Spaces:
Runtime error
Runtime error
Update menu.py
Browse files
menu.py
CHANGED
@@ -144,6 +144,7 @@ def menu():
|
|
144 |
|
145 |
# Track the frequency of spice levels
|
146 |
for addon in addons:
|
|
|
147 |
for spice in spice_levels:
|
148 |
if spice.lower() in addon.lower():
|
149 |
spice_counts[spice] = spice_counts.get(spice, 0) + 1
|
@@ -152,22 +153,28 @@ def menu():
|
|
152 |
for instruction in instructions:
|
153 |
if instruction:
|
154 |
instruction_counts[instruction] = instruction_counts.get(instruction, 0) + 1
|
155 |
-
|
156 |
-
|
|
|
157 |
|
158 |
# Get the most common add-ons, including spice levels
|
159 |
most_common_addons = sorted(addon_counts, key=addon_counts.get, reverse=True)[:3]
|
160 |
most_common_instructions = sorted(instruction_counts, key=instruction_counts.get, reverse=True)[:3]
|
161 |
# Print to check the final most common add-ons and instructions
|
162 |
-
print(
|
|
|
|
|
163 |
|
164 |
# Include most ordered spice level if it's not already in the top 3
|
165 |
if not any(spice in most_common_addons for spice in spice_levels):
|
166 |
most_ordered_spice = max(spice_counts, key=spice_counts.get, default=None)
|
167 |
if most_ordered_spice:
|
|
|
168 |
most_common_addons.append(most_ordered_spice)
|
169 |
most_common_addons = most_common_addons[:3]
|
170 |
-
|
|
|
|
|
171 |
categories = ["All", "Veg", "Non veg"]
|
172 |
|
173 |
except Exception as e:
|
|
|
144 |
|
145 |
# Track the frequency of spice levels
|
146 |
for addon in addons:
|
147 |
+
print(f"Addon: {addon.strip()}")
|
148 |
for spice in spice_levels:
|
149 |
if spice.lower() in addon.lower():
|
150 |
spice_counts[spice] = spice_counts.get(spice, 0) + 1
|
|
|
153 |
for instruction in instructions:
|
154 |
if instruction:
|
155 |
instruction_counts[instruction] = instruction_counts.get(instruction, 0) + 1
|
156 |
+
print("\nAddon counts:")
|
157 |
+
for addon, count in addon_counts.items():
|
158 |
+
print(f"{addon}: {count}")
|
159 |
|
160 |
# Get the most common add-ons, including spice levels
|
161 |
most_common_addons = sorted(addon_counts, key=addon_counts.get, reverse=True)[:3]
|
162 |
most_common_instructions = sorted(instruction_counts, key=instruction_counts.get, reverse=True)[:3]
|
163 |
# Print to check the final most common add-ons and instructions
|
164 |
+
print("\nTop 3 Most Common Add-Ons:")
|
165 |
+
for addon in most_common_addons:
|
166 |
+
print(f"{addon}")
|
167 |
|
168 |
# Include most ordered spice level if it's not already in the top 3
|
169 |
if not any(spice in most_common_addons for spice in spice_levels):
|
170 |
most_ordered_spice = max(spice_counts, key=spice_counts.get, default=None)
|
171 |
if most_ordered_spice:
|
172 |
+
print(f"\nMost Ordered Spice: {most_ordered_spice}")
|
173 |
most_common_addons.append(most_ordered_spice)
|
174 |
most_common_addons = most_common_addons[:3]
|
175 |
+
print("\nFinal Most Common Add-Ons (Including Spice Level):")
|
176 |
+
for addon in most_common_addons:
|
177 |
+
print(f"{addon}")
|
178 |
categories = ["All", "Veg", "Non veg"]
|
179 |
|
180 |
except Exception as e:
|