X-ASR zh-TW — native Traditional + English + punctuation + ITN
A zh-TW–native variant of the trainable X-ASR streaming Zipformer2 transducer. It emits Traditional Chinese + English + punctuation directly (no Simplified→Traditional post-conversion), and ships a deterministic ITN post-step (spoken numbers → digits). Recognition accuracy is unchanged — the model is the deployed X-ASR with a relabeled/expanded output vocab.
from decode_tw import XasrTW
asr = XasrTW(device="cuda")
text = asr.transcribe(wav_16k_mono_float32)
# 超過二十年 → "超過20年" ; 三千六百元 → "3600元" ; 百分之五十 → "50%" ; 聽/說/妳/黨 native Traditional
What it does
| feature | how |
|---|---|
| Native Traditional | the 5000 Chinese tokens are relabeled Simplified→Traditional in tokens_tw.txt, plus 485 contextual-alternate Traditional chars added to the vocab (5000→5498) |
| English | unchanged from X-ASR |
| Punctuation | X-ASR is already a punctuation model (,。?!) |
| ITN | deterministic post-step tw_tokenizer.conservative_itn (cn2an + idiom guards): years/units/percent → digits, idioms (亂七八糟/千萬/十分) preserved |
Why ITN is a post-step, not in the model
An acoustic transducer cannot reliably learn Chinese place value (十=×10, 百=×100) from RNN-T alignment — fine-tuning it to emit digits produced wrong numbers (二十→2, 三千六百→36). A deterministic text rule gets it right every time. This mirrors standard production ASR, where ITN is a separate module.
Files
decode_tw.py— one-call decoder (model → Traditional+punct → ITN)xasr_tw_init.pt— the model (160.8M; X-ASR weights, expanded/relabeled output vocab)tokens_tw.txt,vocab_tw.json— the 5498-token Traditional vocab + char/digit mapstw_tokenizer.py— the ITN post-step (conservative_itn) + target tokenizerbuild_xasr_tw.py— reproducible builder (relabel + expand + warm-start fromxasr_native.pt)
Setup
git clone https://github.com/k2-fsa/icefall
export PYTHONPATH=icefall/egs/librispeech/ASR/zipformer:icefall:$PYTHONPATH
pip install lhotse opencc-python-reimplemented cn2an soundfile
python decode_tw.py audio_16k_mono.wav
Accuracy
Recognition is identical to native_strong (the model's acoustic path is untouched): zh-CER ≈ 0.0685, en-WER ≈ 0.040 (punct-stripped). The Traditional relabeling and ITN post-step change only the written form.
License & attribution
Apache-2.0. Built on GilgameshWind/X-ASR-zh-en (X-ASR authors) and
k2-fsa/icefall. ITN via cn2an + OpenCC.