File size: 1,582 Bytes
2fcbbcc 04ae031 2fcbbcc 04ae031 2169248 2fcbbcc 2169248 04ae031 2fcbbcc 2169248 04ae031 2fcbbcc 1e1431e 04ae031 2fcbbcc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
def detect_intent(message: str):
"""
A robust, rule-based classifier for warehouse tasks.
Returns one of:
- "slotting"
- "picking"
- "report"
"""
msg = message.lower().strip()
# -----------------------------
# SLOTING KEYWORDS
# -----------------------------
slot_keywords = [
"slot", "slotting", "putaway", "storage location",
"rearrange items", "reorganize racks", "optimize space",
"velocity", "sku placement", "bin allocation"
]
# -----------------------------
# PICKING KEYWORDS
# -----------------------------
pick_keywords = [
"pick", "picking", "route", "path", "walk sequence",
"shortest path", "aisle", "rack", "order fulfillment",
"picklist"
]
# -----------------------------
# FULL REPORT KEYWORDS
# -----------------------------
report_keywords = [
"full report", "overall performance", "warehouse report",
"summary", "end to end", "combined", "complete report",
"all optimizations"
]
# -----------------------------
# PRIORITY: Full Report → Slotting → Picking
# (Prevents overlap confusion)
# -----------------------------
if any(k in msg for k in report_keywords):
return "report"
if any(k in msg for k in slot_keywords):
return "slotting"
if any(k in msg for k in pick_keywords):
return "picking"
# -----------------------------
# UNKNOWN → DEFAULT TO REPORT
# -----------------------------
return "report"
|