Commit ·
d38be39
1
Parent(s): dc8fc02
fix: protein bars → bag suffix, ice cream → tub suffix
Browse filesProtein Gourmet Bar and Billion Protein Peanut Bar were hitting
supplement_keywords and getting suffix ' tub jar bag'. DINO then matched
the ice cream tub (a tub shape) for the bar query, stealing the box
from the actual Zero Ice Cream product.
- Add bar detection (regex \bbar\b) before supplement_keywords → ' bag'
- Add ice cream / gelato detection before all others → ' tub'
- Add speculoos, biscoff, lotus, pistachio, tiramisu, cheesecake
to flavors list so ice cream variant names are stripped correctly
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -134,6 +134,8 @@ def _clean_product_name(name: str) -> str:
|
|
| 134 |
"salt", "coconut", "almond", "walnut", "cashew",
|
| 135 |
# Legume/grain ingredients used as snack flavour variants (e.g. "Chips – Lentils & Pea Protein")
|
| 136 |
"lentil", "lentils", "pea", "chickpea", "bean", "soy",
|
|
|
|
|
|
|
| 137 |
]
|
| 138 |
parts = re.split(r'\s*[-–]\s*', clean_name, maxsplit=1)
|
| 139 |
if len(parts) == 2:
|
|
@@ -168,7 +170,18 @@ def _get_packaging_suffix(name: str) -> str:
|
|
| 168 |
if any(kw in name_lower for kw in wearable_keywords):
|
| 169 |
return ""
|
| 170 |
|
| 171 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
# doesn't fall into grain_keywords ("rice") or canned_keywords ("chicken breast")
|
| 173 |
meal_keywords = [
|
| 174 |
"meal", "bowl", "stew", "curry", "soup", "lasagna", "lasagne",
|
|
|
|
| 134 |
"salt", "coconut", "almond", "walnut", "cashew",
|
| 135 |
# Legume/grain ingredients used as snack flavour variants (e.g. "Chips – Lentils & Pea Protein")
|
| 136 |
"lentil", "lentils", "pea", "chickpea", "bean", "soy",
|
| 137 |
+
# Ice cream flavour variants
|
| 138 |
+
"speculoos", "biscoff", "lotus", "pistachio", "tiramisu", "cheesecake",
|
| 139 |
]
|
| 140 |
parts = re.split(r'\s*[-–]\s*', clean_name, maxsplit=1)
|
| 141 |
if len(parts) == 2:
|
|
|
|
| 170 |
if any(kw in name_lower for kw in wearable_keywords):
|
| 171 |
return ""
|
| 172 |
|
| 173 |
+
# Ice cream / frozen desserts — checked FIRST so "Zero Ice Cream" doesn't fall through
|
| 174 |
+
# to the default " bag tub jar" and potentially match a bar bag instead
|
| 175 |
+
if "ice cream" in name_lower or "gelato" in name_lower or "frozen yogurt" in name_lower:
|
| 176 |
+
return " tub"
|
| 177 |
+
|
| 178 |
+
# Protein/snack bars — always sold in sealed bags, never tubs.
|
| 179 |
+
# Checked BEFORE supplement_keywords to prevent "Protein Bar" → " tub jar bag"
|
| 180 |
+
# which causes DINO to match ice cream tubs for bar queries.
|
| 181 |
+
if re.search(r'\bbar\b', name_lower):
|
| 182 |
+
return " bag"
|
| 183 |
+
|
| 184 |
+
# Ready meals / frozen food — checked BEFORE grain/canned so "Tandoori Chicken with Lime Rice"
|
| 185 |
# doesn't fall into grain_keywords ("rice") or canned_keywords ("chicken breast")
|
| 186 |
meal_keywords = [
|
| 187 |
"meal", "bowl", "stew", "curry", "soup", "lasagna", "lasagne",
|