chore: auto-commit from dashboard

This commit is contained in:
2026-08-22 08:40:56 +00:00
parent 4d2dbfb8a7
commit fe500a7227
35 changed files with 1372 additions and 144 deletions

View File

@@ -12,6 +12,7 @@ import pytest
from src.voice.normalize import (
expand_abbreviations,
expand_currency,
expand_for_tts,
expand_numbers_ro,
expand_symbols,
normalize_for_tts,
@@ -108,11 +109,19 @@ def test_normalize_for_tts_currency_ro_accounting_format(text, expected):
("foo & bar", "foo și bar"),
("Marius @ home", "Marius la home"),
("30°", "30 grade"),
("~30", "aproximativ 30"),
])
def test_expand_symbols(text, expected):
assert expand_symbols(text) == expected
def test_expand_symbols_tilde_english():
# Bare '~' passed unexpanded to pocket-tts corrupts nearby speech
# (observed: dropped/garbled words, shortened audio) — must become
# a spoken word before reaching the TTS engine, not stay literal.
assert expand_symbols("~six thousand", lang='en') == "about six thousand"
# ============================================================
# Abbreviations (4)
# ============================================================
@@ -148,6 +157,18 @@ def test_truncate_over_200_words_appends_suffix():
assert words[200:] == ["Restul", "l-am", "scris", "în", "chat."]
# ============================================================
# English number path (pocket-tts, lang='en')
# ============================================================
@pytest.mark.parametrize("text,expected", [
("Bank balance: ~105.300 lei.", "Bank balance: about one hundred and five thousand, three hundred lei."),
("Cash balance: ~6.000 lei.", "Cash balance: about six thousand lei."),
("That takes 3.5 hours.", "That takes three point five hours."),
])
def test_expand_for_tts_english_numbers(text, expected):
assert expand_for_tts(text, lang='en') == expected
# ============================================================
# Edge cases (2)
# ============================================================