clarvia-phonemizer
Turkish text to phonemes, with the text normalization built in. It reads phone numbers, account and installation numbers, dates, times, money, units, addresses, codes and abbreviations the way a person says them on the phone, then turns the words into Turkish phones with stress. Pure Python, no dependencies, runs anywhere Python 3.10 does (Pyodide included).
It is the front end of clarvia-tts-tiny, a 4.5M-parameter Turkish text-to-speech model, and keeps the interface of dizione, the English phonemizer of tiny-voca.
pip install git+https://huggingface.co/wite-tech/clarvia-phonemizer
clarvia-phonemizer "Borcunuz 1.250,50 TL, son ödeme 25.11.2026."
import clarvia_phonemizer
clarvia_phonemizer.normalize("Randevunuz 18.11.2026 saat 14:30'da.")
# 'Randevunuz on sekiz Kasım iki bin yirmi altı saat on dört otuzda.'
result = clarvia_phonemizer.phonemize("4'ü seçin")
print(result) # <bos> d ø ɾ d ˈy <sp> s e tʃ ˈi n <eos>
result.symbols # phones
result.ids # token ids for the TTS model
result.stress # 1 on stressed vowels
What it reads
Every row below is the phonemizer's actual output.
| Kind | Written | Said |
|---|---|---|
| Account, subscriber and installation numbers | Abone numaranız 04815162. | Abone numaranız sıfır dört sekiz bir, beş bir altı iki. |
| Record and ticket codes | MOCK-20260805-0417 | me o ce ka, iki sıfır iki altı sıfır sekiz sıfır beş, sıfır dört bir yedi |
| Turkish ID numbers (11 digits) | T.C. kimlik numaranız 11111111111 | Türkiye Cumhuriyeti kimlik numaranız bir bir bir, bir bir bir, bir bir bir, bir bir |
| Verification codes | Doğrulama kodunuz 482913. | Doğrulama kodunuz dört sekiz iki, dokuz bir üç. |
| Phone numbers (3-3-2-2) | 0555 123 45 67 | sıfır beş yüz elli beş, yüz yirmi üç, kırk beş, altmış yedi |
| International numbers | +90 212 123 45 67 | artı doksan, iki yüz on iki, yüz yirmi üç, kırk beş, altmış yedi |
| Addresses in registry style | ÇAMLIK MH. 123. SOKAK No: 5/2 Kat: 3 Daire: 7 KADIKÖY/İSTANBUL | çamlık Mahallesi yüz yirmi üçüncü sokak numara beş bölü iki kat üç daire yedi kadıköy, istanbul |
| Street abbreviations by context | 1453 Sk. ve Gül Sk. | bin dört yüz elli üç sokak ve Gül Sokağı |
| ISO date-times | 2026-06-05T12:25:00 | beş Haziran iki bin yirmi altı, saat on iki yirmi beş |
| Dates with suffixes | 30.09.2026, 15 Ekim'de | otuz Eylül iki bin yirmi altı, on beş Ekimde |
| Time ranges | Kesinti 12:25-16:25 arasında. | Kesinti on iki yirmi beş ile on altı yirmi beş arasında. |
| Lira and kuruş | 1.250,50 TL, 0,75 TL, 50 TL'yi | bin iki yüz elli lira elli kuruş, yetmiş beş kuruş, elli lirayı |
| Unit prices | 569,4 TL/kWh | kilovat saat başına beş yüz altmış dokuz lira kırk kuruş |
| Other currencies | $4,090 ve €1.200 | dört bin doksan dolar ve bin iki yüz avro |
| Scales | 1,5 milyon TL | bir buçuk milyon lira |
| Percentages | %18, %50'si | yüzde on sekiz, yüzde ellisi |
| Units | 250 kWh, 60 km/sa, -5°C | iki yüz elli kilovat saat, saatte altmış kilometre, eksi beş santigrat derece |
| Model names | RTX 4090, GTX 1080 | ar ti iks kırk doksan, ci ti iks on seksen |
| Letters with numbers | A320, Galaxy S24, 5G, 4K | a üç yüz yirmi, Galaxy se yirmi dört, beş ge, dört ka |
| Versions | Python 3.12 | Python üç nokta on iki |
| Licence plates | 34 ABC 123 | otuz dört, a be ce, yüz yirmi üç |
| E-mail and web addresses | info@ornek.com.tr | info et ornek nokta kom nokta te re |
| Suffixes after numbers | Kasım'ın 4'ünde, 1990'larda | Kasımın dördünde, bin dokuz yüz doksanlarda |
| Ordinals and Roman numerals | 3. kat, 21'inci yüzyıl, XX. yüzyıl | üçüncü kat, yirmi birinci yüzyıl, yirminci yüzyıl |
| Distributives | 3'er adet | üçer adet |
| Decimals | 3,14 | üç virgül on dört |
| Signs | ~100 TL, 5 + 3 = 8 | yaklaşık yüz lira, beş artı üç eşittir sekiz |
| Acronyms, spelled or read as words | KDV, SGK, NATO, ODTÜ, USB | ka de ve, se ge ka, nato, odtü, yu es bi |
| Institutions | EPDK, PTT, A.Ş. | Enerji Piyasası Düzenleme Kurumu, Posta ve Telgraf Teşkilatı, Anonim Şirketi |
| All-caps text | MAHALLENİN BİR KISMINDA ENERJİLER KESİK | mahallenin bir kısmında enerjiler kesik |
Emoji, markdown and HTML tags are dropped.
How it works
- Text rules (
rules.py): one pass over the text. At each position every rule that can start there is tried and the longest match wins, soTL/kWhis one unit price and0555 123 45 67one phone number, without a chain of passes that must run in a careful order. A suffix written after a number, unit or code (4'ü,2025'te,TL'yi) is rebuilt on the word that is actually said, with vowel harmony, buffer consonants, d/t alternation and dört → dördü (turkish.py). - Letters to phones (
g2p.py): palatal k and g and light and dark l follow the nearest vowel; ğ lengthens the vowel or becomes [j]; a circumflex marks a palatal consonant or a long vowel; n before k and g is [ŋ]. - Stress (
stress.py): last syllable by default; the syllable before an unstressable suffix (GEL-me-di, ge-Lİ-yor); Sezer's rule for place names, kept under suffixes (AN-ka-ra-da); an exception list for adverbs, loanwords and brands; clitics unstressed.
The output uses 56 symbols: 24 consonants, 15 vowels (8 short, 7 long), 12 punctuation marks and 5 special
tokens. clarvia_phonemizer.SYMBOLS lists them, and identity() gives a fingerprint of the rules and data so
tokens from two versions are never mixed.
Extending it
The word lists are plain text in clarvia_phonemizer/data/:
exceptions.txt: respelling and stress for words the rules get wrong (şimdi, yarın, fatura, numara, WhatsApp…).places.txt: provinces and districts, stressed by Sezer's rule.function_words.txt: clitics read without stress.
Limitations
- The stress rules are heuristics (suffix patterns plus an exception list), not a morphological analyser.
Rare verb forms can be stressed wrong; add them to
exceptions.txt. - Identifiers are grouped by context (a number after "abone numaranız" is read in groups); a bare long number with no context is read as a quantity unless it has 7 or more digits.
- Foreign words outside the exception list are read with Turkish letter rules.
Licence
Apache-2.0. The design and the interface follow dizione by Muhammed Nazeem (Apache-2.0); the Turkish rules and data are new.