fix: keep chunk details out of speaker headers

Render transcript-wide speaker numbers instead of exposing upload chunks in
reader-facing headers. Reconcile adjacent requests using at least two
unambiguous word-and-time matches in their shared audio, including when
provider speaker IDs change between requests. Reject conflicting mappings
and never treat matching numeric provider IDs as identity evidence.

Assign fresh IDs where continuity cannot be established and report that
uncertainty on stderr. Number only speakers retained after overlap trimming.
Document that overlap matching cannot identify a returning speaker who was
absent from the overlap, and add the reader-facing boundary to AGENTS.md.

Test Plan:
- python3 -B -m unittest -v: all 46 tests passed, including swapped IDs,
  ambiguous evidence, continuity across three requests, and plain headers.
- git diff --cached --check: passed.
- Tests use synthetic speaker labels; live diarization accuracy was not
  verified because provider credentials are unavailable in this environment.
This commit is contained in:
ddidderr committed 2026-09-12 09:30:46 +02:00
1 parent 6e94379a25
commit 5dd1b5811b
7 files changed
+129 -32

No files matched your search

+10 -6
View File
@@ -41,7 +41,7 @@ without punctuation. The formatter preserves the words and their order.
Unlabelled passages use `[Speaker unknown]` when other words have labels; a
response without any labels is printed without speaker markers. A warning on
stderr reports missing or incomplete labels when diarization was requested.
Speaker IDs come from the provider; they are not names or inferred from text.
Speaker labels use the provider's diarization; they are not names inferred from text.
SRT uses labels to break cues at speaker changes but does not print the IDs.
Long recordings are automatically split into uploads of at most **10 minutes**
@@ -76,11 +76,15 @@ timestamps can still require corrections. Missing or invalid word timestamps
are an error. Plain text for a chunked recording is assembled from the words.
SRT timestamps are shifted back to the original recording's timeline before
cue generation, with continuous cue numbering. Speaker labels, when returned,
are local to each request; text marks them as `[Chunk 1, Speaker 0]`,
`[Chunk 2, Speaker 0]`, etc. The same ID in different chunks does **not** establish
that it is the same person. The script does not identify speakers across
chunks. Short recordings still use one request and use `[Speaker 0]` markers.
cue generation, with continuous cue numbering. Text uses `[Speaker 0]`,
`[Speaker 1]`, etc., without exposing upload boundaries to the reader.
For a chunked recording, provider IDs are mapped to transcript-wide IDs:
at least two unambiguous words shared at matching times in the overlap must
agree on the speaker correspondence. Conflicting or absent evidence gets a
new ID and a warning on stderr. This is not voice recognition across the whole
recording: the same person can receive another ID when absent from an overlap
or when diarization disagrees. Numeric provider IDs alone are never used to
identify a speaker across requests.
Audio is first decoded to temporary mono 16 kHz PCM (about 115 MB per hour),
so all cuts share the same sample clock even when container duration metadata