tssandor/hungarian-diacritics-small - Hungarian diacritics restoration
2 min read
This model automatically restores missing or damaged diacritics in Hungarian text. It runs locally on a CPU or directly in the browser via WebAssembly, weighs only 9.21 MB in Int8 ONNX format, and processes text in milliseconds. The model predicts one of four accent classes for vowels, guaranteed to leave consonants, punctuation, and string length unchanged. It is useful for developers, translators, and anyone working with Hungarian texts on devices without specialized keyboards.
Key features
- Anti-hallucination protection: the model does not generate text from scratch, only adding accents to existing vowels.
- High speed: inference takes just a few milliseconds on a standard processor.
- Browser support: runs client-side via onnxruntime-web without heavy libraries like PyTorch.
- Conservative mode: the tau parameter allows text editing only when the model has high confidence.
What you can do
- Fix user input: integrate into messengers or website forms to automatically correct Hungarian text typed on mobile keyboards.
- Restore old archives: batch process text files with corrupted Latin-1 encoding (errors like õ/û).
- Web integration: deploy a client-side app directly in the browser without sending user data to a server.
Example
An example of using the model in Python with the numpy and onnxruntime libraries:
import os, sys
from huggingface_hub import snapshot_download
model_dir = snapshot_download("tssandor/hungarian-diacritics-small")
sys.path.insert(0, model_dir)
from restore_hu import HungarianDiacriticRestorer
restorer = HungarianDiacriticRestorer(model_dir)
print(restorer.restore("szia atneztem a doksit, holnap megbeszeljuk a koruton"))
# -> szia átnéztem a doksit, holnap megbeszéljük a körútonRead more
DetailsBenchmarks: 99.34% word accuracy on the general test corpus and 99.16% on OOD HPLT data.
Hardware requirements: lightweight model for CPU and browser (9.21 MB Int8 ONNX).
Training details: based on the CharDiacriticTagger architecture (9.04M parameters) with QInt8 quantization.
License: Apache-2.0.










Comments