refactor(domain): extract FakeToken to domain/tokens.py

Shared token stub used by both WebUI and PyQt for languages
without per-word token support.
This commit is contained in:
Artem Akymenko
2026-07-18 14:12:18 +03:00
parent d8634f812d
commit fcdaf2b2a8
3 changed files with 16 additions and 19 deletions
+1 -8
View File
@@ -31,6 +31,7 @@ from abogen.domain.output_paths import (
)
from abogen.domain.audio_helpers import build_ffmpeg_command, to_float32
from abogen.domain.audio_sink import AudioSink, open_audio_sink
from abogen.domain.tokens import FakeToken
from abogen.domain.audio_buffer import (
create_silence,
mix_audio,
@@ -1086,14 +1087,6 @@ class ConversionThread(QThread):
# Fallback for languages without token support (non-English)
# Create a single token representing the entire segment duration
if not tokens_list and result.graphemes:
class FakeToken:
def __init__(self, text, start, end):
self.text = text
self.start_ts = start
self.end_ts = end
self.whitespace = ""
tokens_list = [
FakeToken(result.graphemes, 0, chunk_dur)
]