Xilu003 Csv Sfx Join
src.xil_pipeline.XILU003_csv_sfx_join
XILU003 — CSV + SFX/Cast JSON annotation utility.
Reads a parsed episode CSV, joins it with the SFX JSON (keyed on direction text) and the cast JSON (keyed on speaker), then writes an annotated output CSV with SFX and cast configuration columns appended.
Usage:
python XILU003_csv_sfx_join.py --episode S02E03
python XILU003_csv_sfx_join.py --episode S02E03 --output my_review.csv
derive_paths
Derive default file paths from the episode tag (e.g. 'S02E03').
Returns:
Source code in src/xil_pipeline/XILU003_csv_sfx_join.py
join_sfx
Return SFX annotation columns for one CSV row.
Only type == "direction" rows can match an effects entry. All other
row types get blank sfx columns with sfx_matched=FALSE.
Parameters:
-
row(dict) –A single CSV row dict.
-
effects(dict) –The
effectsmapping from the SFX JSON. -
default_influence(float | None) –Fallback
prompt_influencefromdefaults.
Returns:
-
dict–Dict of SFX annotation columns ready to merge into the output row.
Source code in src/xil_pipeline/XILU003_csv_sfx_join.py
join_cast
Return cast annotation columns for one CSV row.
Only type == "dialogue" rows can carry a speaker key. All other
row types get blank cast columns with cast_matched=FALSE.
Parameters:
Returns:
-
dict–Dict of cast annotation columns ready to merge into the output row.
Source code in src/xil_pipeline/XILU003_csv_sfx_join.py
annotate_csv
annotate_csv(csv_path: str, sfx_path: str, cast_path: str, out_path: str) -> tuple[int, int, int, int, int]
Join parsed CSV with SFX and cast configs and write annotated output.
Parameters:
-
csv_path(str) –Path to the input parsed CSV.
-
sfx_path(str) –Path to the SFX JSON config.
-
cast_path(str) –Path to the cast JSON config.
-
out_path(str) –Destination path for the annotated output CSV.
Returns:
-
tuple[int, int, int, int, int]–(total_rows, direction_rows, sfx_matched, dialogue_rows, cast_matched)