|
|
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() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
report_keywords = [ |
|
|
"full report", "overall performance", "warehouse report", |
|
|
"summary", "end to end", "combined", "complete report", |
|
|
"all optimizations", "generate full report" |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forecast_keywords = [ |
|
|
"forecast", "predict", "demand", "future usage", |
|
|
"consumption trend", "estimate usage", "project demand", |
|
|
"usage forecast" |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
replenish_keywords = [ |
|
|
"replenish", "refill", "stock level", "stock levels", |
|
|
"stockout", "stock-out", "low stock", "running low", |
|
|
"replenishment", "min max", "restock", "safety stock" |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rebalancing_keywords = [ |
|
|
"rebalance", "redistribute", "inventory balancing", |
|
|
"zone balancing", "congestion", "reduce aisle load", |
|
|
"balance inventory", "redistribution" |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workforce_keywords = [ |
|
|
"workforce", "staff", "labour", "labor", "manpower", |
|
|
"how many workers", "allocate workers", "workload", |
|
|
"staffing requirement", "optimize workforce" |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dock_keywords = [ |
|
|
"dock", "dock scheduling", "loading bay", "unloading", |
|
|
"assign dock", "dock allocation", "door scheduling", |
|
|
"truck scheduling" |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
slot_keywords = [ |
|
|
"slot", "slotting", "putaway", "storage location", |
|
|
"rearrange items", "reorganize racks", "optimize space", |
|
|
"velocity", "sku placement", "bin allocation" |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pick_keywords = [ |
|
|
"pick", "picking", "route", "path", "walk sequence", |
|
|
"shortest path", "aisle", "rack", "order fulfillment", |
|
|
"picklist" |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return "report" |
|
|
|