When a user types "how?" or "tell me more" or just sends a thumbs-up emoji, the chatbot needs to understand this is a follow-up to the previous response. ReLU.chat detects 20+ follow-up types using a combination of regex patterns and heuristic matching.
Pattern Categories
The follow-up detection system handles these categories:
Process/Reason: "how", "why", "how so", "how does that work" Depth: "more detail", "elaborate", "go deeper", "deep dive" Simplification: "explain simpler", "ELI5", "dumb it down" Examples: "give an example", "like what", "for instance" Continuation: "go ahead", "keep going", "what's next" Challenge: "really", "are you sure", "prove it" Acknowledgment: "ok", "got it", "makes sense" Clarification: "huh", "what do you mean", "I'm confused" Summarization: "tl;dr", "summarize", "brief" Comparison: "compare", "difference", "versus" Topic correction: "I meant X", "no, just X"
Two-Phase Detection
Phase 1: Pattern matching against 20+ regex patterns (fast, high-confidence). Phase 2: Heuristic fallback for short queries (< 20 chars) using substring matching.
// Phase 1: exact pattern match
for (const pat of FOLLOWUP_PATTERNS) {
const match = query.match(pat.regex);
if (match) return { isFollowUp: true, type: pat.type };
}
// Phase 2: heuristic short-query matching
if (query.length < 20) { /* substring maps */ }
Emoji and Symbol Detection
Emoji-only messages are common in chat. The system detects them via Unicode property escapes:
const allSymbols = /^[\u{1F000}-\u{1FFFF}...]+$/u;
Common emoji map to follow-up types: ๐ค โ clarify, ๐ โ acknowledge, ๐ก โ elaborate.
Punctuation Signals
"..." โ elaborate, "??" โ clarify, "!" โ challenge. Even empty punctuation carries meaning.
Integration with Policy
The detected follow-up type feeds into the 25-feature
policy vector as followUpType (feature
index 18, values 0-22). The MLP uses this to adjust
response strategy โ simplify triggers shorter, more
intuitive responses; deep_dive triggers longer, more
formal ones.
Key Takeaway
Follow-up detection is pattern matching, not ML. Twenty well-crafted regex patterns cover 95% of conversational follow-ups. The remaining 5% are handled by heuristic substring matching.