Skip to content

Fix speech to text add periods for non Latin punctuation#12248

Merged
niksedk merged 1 commit into
SubtitleEdit:mainfrom
muaz978:fix/stt-add-periods-international
Jul 7, 2026
Merged

Fix speech to text add periods for non Latin punctuation#12248
niksedk merged 1 commit into
SubtitleEdit:mainfrom
muaz978:fix/stt-add-periods-international

Conversation

@muaz978

@muaz978 muaz978 commented Jul 7, 2026

Copy link
Copy Markdown

Problem

The "add periods" step of speech to text post processing produced lines ending in "؟." and "،." in Arabic transcriptions: a Latin period appended right after an Arabic question mark or comma.

The step appends a period to a line followed by a speech gap unless the line already ends with punctuation, but the ending check only recognized Latin characters (period, exclamation mark, question mark, comma, colon, closing brackets). The Arabic question mark, Arabic comma, and similar non Latin terminators were treated as unterminated text. The same applies to Urdu, ellipsis, and fullwidth CJK punctuation.

This also explains why the doubling looked random: only lines followed by a long enough pause were affected, so back to back lines stayed clean while lines before a scene change got the extra period.

Fix

Both ending checks (the paragraph loop and the final paragraph) now use one shared list of line terminating characters that additionally includes the Arabic question mark (U+061F), Arabic comma (U+060C), Arabic semicolon (U+061B), the Urdu full stop (U+06D4), the ellipsis, fullwidth CJK terminators, and closing quotes.

Verified on a 45 minute Arabic transcription where dozens of lines previously came out as "...؟." with post processing enabled; with the fix the same lines end in "؟" alone, and Latin language behavior is unchanged.

The add periods step of speech to text post processing only recognized Latin
line endings (period, question mark, comma, and so on), so a line ending with
an Arabic question mark or Arabic comma was treated as unterminated and got a
Latin period appended, producing lines ending in "?." or ",." in Arabic
transcriptions. The same applied to Urdu, ellipsis, and CJK terminators.

The ending check now uses one shared list of line terminating characters that
includes the Arabic question mark, comma, and semicolon, the Urdu full stop,
the ellipsis, fullwidth CJK punctuation, and closing quotes, in both the
paragraph loop and the final paragraph check.
@niksedk niksedk merged commit 0c3211c into SubtitleEdit:main Jul 7, 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.

2 participants