A 52.7M-parameter Marian model (E69) that turns the written parts of a Ukrainian sentence -- numbers, dates, money,
units, Roman numerals, abbreviations, Latin words, symbols, footnote marks -- into the words a narrator would say,
one span at a time. It sees the whole sentence with one span marked [[ ]] and writes only that span's spoken
form; everything outside the spans is copied from the input, so ordinary prose is never rewritten.
На 2 поверсі є 3 кімнати та 12 дверей.
spans: [[2 поверсі]] [[3 кімнати]] [[12 дверей]]
model: другому поверсі | три кімнати | дванадцять дверей
-> На другому поверсі є три кімнати та дванадцять дверей.
Вічний Жид[93], і в мене також є свій ґедзь. [[[93]]] -> "" (footnote marks are not read)
spans.py (next to the model) finds the spans from the shape of the characters only and assembles the result; it is
the reference implementation used by the accentuk package. Training and
evaluation code: vacuum-in/marian-uk-verbalizer.
import ctranslate2
from transformers import MarianTokenizer
from spans import assemble, detect_spans, model_input
tok = MarianTokenizer.from_pretrained(".")
tr = ctranslate2.Translator(".", compute_type="int8")
def verbalize(sentence):
spans = detect_spans(sentence)
inputs = [tok.convert_ids_to_tokens(tok(model_input(sentence, sp), truncation=True, max_length=192)["input_ids"])
for sp in spans]
res = tr.translate_batch(inputs, beam_size=1, max_decoding_length=96,
min_decoding_length=0, # a span may be read as nothing
suppress_sequences=[["<s>"]]) if inputs else []
outs = [tok.decode(tok.convert_tokens_to_ids(r.hypotheses[0]), skip_special_tokens=True) for r in res]
return assemble(sentence, spans, outs)
min_decoding_length=0 is required: CTranslate2's default of 1 forbids the empty reading of a footnote mark, and the
model then invents a word for it. suppress_sequences=[["<s>"]]: this export starts decoding from <s>, which must
never be generated.
Spoken match (case, punctuation and hyphens are not heard; a line counts only if every span is right), measured 2026-10-21 with this CT2 INT8 export on CPU:
| test | E69 (this model) | E60 (previous revision) |
|---|---|---|
held-out splits of skypro1111/uk-text-normalization, 3,619 rows |
88.34% | 88.86% |
| 1,323 audiobook sentences with digits, Latin, abbreviations or symbols (five-judge references, manual review) | 61.90% | 59.56% |
| business and technical text, 30 lines (business_v1) | 90.0% | 56.7% |
| business and technical text, 36 lines (business_v2) | 91.7% | 38.9% |
| unseen business text, 41 lines, judged blind by an LLM | 27/41 | 21/41 |
The real-text references were re-done in October 2026 (five LLM judges and a manual pass, several acceptable readings per sentence), so these numbers are lower than the 2026-10-14 ones for E60 on the older references. business_v1/v2 guided E66-E69's data and are not unseen tests.
9.6 ms per sentence on a desktop CPU (batched spans), 54 MB.
E69 = E60 trained one more epoch (3e-5) on 400k of its span rows plus generated rows for: numbered lists, Roman section
headings and words in capitals; OCR'd "3" for З, years and life spans in parentheses, day ranges, BC years, footnote
numbers; and business and technical text -- space-grouped thousands, versions, signed temperatures, small decimals,
$/€/£ amounts and exchange rates, times (00:xx, ranges, after prepositions), weekday ranges, ÷, sizes, dates, units
(мс, А, В, м³, мм рт. ст., ...), IP addresses, contract numbers, number case after prepositions, durations, ratios.
The detector in spans.py now also marks ÷, weekday ranges ("пн–пт") and two-letter words with no vowel ("пт").
E60:
E54 (the whole-sentence model of this project) warm-started on 1.1M span pairs cut from E54's sentence pairs by aligning written and spoken words, plus footnote marks read as nothing, ruler names before Roman numerals in every case and animate counts upsampled; two epochs at 5e-5.