File size: 3,740 Bytes
2fcbbcc 04ae031 560c288 2fcbbcc caa5555 560c288 04ae031 2169248 2fcbbcc 560c288 2fcbbcc 560c288 2169248 04ae031 2fcbbcc caa5555 2fcbbcc caa5555 560c288 caa5555 2b2c892 560c288 2b2c892 560c288 caa5555 560c288 caa5555 2fcbbcc 1e1431e 04ae031 caa5555 560c288 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
def detect_intent(message: str):
"""
A robust, rule-based classifier for warehouse AI tasks.
Returns one of:
- "slotting"
- "picking"
- "forecast"
- "replenishment"
- "rebalancing"
- "workforce"
- "dock"
- "report"
"""
msg = message.lower().strip()
# -----------------------------
# FULL REPORT KEYWORDS (Highest Priority)
# -----------------------------
report_keywords = [
"full report", "overall performance", "warehouse report",
"summary", "end to end", "combined", "complete report",
"all optimizations", "generate full report"
]
# -----------------------------
# DEMAND FORECASTING KEYWORDS
# -----------------------------
forecast_keywords = [
"forecast", "predict", "demand", "future usage",
"consumption trend", "estimate usage", "project demand",
"usage forecast"
]
# -----------------------------
# REPLENISHMENT KEYWORDS
# -----------------------------
replenish_keywords = [
"replenish", "refill", "stock level", "stock levels",
"stockout", "stock-out", "low stock", "running low",
"replenishment", "min max", "restock", "safety stock"
]
# -----------------------------
# INVENTORY REBALANCING KEYWORDS
# -----------------------------
rebalancing_keywords = [
"rebalance", "redistribute", "inventory balancing",
"zone balancing", "congestion", "reduce aisle load",
"balance inventory", "redistribution"
]
# -----------------------------
# WORKFORCE OPTIMIZATION KEYWORDS
# -----------------------------
workforce_keywords = [
"workforce", "staff", "labour", "labor", "manpower",
"how many workers", "allocate workers", "workload",
"staffing requirement", "optimize workforce"
]
# -----------------------------
# DOCK SCHEDULING KEYWORDS
# -----------------------------
dock_keywords = [
"dock", "dock scheduling", "loading bay", "unloading",
"assign dock", "dock allocation", "door scheduling",
"truck scheduling"
]
# -----------------------------
# 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"
]
# -----------------------------
# PRIORITY ORDER:
# 1. Full report
# 2. Forecast
# 3. Replenishment
# 4. Rebalancing
# 5. Workforce
# 6. Dock Scheduling
# 7. Slotting
# 8. Picking
# -----------------------------
if any(k in msg for k in report_keywords):
return "report"
if any(k in msg for k in forecast_keywords):
return "forecast"
if any(k in msg for k in replenish_keywords):
return "replenishment"
if any(k in msg for k in rebalancing_keywords):
return "rebalancing"
if any(k in msg for k in workforce_keywords):
return "workforce"
if any(k in msg for k in dock_keywords):
return "dock"
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"
|