mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
Fixed the issue where spaces were deleted before punctuation marks
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
# 1.1.9
|
||||||
|
- Fixed the issue where spaces were deleted before punctuation marks while generating subtitles.
|
||||||
|
|
||||||
# 1.1.8
|
# 1.1.8
|
||||||
- Added `.md` (Markdown) file extension support by @brianxiadong in PR #75
|
- 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
|
- Added new option `Configure silence between chapters` that lets you configure the silence between chapters, mentioned by @lfperez1982 in #79
|
||||||
|
|||||||
+1
-17
@@ -1189,23 +1189,7 @@ class ConversionThread(QThread):
|
|||||||
if not tokens_with_timestamps:
|
if not tokens_with_timestamps:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Always combine punctuation with preceding words for consistent handling across modes
|
processed_tokens = tokens_with_timestamps # Use tokens directly
|
||||||
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
|
|
||||||
|
|
||||||
# Use processed_tokens instead of tokens_with_timestamps for the rest of the method
|
# Use processed_tokens instead of tokens_with_timestamps for the rest of the method
|
||||||
if self.subtitle_mode == "Sentence + Highlighting":
|
if self.subtitle_mode == "Sentence + Highlighting":
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class QueueManager(QDialog):
|
|||||||
instructions = QLabel(
|
instructions = QLabel(
|
||||||
"<h2>How Queue Works?</h2>"
|
"<h2>How Queue Works?</h2>"
|
||||||
"You can add text files (.txt) directly using the '<b>Add files</b>' button below. "
|
"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. "
|
"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. "
|
"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."
|
"You can view each file's configuration by hovering over them."
|
||||||
|
|||||||
Reference in New Issue
Block a user