A developer has released an open-source Python library designed to normalize Russian numbers before they are processed by text-to-speech (TTS) engines. The tool consists of 155 lines of code and relies on a single dependency, num2words.
The library addresses common issues in voice agents, such as the incorrect pronunciation of dates, phone numbers, currency, and percentages. By converting digits into words before synthesis, the agent ensures consistent output regardless of the specific TTS engine used.
The normalization process follows a strict order of operations: dates, phone numbers, money, percentages, order numbers, and finally, remaining digits. This sequence prevents conflicts between regular expressions and ensures that structured data is processed correctly.
Special handling is implemented for phone number groups with leading zeros, which are dictated digit-by-digit to avoid errors. The library also includes logic for Russian noun declension based on numbers and optional integration with RUAccent for stress marks.
The code is available under the MIT license. It includes seven automated tests to verify declensions and formatting, ensuring the tool remains lightweight and portable across different voice synthesis systems.






