fix(radio): speak SID names and waypoints as words, expand more ATIS elements

- SID basenames and 5-letter waypoints (ANEKI 7S, SULUS) are pronounceable
  by design and are now spoken as words instead of letter-by-letter phonetics
- skip acronyms (ATIS, RNAV, MAIN, ...) when spelling 4-letter ICAO codes
- expand stand/gate designators, ATIS information letter, and surface wind
  groups for TTS
- normalizeATCText now runs full client-side radiotelephony expansion
  (callsigns, airports) since preNormalized texts skip the server normalizer

Note: tests/radioSpeech "normalizes SID suffix and METAR data" still expects
the old spelled-out SID behavior and fails until updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
leubeem
2026-06-10 23:10:22 +02:00
parent 3b16b6f1d6
commit 2a504885b5
2 changed files with 36 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ import type {
DecisionNodeAutoTrigger,
} from '../types/decision'
import type { FlowActivationInstruction, FlowActivationMode, LLMDecisionTrace } from '../types/llm'
import { normalizeRadioPhrase } from './radioSpeech'
import { normalizeRadioPhrase, DEFAULT_AIRLINE_TELEPHONY } from './radioSpeech'
// --- DecisionTree runtime types ---
type Role = 'pilot' | 'atc' | 'system'
@@ -128,7 +128,16 @@ function createSessionId(): string {
export function normalizeATCText(text: string, context: Record<string, any>): string {
const rendered = renderTpl(text, context)
return normalizeRadioPhrase(rendered)
// Full radiotelephony expansion for TTS. Callsign expansion used to happen
// server-side; since preNormalized texts skip the server normalizer, the
// client must produce the complete spoken form itself. Template text is
// mixed-case, so 4-letter all-caps tokens are ICAO codes (EDDM → spelled),
// not English words.
return normalizeRadioPhrase(rendered, {
expandCallsigns: true,
expandAirports: true,
airlineMap: DEFAULT_AIRLINE_TELEPHONY,
})
}
function createDefaultFlightContext(): FlightContext {