Download src/video/tuition/voiceoverScript.ts from asnannp/DocDoeAI: direct link, hf CLI and curl.
- Browser
- Download file 3.87 kB
-
https://huggingface.co/spaces/asnannp/DocDoeAI/resolve/main/src/video/tuition/voiceoverScript.ts
- Command line
-
hf download hf://spaces/asnannp/DocDoeAI/src/video/tuition/voiceoverScript.ts
-
curl -L -o voiceoverScript.ts https://huggingface.co/spaces/asnannp/DocDoeAI/resolve/main/src/video/tuition/voiceoverScript.ts
3.87 kB
| /** | |
| * Day 15 β a clean, teacher-toned voiceover script generated from a plan. | |
| * | |
| * Classroom-teacher-v1: the script is natural teacher speech only. | |
| * Fake interaction stage directions (pause the video, copy this, think for | |
| * ten seconds, guess) are NOT injected into the voiceover. Soft delivery | |
| * cues for exam points / mistakes stay as optional director notes only when | |
| * explicitly useful β never as student-facing pause games. | |
| * | |
| * Deterministic: the same plan always produces the same script. | |
| */ | |
| import type { AttentionCue, NarrationBlock, TuitionSegmentKind, TuitionVideoPlan } from "./types"; | |
| /** Director-only notes. Never student-facing fake pauses. */ | |
| const CUE_DIRECTION: Partial<Record<AttentionCue, string>> = { | |
| // pause_and_think / copy_this / checkpoint intentionally omitted (classroom-teacher-v1 ban) | |
| exam_point: "(Delivery: slightly slower β pin this for the exam board.)", | |
| common_mistake: "(Delivery: clear warning tone on the wrong idea, then the correction.)", | |
| important: "(Delivery: slight emphasis, then continue teaching.)", | |
| }; | |
| function pushNarrationLines(lines: string[], narration: NarrationBlock[]): void { | |
| for (const block of narration) { | |
| lines.push(block.text); | |
| const note = block.attentionCue ? CUE_DIRECTION[block.attentionCue] : undefined; | |
| if (note) lines.push(note); | |
| lines.push(""); | |
| } | |
| } | |
| /** | |
| * Build a readable voiceover script covering the given segments. For the | |
| * "concept" segment, only the first mission's scenes are included (`title` | |
| * of the first concept scene) so the sample script stays focused on one real | |
| * teaching arc instead of dumping every concept mission. | |
| */ | |
| export function buildVoiceoverScript(plan: TuitionVideoPlan, segmentKinds: TuitionSegmentKind[]): string { | |
| const lines: string[] = []; | |
| lines.push(`# ${plan.subject} β ${plan.chapter} β voiceover script (sample)`); | |
| lines.push(""); | |
| lines.push( | |
| "Tone: clear Indian English classroom teacher. Friendly but serious. Simple sentences, one main idea each. No pause-the-video games, no notebook copy drills, no prediction pauses. Optional delivery notes in parentheses are for the voice artist only.", | |
| ); | |
| lines.push(""); | |
| for (const kind of segmentKinds) { | |
| const segment = plan.segments.find((s) => s.kind === kind); | |
| if (!segment || segment.scenes.length === 0) continue; | |
| let scenes = segment.scenes; | |
| if (kind === "concept") { | |
| const firstTitle = scenes[0].title; | |
| scenes = scenes.filter((s) => s.title === firstTitle); | |
| } | |
| lines.push(`## ${segment.title}`); | |
| lines.push(""); | |
| for (const scene of scenes) pushNarrationLines(lines, scene.narration); | |
| } | |
| return lines.join("\n").trimEnd() + "\n"; | |
| } | |
| /** | |
| * Build a voiceover script covering every scene of every segment in the | |
| * plan, with no title-based filtering. Appropriate for a dedicated, | |
| * single-purpose plan (like the Day 16 "vibration + medium" segment) where | |
| * every scene is already the one continuous teaching arc, unlike the general | |
| * 45-minute plan's "concept" segment which spans multiple missions. | |
| */ | |
| export function buildFullPlanVoiceoverScript(plan: TuitionVideoPlan): string { | |
| const lines: string[] = []; | |
| lines.push(`# ${plan.subject} β ${plan.chapter} β voiceover script`); | |
| lines.push(""); | |
| lines.push( | |
| "Tone: clear Indian English classroom teacher. Friendly but serious. Simple sentences, one main idea each. No pause-the-video games, no notebook copy drills, no prediction pauses. Optional delivery notes in parentheses are for the voice artist only.", | |
| ); | |
| lines.push(""); | |
| for (const segment of plan.segments) { | |
| if (segment.scenes.length === 0) continue; | |
| lines.push(`## ${segment.title}`); | |
| lines.push(""); | |
| for (const scene of segment.scenes) pushNarrationLines(lines, scene.narration); | |
| } | |
| return lines.join("\n").trimEnd() + "\n"; | |
| } | |