feat: extractive transcript summarizer (summarize.py)#188
Open
seonghobae wants to merge 1 commit into
Open
Conversation
Turn long transcripts into skimmable notes with a stdlib-only extractive summarizer — no external deps, no LLM or network calls. - summarize_text(text, max_sentences=5) -> Summary(summary_text, key_sentences, word_count): regex sentence splitting, word-frequency scoring with a small stopword list (average frequency, so long sentences don't win on length), top-N sentences returned in original document order. - summarize_segments(segments) accepts duck-typed objects with a .text attribute (e.g. timestamped transcription segments) and reassembles sentences that span segment boundaries. - Edge cases covered: empty/whitespace input, short input passthrough, very long input, max_sentences validation, CJK terminators (。!?) recognized and Korean/CJK text handled without crashing (whitespace tokenization limitation documented honestly in the module docstring). - 19 new tests in tests/test_summarize.py; interrogate 100% repo-wide. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CJRVbDrp1vGYkJgNHMGPpG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Transcripts produced by the pipeline are long walls of text — great for archival, poor for skimming. This adds a summarization step that turns any transcript into concise notes with key points, giving real archival value without adding a single dependency.
What
New module
summarize.py— an honest extractive summarizer (it selects existing sentences verbatim; it never generates or paraphrases text, and makes no LLM or network calls):summarize_text(text, max_sentences=5) -> Summary— dataclass withsummary_text,key_sentences(list, original document order), andword_countof the input.summarize_segments(segments, max_sentences=5)— accepts any iterable of duck-typed objects exposing.text(e.g. timestamped transcription segments); joins them so sentences spanning segment boundaries are reassembled.Summary; input with ≤max_sentencessentences passes through unchanged;max_sentences < 1raisesValueError; CJK sentence terminators (。!?) recognized; Korean/CJK input handled without crashing. Limitation documented in the module docstring: whitespace tokenization means unspaced CJK scripts get coarse frequency scoring.re,dataclasses). Full docstrings.Tests
tests/test_summarize.py— 19 tests, no network, no mocks of external services:key_sentencesandsummary_textmax_sentencesrespected;< 1raisesValueErrorGates (
python3.14):unittest discover -s tests: 132 tests, no new failures (only the 5 pre-existing macOSos.listxattrerrors remain)interrogate -c pyproject.toml: 100% docstring coverage repo-wide.coveragercsource list untouched; no existing files modified🤖 Generated with Claude Code