wolof-normalizer-byt5-small
Normalizes non-standard Wolof (French-style / SMS spelling: kh for x, ou for u, gn for ñ, missing accents…) into the official orthography (CLAD alphabet).
| Input | Model output |
|---|---|
| dafa beug wakh ak yaw thi kanam | Dafa bëgg wax ak yaw ci kanam. |
| gnou bari dagnou meuna dem keur gui souba | Ñu bari dañu mëna dem kër gi suba. |
| khale yi dagnou beugue fo | Xale yi dañu bëgg fo. |
| Nanga def ? Mangui fi rek, dieuredieuf | Nanga def ? Maa ngi fi rek, jërëjëf |
| Ousmane dem na Paris ak sa yaye | Usmane dem na Paris ak sa yaay. |
Known limitations, visible above: some frequent fixed expressions are left unchanged (nanga def instead of na nga def, rek instead of rekk), proper nouns may be "Wolofized" (Ousmane → Usmane), and the model tends to add a final period.
Usage
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("Lahad/wolof-normalizer-byt5-small")
model = AutoModelForSeq2SeqLM.from_pretrained("Lahad/wolof-normalizer-byt5-small")
inputs = tokenizer(["gnou bari dagnou meuna dem keur gui souba"], return_tensors="pt", padding=True)
outputs = model.generate(**inputs, max_length=512, num_beams=4)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
Use it on raw text: applying the rule/lexicon normalizer first makes results worse.
Results
Test split of Lahad/wolof-normalization-pairs (688 real pairs from soynade-research/Wolof-Non-Standard-Orthography, never seen during training). WER = word error rate against the standard sentence, lowercased, punctuation ignored.
| System | WER ↓ |
|---|---|
| No normalization | 64.9% |
| Lexicon + rules (wolof-normalizer) | 22.7% |
| This model | 11.2% |
The non-standard side of the test set was generated by an LLM from real social-media patterns: expect lower scores on real messages.
Training
- Base model: google/byt5-small (byte-level, robust to spelling variation)
- Data: Lahad/wolof-normalization-pairs: ~31.5k pairs (real soynade pairs + standard sentences from google/smol and Wolof Wikipedia with synthetic SMS-style noise)
- 5 epochs, effective batch 32, Adafactor, learning rate 5e-4 (linear decay, 5% warmup), max 256 bytes, fp32, best checkpoint on validation WER (9.8%)
- ~50 min on one NVIDIA V100 32GB
- Code: github.com/LahadMbacke/wolof-normalizer
License
CC BY-SA 4.0, following the training data (soynade-research/Wolof-Non-Standard-Orthography and Wikipedia: CC BY-SA 4.0; google/smol: CC BY 4.0). The base model google/byt5-small is Apache 2.0.
Author: Baye Lahad Mbacke