* Classify query intent based on heuristic patterns
(query: string)
| 356 | * Classify query intent based on heuristic patterns |
| 357 | */ |
| 358 | private classifyQueryIntent(query: string): { intent: QueryIntent; weights: IntentWeights } { |
| 359 | const lowerQuery = query.toLowerCase(); |
| 360 | |
| 361 | // EXACT_NAME: Contains PascalCase or camelCase tokens (literal class/component names) |
| 362 | if (/[A-Z][a-z]+[A-Z]/.test(query) || /[a-z][A-Z]/.test(query)) { |
| 363 | return { |
| 364 | intent: 'EXACT_NAME', |
| 365 | weights: { semantic: 0.4, keyword: 0.6 } // Keyword search dominates for exact names |
| 366 | }; |
| 367 | } |
| 368 | |
| 369 | // CONFIG: Configuration/setup queries |
| 370 | const configKeywords = [ |
| 371 | 'config', |
| 372 | 'setup', |
| 373 | 'routing', |
| 374 | 'providers', |
| 375 | 'configuration', |
| 376 | 'bootstrap' |
| 377 | ]; |
| 378 | if (configKeywords.some((kw) => lowerQuery.includes(kw))) { |
| 379 | return { |
| 380 | intent: 'CONFIG', |
| 381 | weights: { semantic: 0.5, keyword: 0.5 } // Balanced |
| 382 | }; |
| 383 | } |
| 384 | |
| 385 | // WIRING: DI/registration queries |
| 386 | const wiringKeywords = [ |
| 387 | 'provide', |
| 388 | 'inject', |
| 389 | 'dependency', |
| 390 | 'register', |
| 391 | 'wire', |
| 392 | 'bootstrap', |
| 393 | 'module' |
| 394 | ]; |
| 395 | if (wiringKeywords.some((kw) => lowerQuery.includes(kw))) { |
| 396 | return { |
| 397 | intent: 'WIRING', |
| 398 | weights: { semantic: 0.5, keyword: 0.5 } // Balanced |
| 399 | }; |
| 400 | } |
| 401 | |
| 402 | // FLOW: Action/navigation queries |
| 403 | const flowVerbs = [ |
| 404 | 'navigate', |
| 405 | 'redirect', |
| 406 | 'route', |
| 407 | 'handle', |
| 408 | 'process', |
| 409 | 'execute', |
| 410 | 'trigger', |
| 411 | 'dispatch' |
| 412 | ]; |
| 413 | if (flowVerbs.some((verb) => lowerQuery.includes(verb))) { |
| 414 | return { |
| 415 | intent: 'FLOW', |