Skip to content

Keep exact millisecond boundaries when clipping subtitles - #246

Merged
LauraGPT merged 1 commit into
mainfrom
codex/exact-subtitle-boundaries
Dec 2, 2026
Merged

LauraGPT merged 1 commit into
mainfrom
codex/exact-subtitle-boundaries

Conversation

@LauraGPT

@LauraGPT LauraGPT commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Selecting a word ending at exactly 1.001 s on main raises IndexError. Multiplying the seconds float by 1000 first gives 1000.9999999999999, so the clip helper excludes the final word. An actual fractional cut inside the first word also passes an empty timestamp list to the renderer. The same conversion can place an accumulated output cue one millisecond early.

Convert decimal seconds to milliseconds before truncation; preserve fractional sample positions until SRT formatting and skip cues with no finished token. This does not change selection, word matching or the distinct concatenation logic in #217.

Five new boundary cases: four fail on the parent, all five pass after the fix. The complete Shanghai offline suite passed (131 passed, one optional live case skipped). No acoustic inference or model download. Prepared with Codex assistance.

Respect decimal clip boundaries before truncating to the SRT millisecond. Skip an empty token selection rather than indexing an empty list.

Signed-off-by: zhifu gao <zhifu.gzf@alibaba-inc.com>
@LauraGPT
LauraGPT merged commit fffd919 into main Dec 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant