From 1c09dacb62bb4f34d1960bf54e5e7fe19b9f1fa7 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Fri, 5 Jun 2026 19:54:09 -0400 Subject: [PATCH] zebra-spaces: one transcript line per sentence (host self-transcribe parity) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fox 2026-06-05: "the self speech to text is not creating new lines for when there is new sentence, the listeners are doing a better job." Both self-capture and remote-speaker capture go through the same handleWhisperChunk → appendTranscriptLine path. Each Whisper chunk is 5 seconds. The listener-side capture often catches a peer mid- pause, so each 5s chunk ends up holding one short sentence — one line in the log. The host on a close mic talks continuously for the full 5s window, so Whisper returns "Hello there. How are you. Good to see you." as a single string → one mashed line. Fix at the dispatch point (not the capture point): split the Whisper output on sentence-terminating punctuation (period/exclaim/question followed by whitespace) and call appendTranscriptLine once per sentence. Each sentence gets the same hallucination + min-length filtering as the original whole result. Applies to BOTH self capture and remote capture since they share the same handler — listener-side transcripts also get cleaner when two sentences happen to fit in one chunk. --- web/zebra-spaces.html | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/web/zebra-spaces.html b/web/zebra-spaces.html index a8f7798..e02f966 100644 --- a/web/zebra-spaces.html +++ b/web/zebra-spaces.html @@ -2336,7 +2336,24 @@ async function handleWhisperChunk(uuid, chunk){ if (WHISPER_HALLUCINATIONS.has(norm)) return; if (_lastTranscriptByUuid.get(uuid) === txt) return; _lastTranscriptByUuid.set(uuid, txt); - appendTranscriptLine(uuid, txt); + /* One chunk can contain multiple sentences when the speaker doesn't + * pause inside the 5s window (typical for the host on a close mic). + * Whisper concatenates them — split on sentence-terminating + * punctuation and emit one transcript line per sentence so the + * self-transcript matches the per-sentence cadence the listener + * captures already produce. Fox 2026-06-05: "the self speech to + * text is not creating new lines for when there is new sentence, + * the listeners are doing a better job." */ + const sentences = txt + .split(/(?<=[.!?])\s+/) + .map(s => s.trim()) + .filter(s => s.length > 0); + for (const s of sentences){ + const sNorm = s.toLowerCase().replace(/[.!?,;:\s]+$/,'').trim(); + if (sNorm.length < 2) continue; + if (WHISPER_HALLUCINATIONS.has(sNorm)) continue; + appendTranscriptLine(uuid, s); + } _whisperTick.emitted++; } catch (err){ logLine('err', 'whisper transcribe '+uuid.slice(0,4)+': '+err.message); @@ -7859,8 +7876,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');