Expand description
Speaker recognition: the CAST block, speakers.json, and the built-in
fallback list. Port of the speaker half of XILP001_script_parser.py.
Structsยง
- Cast
Entry - One CAST-block entry.
- Speaker
Match - A speaker matched at the start of a line.
- Speakers
- Display names (match order) plus the display โ key map.
Constantsยง
- BUILTIN ๐
- Built-in display names, already longest-first as the Python literal is.
Staticsยง
Functionsยง
- builtin_
key_ ๐order - builtin_
speakers - The built-in table, for callers that need it without any script context.
- display_
to_ key - Display name โ normalized key: drop parentheticals and punctuation, lowercase, collapse whitespace to underscores.
- extract_
cast_ from_ script - Parse the
CAST:bullet block from the script header. - key_
to_ display - Reverse map key โ first display name, as
generate_cast_configbuilds it from the module-levelSPEAKER_KEYS. - load_
speakers - Merge CAST-block entries with
speakers.json, falling back to the built-ins only when neither exists. - load_
speakers_ registry - Full
speakers.jsonentries keyed by speaker key, for cast skeletons. - read_
speakers_ ๐json - resolve_
speakers_ file - Which
speakers.jsonto load, without reading it. - try_
match_ speaker - Match a known speaker prefix, splitting off any
(direction).