flowchart TD
Query["User Query
I need to change my
reservation for tomorrow"]:::inputNode
subgraph Text["Text Processing"]
direction TB
Norm["Text normalization
lowercase, remove punctuation"]:::preNode
Tok["Tokenization"]:::preNode
Stop["Stopword filtering
optional"]:::preOptional
Norm --> Tok --> Stop
end
subgraph Encode["Semantic Encoding"]
direction TB
TFIDF["TF-IDF vectorization"]:::featNode
BERT["BERT encoding
Recommended: better generalization"]:::featBest
end
Model["Intent Classifier Neural Network
softmax output layer"]:::modelNode
Probs["Intent Probabilities
modify_reservation 0.87
cancel_reservation 0.08
make_reservation 0.03
ask_hours 0.02"]:::probNode
Thresh{"Above threshold 0.70?"}:::thresholdNode
Final["Prediction: modify_reservation 0.87
High confidence - proceed with action"]:::highNode
Query --> Text
Text --> TFIDF
Text --> BERT
TFIDF --> Model
BERT --> Model
Model --> Probs
Probs --> Thresh
Thresh -->|"YES 0.87 >= 0.70"| Final
Thresh -.->|"NO escalate to human"| Escalate["Escalate to human agent"]:::lowNode
classDef inputNode fill:#455a64,stroke:#263238,stroke-width:2px,color:#fff,font-size:14px
classDef preNode fill:#1976d2,stroke:#0d47a1,stroke-width:2px,color:#fff,font-size:14px
classDef preOptional fill:#64b5f6,stroke:#1976d2,stroke-width:2px,color:#000,stroke-dasharray:5 4,font-size:14px
classDef featNode fill:#7b1fa2,stroke:#4a148c,stroke-width:2px,color:#fff,font-size:14px
classDef featBest fill:#9c27b0,stroke:#4a148c,stroke-width:3px,color:#fff,font-size:14px
classDef modelNode fill:#ef6c00,stroke:#e65100,stroke-width:2px,color:#fff,font-size:14px
classDef probNode fill:#616161,stroke:#212121,stroke-width:2px,color:#fff,font-size:14px
classDef thresholdNode fill:#f9a825,stroke:#f57f17,stroke-width:2px,color:#000,font-size:14px
classDef highNode fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#fff,font-size:14px
classDef lowNode fill:#c62828,stroke:#8e0000,stroke-width:2px,color:#fff,font-size:14px
linkStyle default stroke:#888,stroke-width:2px,font-size:14px