fix: format text transcripts and show speaker markers
Chunked text output previously joined every word into one line and discarded speaker labels. Add a shared plain-text formatter that wraps lines, breaks paragraphs at speaker changes and pauses, and splits long turns while preserving word order. Display provider speaker IDs with chunk scope where needed, without implying that IDs identify the same person across requests. Request structured output for short diarized recordings too, and warn when speaker labels are missing or incomplete. Keep SRT formatting separate and preserve existing line breaks for short requests without diarization. Test Plan: - python3 -B -m unittest -q: all 43 tests passed. - bash -n transcribe and git diff --cached --check: passed. - Reflowed the existing transcript locally and verified all 15,888 words were preserved; source audio and generated transcripts are not committed. - A live excerpt check was blocked before upload by unavailable 1Password access; actual provider diarization remains unverified.
This commit is contained in:
1 parent
24b1030776
commit
38894c2549
7 files changed
+249
-19
No files matched your search
@@ -9,6 +9,7 @@ import sys
|
||||
import wave
|
||||
|
||||
from subtitles import convert, normalized_words
|
||||
from transcript import render_text
|
||||
|
||||
CONTEXT = 3.0 # Audio on each side of a seam: six seconds shared by two uploads.
|
||||
ENCODING_MARGIN = 0.1 # MP3 encoder delay and frame padding at 16 kHz.
|
||||
@@ -156,7 +157,7 @@ def main():
|
||||
(args.manifest.parent / f"response-{i}.json").read_text(encoding="utf-8")
|
||||
) for i in range(len(chunks))]
|
||||
response = merge(chunks, responses)
|
||||
sys.stdout.write(convert(response) if args.srt else response["text"] + "\n")
|
||||
sys.stdout.write(convert(response) if args.srt else render_text(response))
|
||||
except (ValueError, OSError, wave.Error) as error:
|
||||
parser.exit(1, f"Audio chunking failed: {error}\n")
|
||||
|
||||
|
||||
Reference in new issue
Block a user