#!/usr/bin/env python3 import json from pathlib import Path ROOT = Path(__file__).resolve().parents[1] OUT = ROOT / "generated" / "tier2_batch02.json" def shot(no, visible, visual, sound, dialogue=None): return {"shot_no": no, "visible_characters": visible, "visual": visual, "sound": sound, "dialogue": dialogue or []} def line(character, text): return {"character": character, "language": "English", "text": text} def compile_case(meta): chars = meta["characters"] speaking_seen = set() appeared_seen = set() compiled = [] for raw in meta.pop("shot_specs"): visible = raw["visible_characters"] dialogue = raw["dialogue"] speakers = list(dict.fromkeys(item["character"] for item in dialogue)) first = [speaker for speaker in speakers if speaker not in speaking_seen] speaking_seen.update(speakers) subject = {char: index + 1 for index, char in enumerate(visible)} dialogue_block = "" for speech_index, item in enumerate(dialogue, start=1): dialogue_block += ( f"\n\n (S{speech_index}) says: " f"[English] {item['text']}" ) if raw["shot_no"] == 1: introductions = " ".join( f" is {chars[char]}." for char in visible ) prompt = ( "integrated_multimodal_description:\n" f"[Shot 1] {introductions} {raw['visual']}" f"{dialogue_block}\n\noverall_soundscape:\n{raw['sound']}" ) else: definitions = "\n".join( f" is {chars[char]}." for char in visible ) retention = "\n".join( f": fully_preserved - Maintain identity." for char in visible if char in appeared_seen ) retention_block = f"{retention}\n" if retention else "" prompt = ( f"subject_definitions:\n{definitions}\n{{{{REFERENCE_DEFINITIONS}}}}" "\n\nsummary:\n{{REFERENCE_SUMMARY}}" f"\n\nretention_analysis:\n{retention_block}{{{{REFERENCE_RETENTION}}}}" f"\n\ndetailed_description:\n[Shot 1] {raw['visual']}" f"{dialogue_block}\n\noverall_soundscape:\n{raw['sound']}" ) compiled.append({ "shot_no": raw["shot_no"], "visible_characters": visible, "speakers": speakers, "first_time_speakers": first, "dialogue": dialogue, "prompt": prompt, }) appeared_seen.update(visible) meta["shots"] = compiled return meta CASES = [ { "case_id": "worker_06_tier2", "tier": 2, "target_identity": "", "first_appearance_shot": 5, "reappearance_shot": 13, "absence_gap": 7, "characters": { "": "a middle-aged white woman with a chestnut braid, a slate rain shell, brown hiking trousers, and a small canvas daypack", "": "an elderly East Asian man with short gray hair, a forest-green vest, beige trousers, and binoculars on a broad black strap", "": "a young Indigenous nonbinary nature educator with two long black braids, a rust field jacket, dark waterproof trousers, and cedar-bead earrings" }, "shot_specs": [ shot(1,[""],"A wide establishing shot shows step onto the rain-dark forest boardwalk and slow before a shallow puddle reflecting the canopy.","Water drips from leaves and one hiker speaks.",[line("","The boards are wet, so I will keep to the center and take the turns slowly.")]), shot(2,[""],"At a low observation rail, lifts his binoculars toward a quiet opening between cedar trunks, then lowers them before walking on.","Distant birds, dripping foliage, and one low voice.",[line("","A thrush is calling beyond the platform. We do not need to leave the walkway to hear it.")]), shot(3,["",""],"A rear follow shot keeps both walkers full-length as and round a broad bend and step around separate puddles.","Measured footfalls and water falling from branches."), shot(4,["",""]," pauses at the viewing platform while approaches the mossy fork; both look down at small fungi beside, not on, the boards.","A wooden rail creaks and forest ambience remains soft."), shot(5,["","",""]," emerges from behind a cedar at the fork, greets and , then takes the short branch path and disappears behind wet ferns.","Fern fronds brush fabric and one clear voice.",[line("","I will check the short branch path and meet you where the two boardwalks join.")]), shot(6,["",""]," and continue on the main boardwalk, passing a cluster of amber fungi while keeping their feet squarely on the planks.","Drips, quiet shoes, and a far birdcall."), shot(7,[""],"A medium shot holds as she stops before a deeper puddle, studies its edge, and crosses with two careful steps along the dry center strip.","A small splash and rainwater beneath the boards."), shot(8,[""],"Framed through tree trunks, watches a bird cross the canopy opening and turns toward the rising section of walkway.","Wingbeats and leaves moving lightly."), shot(9,["",""],"The two walkers climb the gentle boardwalk grade side by side, then separate into single file at a narrow rail section.","Wooden footfalls and subdued wind."), shot(10,["",""]," points only with his gaze toward fresh shelf fungi while waits one pace behind, leaving the path unobstructed.","Forest room tone and one brief observation.",[line("","The new growth is on the fallen trunk ahead, well beyond the walking edge.")]), shot(11,["",""],"A ground-level view shows both pairs of boots pass a clear stretch of boardwalk as the remaining mist lifts from the moss.","Even steps, dripping moss, and no speech."), shot(12,[""]," reaches the final curve and rests one hand on the rail while the two-path junction becomes visible through the trees.","A soft rail touch and distant running water."), shot(13,[""],"At the junction, steps from behind a broad trunk and waits in the open, matching the rust jacket, braids, and cedar earrings seen earlier.","A branch releases droplets and the same educator speaks.",[line("","The branch path is clear, and the driest return is the boardwalk behind me.")]), shot(14,["","",""],"The three turn onto the shared return route, with leading at a relaxed distance and the others following through the brightening forest.","Three sets of footsteps and birdsong; no dialogue.") ] }, { "case_id": "worker_07_tier2", "tier": 2, "target_identity": "", "first_appearance_shot": 7, "reappearance_shot": 14, "absence_gap": 6, "characters": { "": "an elderly white man with thinning silver hair, a camel overcoat, navy trousers, and a polished wooden cane", "": "an elderly Latina woman with a gray bob, a burgundy coat, and a cream scarf", "": "a young Black man with short twists, a charcoal hoodie, dark jeans, and round glasses", "": "a young East Asian woman with a blunt black bob, a deep red usher jacket, black trousers, and a small brass name pin" }, "shot_specs": [ shot(1,[""]," enters the old cinema lobby and pauses beneath the warm poster lights, looking toward the darker auditorium corridor.","Muted street noise, lobby ventilation, and one voice.",[line("","I can manage the aisle if the step lights are visible before the trailers begin.")]), shot(2,[""]," comes through the glass doors, lets them close, and studies the cream floor line leading toward the hall.","Door seals and one warm reply.",[line("","We have time to walk in slowly. I would rather choose the clearer side.")]), shot(3,[""],"Beside a poster alcove, removes his glasses briefly to wipe rain mist, then looks toward the nearly empty corridor.","A cloth touches glass and one quiet voice.",[line("","I will wait until the doorway clears, then take a seat near the back.")]), shot(4,["",""]," and cross the lobby toward the heavy curtain, matching their pace under the changing wall lights.","Carpeted steps and distant projector ventilation."), shot(5,[""]," follows later through the corridor, his silhouette passing beneath three low sconces as the auditorium door comes into view.","Soft shoes and a faint trailer tone beyond the door."), shot(6,["","",""],"The three visitors gather with natural spacing before the dark curtain. tests the first illuminated step with his cane while the others wait.","A cane tip on carpet and low cinema hum."), shot(7,["","","",""]," opens the curtain from inside, reveals the lit aisle, and speaks before accompanying toward a gentler side route.","Curtain rings, projector hum, and one whispered voice.",[line("","The side aisle is brighter and has fewer steps. I will walk it with you first.")]), shot(8,["",""]," enters along the central aisle while remains near the back row, allowing the step lights to guide their separate positions.","Quiet footfalls and soft screen music."), shot(9,[""]," chooses an aisle seat, turns carefully, and lowers himself while keeping his cane against his own knee.","A seat folds down and projector fans continue."), shot(10,[""],"From a low aisle angle, walks to the back row and sits as pale moving light crosses his face and round glasses.","Muted trailer sound and one seat settling."), shot(11,[""]," appears at the far side aisle and pauses beside a row with generous legroom before taking the end seat.","Soft carpet steps and screen ambience."), shot(12,["",""],"Across several rows, turns and sees comfortably seated on the brighter side; both settle facing the screen.","A subdued orchestral trailer and ventilation."), shot(13,[""]," leans back as the screen brightens from blue to warm amber, revealing the empty seats and both clear aisles around him.","Trailer ambience and no dialogue."), shot(14,[""]," enters from the screen-side passage, her red usher jacket and brass pin gradually revealed by the changing screen light.","A curtain brushes and the same whispered voice.",[line("","The side route is clear, and the house lights will remain at this level until the feature starts.")]), shot(15,["","","",""],"A wide rear view holds all four in their separated positions as moves quietly toward the exit and the visitors face the screen.","House lights dim slightly, projector fans remain, and no speech.") ] }, { "case_id": "worker_08_tier2", "tier": 2, "target_identity": "", "first_appearance_shot": 5, "reappearance_shot": 12, "absence_gap": 6, "characters": { "": "a young Black woman with long microbraids, a pale denim jacket, olive trousers, and a wicker laundry basket", "": "an elderly East Asian man with swept white hair, a navy cardigan, gray trousers, and clothespins in one hand", "": "a middle-aged Middle Eastern man with short curly hair, a sand-colored overshirt, dark work trousers, and an empty blue laundry basket" }, "shot_specs": [ shot(1,[""],"A wide establishing shot on an apartment roof follows between billowing sheets as she catches one loose corner before it reaches the parapet.","Wind in fabric and one alert voice.",[line("","The wind is turning. I will take down the widest sheet before it twists around the line.")]), shot(2,[""]," closes the stair door behind him and watches a row of pillowcases lift together in the new crosswind.","A latch clicks, cloth snaps softly, and one reply.",[line("","I will start at this end and keep the doorway clear.")]), shot(3,["",""],"The two work from opposite ends of one long sheet, bringing it down in a slow shared fold without using a table or ledge.","Fabric folds and rooftop wind."), shot(4,["",""]," carries folded cloth toward the stair wall while walks deeper between the moving lines with her basket.","Footsteps, basket weave, and sheets fluttering."), shot(5,["","",""]," appears at the roof door with an empty blue basket, speaks, then crosses to the neighboring terrace where a light door taps in the wind.","A door taps, fabric moves, and one neighbor speaks.",[line("","I will secure the terrace latch, then come back through the far laundry row.")]), shot(6,["",""]," and release a second sheet together and let it settle into the wicker basket between them.","Wind, fabric, and a basket creak."), shot(7,[""],"A lateral follow shot tracks through a corridor of white sheets, her silhouette appearing and disappearing as the cloth lifts.","Layered fabric movement and roof ambience."), shot(8,[""],"Near the stair wall, gathers three pillowcases against his chest and waits for a stronger gust to pass.","A gust rises and softens; no speech."), shot(9,["",""],"The pair carry separate light bundles toward the sheltered wall, leaving the center route open as the remaining lines sway.","Measured steps and loose cloth."), shot(10,[""]," sits briefly on the low stair step, then rises when the hanging sheets settle into a gentler rhythm.","Cardigan fabric, wind, and a distant city hum."), shot(11,[""]," lifts her empty wicker basket and turns toward the far laundry row, where blue shadow moves behind two sheets.","Basket handle and fabric in wind."), shot(12,[""],"A medium shot reveals emerging between two billowing sheets with the same empty blue basket, first as a shadow and then fully visible in his sand overshirt.","The terrace door is now quiet and the same neighbor speaks.",[line("","The latch is holding now. The remaining lines are sheltered enough to finish slowly.")]) ] }, { "case_id": "worker_09_tier2", "tier": 2, "target_identity": "", "first_appearance_shot": 6, "reappearance_shot": 14, "absence_gap": 7, "characters": { "": "a young East Asian woman with a short auburn bob, a white baker jacket, dark trousers, and heatproof gray mitts", "": "a middle-aged Black man with a shaved head, a brown delivery coat, black trousers, and both hands on an empty steel cart", "": "an older Latina woman with silver hair under a blue scarf, a cream baker jacket, navy trousers, and a dark green apron" }, "shot_specs": [ shot(1,[""],"In a bakery back kitchen, opens the walk-in oven and steps aside as warm steam rolls into the clear central passage.","Oven fans, a door hinge, and one voice.",[line("","The first loaves are ready. I will let the steam clear before moving them.")]), shot(2,[""],"At the street delivery door, rolls an empty steel cart over the threshold and stops before entering the warm kitchen.","Cart wheels, morning street noise, and one voice.",[line("","I will wait here until the oven path is open.")]), shot(3,[""]," backs one loaded rack slowly out of the oven and turns it into the cooling passage without touching the work counters.","Rack wheels and fading oven fans."), shot(4,[""]," pushes the empty cart along the marked wall route, then yields as the hot rack crosses ahead.","Steel wheels and room ventilation."), shot(5,["",""],"A wide kitchen view shows guide the hot rack toward the cooling zone while keeps the delivery cart near the wall.","Two wheel rhythms and light steam."), shot(6,["","",""]," enters from the cool-room passage, observes the crossing routes, then heads toward the street door after speaking.","Ventilation, wheels, and one experienced voice.",[line("","Keep the center clear. I will open the street door fully and guide the empty cart in.")]), shot(7,[""]," walks beside the cooling rack and checks the spacing by looking down the passage, not by rearranging small items.","Cooling fans and soft footsteps."), shot(8,[""]," rolls the empty cart one doorway farther, then stops as another wave of steam crosses the route.","Cart brakes and oven air."), shot(9,["",""],"The two exchange positions around the wide passage: moves the rack forward while backs the empty cart into a recess.","Wheels, floor seams, and no speech."), shot(10,[""]," opens a high vent window and steps back as the steam thins toward the ceiling.","A window latch and rising ventilation."), shot(11,[""]," looks through the open delivery doorway, then turns the cart so its narrow end faces the kitchen route.","Street rain, cart casters, and one short remark.",[line("","The doorway is wide enough now. I can bring it through without crossing the hot rack.")]), shot(12,["",""]," walks ahead of the cooling rack while advances the empty cart along the opposite wall, both at a slow pace.","Parallel wheel sounds and fans."), shot(13,[""],"At the far end of the cooling passage, stops the rack and turns toward movement between the tall cooling frames.","A brake clicks and the kitchen settles."), shot(14,[""]," walks into view between the cooling frames beside the now-open route, clearly matching the blue scarf, green apron, and cream jacket seen earlier.","Street air enters and the same baker speaks.",[line("","The entrance is secure and the route is clear. Bring the empty cart along the wall.")]), shot(15,["","",""]," guides the empty cart into the cooling area while holds the hot rack stationary and walks beside his cart.","Wheels move through the open kitchen; no dialogue.") ] }, { "case_id": "worker_10_tier2", "tier": 2, "target_identity": "", "first_appearance_shot": 6, "reappearance_shot": 15, "absence_gap": 8, "characters": { "": "an older Black man with a close gray beard, a burgundy flat cap, a camel coat, and a walnut walking stick", "": "a young white woman with shoulder-length blond hair, a cobalt rain jacket, black trousers, and a canvas tote", "": "a middle-aged South Asian nonbinary transit volunteer with short salt-and-pepper curls, a teal vest over a gray shirt, and a small circular badge" }, "shot_specs": [ shot(1,[""],"Inside a moving tram, rises from a rear seat and grips the vertical rail as shopfronts slide past the window.","Rail hum, wheel rhythm, and one voice.",[line("","My stop has a low platform. I will move closer to the center door before we arrive.")]), shot(2,[""]," stands from the facing seat and moves her tote behind her leg, clearing the aisle toward the articulated connection.","Tram joints creak and one reply.",[line("","The aisle is clear. I can hold this rail while you pass.")]), shot(3,["",""]," walks toward the connection with his stick close to his side while steps into the vacated window space.","Measured steps and steady rail noise."), shot(4,[""],"At the flexible connection, waits through a gentle curve as the floor shifts beneath him, then continues when the tram straightens.","Joint bellows and wheel flange."), shot(5,["",""]," follows several paces behind into the middle section; outside, commercial signs give way to brick apartments.","Tram hum and a distant stop bell."), shot(6,["","",""]," enters from the front section, greets both passengers, then prepares to step onto the approaching low platform with .","Brakes engage and one calm volunteer speaks.",[line("","I will step down with you and point out the level path to the exit.")]), shot(7,[""],"After the doors close, takes a window seat in the middle section while the tram continues into a quieter residential street.","Doors seal and the motor rises."), shot(8,[""]," watches row houses pass and shifts her tote onto her lap as sunlight replaces the earlier rain reflections.","Wheel rhythm and soft cabin ventilation."), shot(9,[""],"At the next curve, stands and moves one pole forward, leaving the doorway zone open for boarding passengers outside the frame.","A turn signal chime and track noise."), shot(10,[""],"A long interior view follows through the articulated joint as trees begin to fill the windows beyond her.","Bellows creak and restrained footsteps."), shot(11,[""]," sits near the rear door and looks at the raised platform sliding alongside, comparing it with the lower stop already passed.","Platform ambience and soft brakes."), shot(12,[""],"The tram departs again; remains by the window while residential blocks alternate with small gardens.","Motor acceleration and wheel rhythm."), shot(13,[""]," crosses to the opposite seat as afternoon light moves from one side of the cabin to the other.","Seat fabric and a quiet carriage."), shot(14,[""],"At another stop, looks toward the rear door as it opens onto a tree-lined platform and a familiar teal color approaches from outside.","Door chime, birds outside, and idling tram noise."), shot(15,[""]," boards through the rear door at the new stop, the same teal vest, gray shirt, circular badge, and salt-and-pepper curls clearly visible against the residential street.","Doors remain open briefly and the same volunteer speaks.",[line("","The level path was open, and I caught the next tram here as planned.")]) ] } ] def main(): cases = [compile_case(case) for case in CASES] OUT.parent.mkdir(parents=True, exist_ok=True) OUT.write_text(json.dumps(cases, ensure_ascii=False, indent=2) + "\n", encoding="utf-8") print(json.dumps({"cases": len(cases), "shots": sum(len(c["shots"]) for c in cases), "output": str(OUT)}, indent=2)) if __name__ == "__main__": main()