From 98080e282c42ebe0835117017d7628715e2dcda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Z=C3=ADpek?= Date: Sat, 28 Dec 2024 13:25:46 +0100 Subject: [PATCH] fix(xtts): use correct language code for Czech num2words call (#237) * Fix num2words call using non-standard lang code * build: update minimum num2words version --------- Co-authored-by: Enno Hermann --- TTS/tts/layers/xtts/tokenizer.py | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TTS/tts/layers/xtts/tokenizer.py b/TTS/tts/layers/xtts/tokenizer.py index 076727239c..fec8358deb 100644 --- a/TTS/tts/layers/xtts/tokenizer.py +++ b/TTS/tts/layers/xtts/tokenizer.py @@ -501,12 +501,12 @@ def _remove_dots(m): def _expand_decimal_point(m, lang="en"): amount = m.group(1).replace(",", ".") - return num2words(float(amount), lang=lang if lang != "cs" else "cz") + return num2words(float(amount), lang=lang) def _expand_currency(m, lang="en", currency="USD"): amount = float((re.sub(r"[^\d.]", "", m.group(0).replace(",", ".")))) - full_amount = num2words(amount, to="currency", currency=currency, lang=lang if lang != "cs" else "cz") + full_amount = num2words(amount, to="currency", currency=currency, lang=lang) and_equivalents = { "en": ", ", @@ -535,11 +535,11 @@ def _expand_currency(m, lang="en", currency="USD"): def _expand_ordinal(m, lang="en"): - return num2words(int(m.group(1)), ordinal=True, lang=lang if lang != "cs" else "cz") + return num2words(int(m.group(1)), ordinal=True, lang=lang) def _expand_number(m, lang="en"): - return num2words(int(m.group(0)), lang=lang if lang != "cs" else "cz") + return num2words(int(m.group(0)), lang=lang) def expand_numbers_multilingual(text, lang="en"): diff --git a/pyproject.toml b/pyproject.toml index 16d990c169..a7baf29e31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,7 @@ dependencies = [ # Bark "encodec>=0.1.1", # XTTS - "num2words>=0.5.11", + "num2words>=0.5.14", "spacy[ja]>=3,<3.8", ]