AfterLecture

Turn lecture slides + recordings into a side-by-side annotated PDF — original slide on the left, AI-generated verbatim excerpt and extended notes on the right (ASR → LLM → PyMuPDF).

AfterLecture turns a slide deck + lecture recording (or its transcript) into a double-width PDF: the left half of every page preserves the original slide (vectors intact, not rasterized), and the right half shows two AI-generated sections per slide — a lightly cleaned verbatim excerpt of the lecturer’s words, plus objective extended notes (contrasts, extra cases, real-world ties, common misconceptions). Review a lecture by reading the slide and the commentary together in one file, instead of jumping between PowerPoint, a video timeline, and a transcript window.

Pipeline

audio/video → ASR (SenseVoice / Whisper) → transcript.md
slide.pdf   → extract_pages.py            → pages.json
                    ↓  (Claude sub-agent, or any OpenAI-compatible API)
              annotations.json
slide.pdf + annotations.json → expand_pdf.py → expanded.pdf   (canvas width × 2)

Features

  • Correct mixed-script typographypymupdf.insert_htmlbox + a system CJK font keeps “GDP” half-width next to Chinese characters.
  • Markdown + LaTeX in the annotation fields — bold, lists, pipe tables, and inline $..$ / display $$..$$ math (CJK-in-math falls back gracefully to HTML, no tofu boxes).
  • Small output — font subsetting + garbage=4 / deflate_fonts keeps the PDF within ~1 MB of the source (skipping this bloats it 100×).
  • Parallel annotation — one sub-agent per unit runs independently; ~8 units finish in 15–20 min.
  • Adaptive right-half layout — probes even / asymmetric / two-column layouts against a readability floor instead of silently shrinking text.
  • Optional chapter summaries — a second sub-agent emits a standalone review document per unit, organized by the axis you choose (formula / topic order / concept map / problem-driven).

It also ships as a self-contained Claude Code skill (SKILL.md): drop the folder into your skills directory and it triggers whenever a deck + recording are uploaded.

Stack: Python 3.10+ · PyMuPDF · matplotlib · ASR (sherpa-onnx / Whisper) · LLM (Claude sub-agents or any OpenAI-compatible API)

License: MIT

Repository: wcboy/AfterLecture