File size: 3,297 Bytes
ce88d39
 
 
 
653ef09
 
a5ea48a
ce88d39
 
 
 
 
 
dc0b443
ce88d39
 
 
 
 
 
653ef09
ce88d39
 
653ef09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce88d39
653ef09
a5ea48a
653ef09
ce88d39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
license: mit
language:
- ar

widget:
 - text: 'اثنين همبرقر و اتنين قهوة، لو سمحت. باخذهم تيك اواي.'
---


# AraT5 CODAfication Model

## Model description
**AraT5 CODA** is a text normalization model that normalizes dialectal Arabic text into the Conventional Orthography for Dialectal Arabic (CODA).
The model was built by fine-tuning [AraT5-v2](https://huggingface.co/UBC-NLP/AraT5v2-base-1024) on the [MADAR CODA](https://camel.abudhabi.nyu.edu/madar-coda-corpus/) dataset.
Our fine-tuning procedure and the hyperparameters we used can be found in our paper *"[Exploiting Dialect Identification
in Automatic Dialectal Text Normalization](https://arxiv.org/abs/2407.03020)."* Our fine-tuning code and data can be found [here](https://github.com/CAMeL-Lab/codafication).


## Intended uses
You can use the **AraT5 CODA** model as part of Hugging Face's transformers >= 4.22.2.

## How to use
```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch

tokenizer = AutoTokenizer.from_pretrained('CAMeL-Lab/arat5-coda')
model = AutoModelForSeq2SeqLM.from_pretrained('CAMeL-Lab/arat5-coda')

text = 'اثنين همبرقر و اثنين قهوة، لوسمحت. باخذهم تيك اواي.'

inputs = tokenizer(text, return_tensors='pt')
gen_kwargs = {'num_beams': 5, 'max_length': 200,
              'num_return_sequences': 1,
              'no_repeat_ngram_size': 0, 'early_stopping': False
              }

codafied_text = model.generate(**inputs, **gen_kwargs)
codafied_text = tokenizer.batch_decode(codafied_text,
                                       skip_special_tokens=True,
                                       clean_up_tokenization_spaces=False)[0]

print(codafied_text)
"اثنين همبرقر واثنين قهوة، لو سمحت. بآخذهم تيك اوي."
```

## Citation
```bibtex
@inproceedings{alhafni-etal-2024-exploiting,
    title = "Exploiting Dialect Identification in Automatic Dialectal Text Normalization",
    author = "Alhafni, Bashar  and
      Al-Towaity, Sarah  and
      Fawzy, Ziyad  and
      Nassar, Fatema and
      Eryani, Fadhl and
      Bouamor, Houda and
      Habash, Nizar",
    booktitle = "Proceedings of ArabicNLP 2024"
    month = "aug",
    year = "2024",
    address = "Bangkok, Thailand",
    abstract = "Dialectal Arabic is the primary spoken language used by native Arabic speakers in daily communication. The rise of social media platforms has notably expanded its use as a written language. However, Arabic dialects do not have standard orthographies. This, combined with the inherent noise in user-generated content on social media, presents a major challenge to NLP applications dealing with Dialectal Arabic. In this paper, we explore and report on the task of CODAfication, which aims to normalize Dialectal Arabic into the Conventional Orthography for Dialectal Arabic (CODA). We work with a unique parallel corpus of multiple Arabic dialects focusing on five major city dialects. We benchmark newly developed pretrained sequence-to-sequence models on the task of CODAfication. We further show that using dialect identification information improves the performance across all dialects. We make our code, data, and pretrained models publicly available.",
}
```