Fixed the issue where spaces were deleted before punctuation marks

This commit is contained in:
Deniz Şafak
2025-09-18 02:37:58 +03:00
parent a98f75c1a9
commit 1d8cb8eabd
3 changed files with 6 additions and 19 deletions
+3
View File
@@ -1,3 +1,6 @@
# 1.1.9
- Fixed the issue where spaces were deleted before punctuation marks while generating subtitles.
# 1.1.8
- Added `.md` (Markdown) file extension support by @brianxiadong in PR #75
- Added new option `Configure silence between chapters` that lets you configure the silence between chapters, mentioned by @lfperez1982 in #79
+1 -17
View File
@@ -1189,23 +1189,7 @@ class ConversionThread(QThread):
if not tokens_with_timestamps:
return
# Always combine punctuation with preceding words for consistent handling across modes
processed_tokens = []
i = 0
while i < len(tokens_with_timestamps):
token = tokens_with_timestamps[i].copy()
# Look ahead for punctuation
while i + 1 < len(tokens_with_timestamps) and re.match(
r"^[^\w\s]+$", tokens_with_timestamps[i + 1]["text"]
):
token["text"] += tokens_with_timestamps[i + 1]["text"]
token["end"] = tokens_with_timestamps[i + 1]["end"]
token["whitespace"] = tokens_with_timestamps[i + 1]["whitespace"]
i += 1
processed_tokens.append(token)
i += 1
processed_tokens = tokens_with_timestamps # Use tokens directly
# Use processed_tokens instead of tokens_with_timestamps for the rest of the method
if self.subtitle_mode == "Sentence + Highlighting":
+1 -1
View File
@@ -140,7 +140,7 @@ class QueueManager(QDialog):
instructions = QLabel(
"<h2>How Queue Works?</h2>"
"You can add text files (.txt) directly using the '<b>Add files</b>' button below. "
"To add PDF or EPUB files, use the input box in the main window and click the <b>'Add to Queue'</b> button. "
"To add PDF, EPUB or markdown files, use the input box in the main window and click the <b>'Add to Queue'</b> button. "
"Each file in the queue keeps the configuration settings active when it was added. "
"Changing the main window configuration afterward <b>does not</b> affect files already in the queue. "
"You can view each file's configuration by hovering over them."