| def rewrite_script(words): | |
| """ | |
| Converts raw transcript → structured viral script | |
| """ | |
| text = " ".join([w["text"] for w in words]) | |
| return { | |
| "hook": f"Wait—{text[:60]}...", | |
| "summary": text[:200], | |
| "emotion": "high" if "!" in text else "medium" | |
| } | |
| def viral_score(engagement_curve): | |
| """ | |
| Evaluates full video potential | |
| """ | |
| if not engagement_curve: | |
| return 0 | |
| peak = max(engagement_curve) | |
| avg = sum(engagement_curve) / len(engagement_curve) | |
| return (peak * 0.7) + (avg * 0.3) |