Downloads · 30 days
9
12% of all-time downloads
rufaelfekadu/diac-transformer-text-only-tashkeela
diac-transformer-text-only-tashkeela is a machine learning model from rufaelfekadu. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This is a transformer-baed model for Arabic text diacritization as described here.
Downloads · 30 days
9
12% of all-time downloads
All-time downloads
76
Public
Repo size
8.5 MB
Likes
1
Public
Click a slice to open those files.
.ckpt8.5 MB · 100%
From the Hugging Face model README
This is a transformer-baed model for Arabic text diacritization as described here.
DER (Diacritic Error Rate)
| Configuration | With case ending | Without case ending |
|---|---|---|
| Including no diacritic | 10.33% | 8.45% |
| Excluding no diacritic | 12.72% | 10.33% |
WER (Word Error Rate)
| Configuration | With case ending | Without case ending |
|---|---|---|
| Including no diacritic | 30.16% | 19.71% |
| Excluding no diacritic | 29.91% | 19.60% |
git clone https://github.com/rufaelfekadu/diac.git
cd diac
pip install -e .
from diac.models import DiacritizationModule
model = DiacritizationModule.from_pretrained(
"rufaelfekadu/diac-transformer-text-only-tashkeela",
tokenizer_constants_path="constants/" # Path to constants directory
)
# Predict diacritization for a text file
model.predict_file(
input_file="path/to/input.txt",
output_file="path/to/output.txt"
)
# Or predict for a single text string
diacritized_text = model.predict_text("مرحبا بك")
To evaluate the model on your own test set:
python inference.py \
--config configs/<model>.yml \
--opts \
DATA.TEST_PATH path/to/test.txt \
INFERENCE.MODEL_PATH <path_to_checkpoint> \
INFERENCE.OUTPUT_PATH path/to/predictions.txt
python src/diac/utils/prep_ref.py \
--input_file path/to/test.txt \
-o path/to/output_dir
python src/diac/utils/eval.py \
-ofp path/to/predictions.txt \
-tfp path/to/reference.txt \
--style Fadel
The evaluation script will output DER, WER, and SER metrics with different configurations: