This repository provides an annotation interface for diacritization using two different models: Farasa (online API) and CATT (local model). It allows users to process Arabic text, apply diacritization, and manually correct outputs where necessary.
Ensure you have the following dependencies installed:
torch, gradio, requests, pandas, pyarabic, argparseInstall dependencies and model via:
sh setup.sh
To launch the annotation tool, run the following command:
python ./_code/annotation_interface.py -m /path/to/manifest.csv -r /path/to/audio/files -o /path/to/save/output.csv -s 0
| Argument | Description |
|---|---|
-m, --manifest_file | Path to the metadata CSV file for the speech corpus. |
-r, --audio_root | Path to the directory containing audio files. |
-o, --out_file | Path to save the annotated output. |
-s, --start_index | Index to start from, useful for resuming annotation. |
The Farasa API is called via:
url = 'https://farasa.qcri.org/webapi/seq2seq_diacritize/'
api_key = "YOUR_API_KEY"
payload = {'text': text, 'api_key': api_key, 'dialect': "mor"}
data = requests.post(url, data=payload)
if data.ok:
result = json.loads(data.text)
print(result["text"])
else:
print("Error")
The annotation interface is built using Gradio with the following features:
best_ed_mlm_ns_epoch_178.pt). just use the setup.sh file or Download it and place it inside the catt/models/ directory.CUDA if available; otherwise, it runs on CPU.This project provides an automatic annotation pipeline for diacritizing Arabic text while preserving Latin words. The tool processes a dataset containing audio transcriptions, removes Latin words, applies diacritization using either Farasa or CATT models, and then reinserts the Latin words in their original positions.
sh setup.sh
python ./_code/auto_annotation.py -i <input_file> -o <output_file> -m <catt|farasa> -v <0|1>
python script.py -i dataset.csv -o output.csv -m farasa -v 0
| Argument | Description |
|---|---|
-i, --manifest_file | Path to input dataset (CSV file) |
-o, --out_file | Output file to save the processed dataset (default: ./diacritized.csv) |
-m, --module | Choose diacritization model: catt or farasa (default: catt) |
-v, --verbose | Set verbosity level (0 for silent, 1 for debug output) |
ID, filename, transcription, duration columns).latin_words: Extracted Latin words with positions.cleaned_transcription: Arabic text without Latin words.annotated_transcription: Final diacritized Arabic text with Latin words restored.الحركة النسوية كيفاش بدات و علاش بدات و شنوا المطالب متع النسويات ضيفتي ليوم رانية عطافي feminist a book reviewer an english teacher و لfounder متع طبرقة book club و a point كتبت
الْحَرَكَةُ النِّسْوِيَّةُ كَيْفَاشٍ بَدَاتٍ وَ عَلَاشٍ بَدَاتٍ وَ شَنُّوا الْمَطَالِبَ مُتَعَ النِّسْوِيَّاتِ ضَيْفَتِي لِيَوْمِ رَانِيَةٍ عَطَافِيٌّ feminist a book reviewer an english teacher وَ لfounder مُتَعَ طَبَرْقَةَ book club وَ a point كَتَبْتُ
This project is open-source under the MIT License.
For any questions, feel free to reach out! 🚀
This repository provides an annotation interface for diacritization using two different models: Farasa (online API) and CATT (local model). It allows users to process Arabic text, apply diacritization, and manually correct outputs where necessary.
Ensure you have the following dependencies installed:
torch, gradio, requests, pandas, pyarabic, argparseInstall dependencies and model via:
sh setup.sh
To launch the annotation tool, run the following command:
python ./_code/annotation_interface.py -m /path/to/manifest.csv -r /path/to/audio/files -o /path/to/save/output.csv -s 0
| Argument | Description |
|---|---|
-m, --manifest_file | Path to the metadata CSV file for the speech corpus. |
-r, --audio_root | Path to the directory containing audio files. |
-o, --out_file | Path to save the annotated output. |
-s, --start_index | Index to start from, useful for resuming annotation. |
The Farasa API is called via:
url = 'https://farasa.qcri.org/webapi/seq2seq_diacritize/'
api_key = "YOUR_API_KEY"
payload = {'text': text, 'api_key': api_key, 'dialect': "mor"}
data = requests.post(url, data=payload)
if data.ok:
result = json.loads(data.text)
print(result["text"])
else:
print("Error")
The annotation interface is built using Gradio with the following features:
best_ed_mlm_ns_epoch_178.pt). just use the setup.sh file or Download it and place it inside the catt/models/ directory.CUDA if available; otherwise, it runs on CPU.This project provides an automatic annotation pipeline for diacritizing Arabic text while preserving Latin words. The tool processes a dataset containing audio transcriptions, removes Latin words, applies diacritization using either Farasa or CATT models, and then reinserts the Latin words in their original positions.
sh setup.sh
python ./_code/auto_annotation.py -i <input_file> -o <output_file> -m <catt|farasa> -v <0|1>
python script.py -i dataset.csv -o output.csv -m farasa -v 0
| Argument | Description |
|---|---|
-i, --manifest_file | Path to input dataset (CSV file) |
-o, --out_file | Output file to save the processed dataset (default: ./diacritized.csv) |
-m, --module | Choose diacritization model: catt or farasa (default: catt) |
-v, --verbose | Set verbosity level (0 for silent, 1 for debug output) |
ID, filename, transcription, duration columns).latin_words: Extracted Latin words with positions.cleaned_transcription: Arabic text without Latin words.annotated_transcription: Final diacritized Arabic text with Latin words restored.الحركة النسوية كيفاش بدات و علاش بدات و شنوا المطالب متع النسويات ضيفتي ليوم رانية عطافي feminist a book reviewer an english teacher و لfounder متع طبرقة book club و a point كتبت
الْحَرَكَةُ النِّسْوِيَّةُ كَيْفَاشٍ بَدَاتٍ وَ عَلَاشٍ بَدَاتٍ وَ شَنُّوا الْمَطَالِبَ مُتَعَ النِّسْوِيَّاتِ ضَيْفَتِي لِيَوْمِ رَانِيَةٍ عَطَافِيٌّ feminist a book reviewer an english teacher وَ لfounder مُتَعَ طَبَرْقَةَ book club وَ a point كَتَبْتُ
This project is open-source under the MIT License.
For any questions, feel free to reach out! 🚀