feat: transcript search — find where we discussed X across recordings#191
Open
seonghobae wants to merge 1 commit into
Open
feat: transcript search — find where we discussed X across recordings#191seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
Add transcript_search.py, a stdlib-only module that answers "find where
we discussed X" across an archive of recordings:
- TranscriptIndex: add(recording_id, segments) with duck-typed segments
(attributes or mapping keys), search(query) with case-insensitive,
punctuation-insensitive AND semantics, scored by term frequency and
sorted by score desc then recording/time.
- Match dataclass carrying recording_id, start, end, text, score.
- load_transcript_json(path): reads the transcription sidecar shape
{"segments": [{"start", "end", "text"}]} so it composes with the
transcription pipeline output without importing it.
- Honest documentation of the CJK whitespace-tokenization limitation.
Tests cover timestamp fidelity, AND semantics, ranking, tie-breaking,
case-insensitivity, empty-query ValueError, no-match empty list,
multi-recording search, duck typing, and sidecar JSON roundtrip.
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.
Summary
New stdlib-only module
transcript_search.py: a lightweight inverted index over timestamped transcript segments, so you can search one or many transcripts and get back matches with timestamps — "find where we discussed X" across an archive of recordings. It pairs with the transcription sidecar's.jsonoutputs (#165) without importing them.What's included
TranscriptIndex—add(recording_id, segments)accepts duck-typed segments (.start/.end/.textattributes or mapping keys);search(query)returnslist[Match].Matchdataclass —recording_id,start,end,text,score.load_transcript_json(path)— reads the transcription sidecar shape{"segments": [{"start", "end", "text"}]}so the two features compose while staying independent.ValueError; no matches returns[]; case- and punctuation-insensitive.Tests
tests/test_transcript_search.py(17 tests): timestamp fidelity, AND semantics, term-frequency ranking, tie-breaking (recording id then time), case-insensitivity, empty-queryValueError, no-match empty list, multi-recording search, empty-index search, mapping duck typing, missing-fieldTypeError, and sidecar JSON roundtrip via tmp file (plus malformed-shape rejection).Gates
python3.14 -m unittest discover -s tests: 130 tests, no new failures (exactly the 5 baseline macOSos.listxattrerrors).python3.14 -m interrogate -c pyproject.toml transcript_search.py: 100%.🤖 Generated with Claude Code