Commit Graph
1 Commits
Author SHA1 Message Date
Lee Hanken 17dec27955 Replace fixed-phrase marker matching with synopsis-alignment as the primary intro method
markers.find_intro_end_via_synopsis sequence-aligns the ASR transcript
against metadata.synopsis_text()'s deterministic reconstruction of the
expected per-episode announcement text (the say.php reproduction from
earlier), rather than matching against a fixed phrase list. This was a
direct response to the pattern across the last several fixes: each one
patched a single new mis-hearing variant, with no ceiling on how many
exist. Sequence alignment tolerates scattered word-level ASR errors
throughout the transcript, not just at phrase boundaries someone thought
to special-case.

Applied to both the official-SRT and ASR-anchor paths (_resolve_intro_end
in detect.py), since wording drift and ASR mis-hearings affect both.
Falls back to the existing fixed-phrase matching when there's no
expected text to align against, and still defers to it entirely for the
sponsor-ad-read continuation, which has no deterministic per-episode
text of its own.

Live-verified: hpr2157 moved from 15.1s (old marker match) to 30.6s;
hpr3237 to 34.7s; hpr3009 (Linux Inlaws) extended further but stayed
correctly flagged rather than silently trusted; hpr4775 now resolves via
official_srt+synopsis_alignment+reference_xcorr_floor, composing all
three recent fixes. hpr1892 correctly still returns None -- its garbling
is concentrated in the first ~17 words, with no confident anchor near
the start, which the leading-anchor check is specifically designed to
catch rather than trust a coincidental later match.

Also fixes a real bug found while validating this: the sponsor-ad-read
continuation was filtering segments by end time instead of start time,
so a segment that merely ended near the anchor but started before it
broke the extension chain immediately, discarding a real extension
(caught on hpr2157's own sponsor read).

New test file test_synopsis_alignment.py (8 tests), plus two tests
locking in the earlier narrowly-scoped fuzzy-threshold exception for the
station-name marker (validated against both the real mis-hearing and the
original hpr0500 regression case before being enabled).
2026-11-22 12:24:56 +00:00