mohammedaly22 commited on
Commit
32e5300
·
verified ·
1 Parent(s): 7258d42

Add ArabicDeXlit corpus: 476K examples, 8 dialects, 30% pass-through

Browse files
Files changed (5) hide show
  1. README.md +309 -0
  2. dataset_stats.json +38 -0
  3. test.parquet +3 -0
  4. train.parquet +3 -0
  5. validation.parquet +3 -0
README.md ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ task_categories:
4
+ - token-classification
5
+ - text2text-generation
6
+ language:
7
+ - ar
8
+ - en
9
+ tags:
10
+ - code-switching
11
+ - arabic
12
+ - transliteration
13
+ - arabizi
14
+ - asr
15
+ - asr-post-processing
16
+ - dialectal-arabic
17
+ - speech-recognition
18
+ size_categories:
19
+ - 100K<n<1M
20
+ configs:
21
+ - config_name: default
22
+ data_files:
23
+ - split: train
24
+ path: train.parquet
25
+ - split: validation
26
+ path: validation.parquet
27
+ - split: test
28
+ path: test.parquet
29
+ ---
30
+
31
+ # ArabicDeXlit-Corpus
32
+
33
+ **Training data for undoing transliteration in Arabic ASR output.**
34
+
35
+ Arabic speech recognition systems handle code-switching badly. When a speaker says an English
36
+ word, the model writes it out in Arabic letters — *intern* becomes `انترن`, *AI* becomes `ايه اي`.
37
+ The transcript is phonetically sensible and practically unusable: you cannot search it, index it,
38
+ or hand it to an English NLP tool.
39
+
40
+ This corpus trains a model to repair that, **without touching text that is genuinely Arabic**.
41
+
42
+ | | |
43
+ |---|---|
44
+ | **Input** (`src`) | `كنت انترن في او اي اي و بعدها جالي اوفر` |
45
+ | **Output** (`tgt`) | `كنت intern في OIE و بعدها جالي offer` |
46
+ | **Pure Arabic in** | `أنا رايح البيت دلوقتي` |
47
+ | **Pure Arabic out** | `أنا رايح البيت دلوقتي` — unchanged |
48
+
49
+ - **475,945 examples** across **9 dialect labels**
50
+ - **30% pass-through rows** where the correct answer is *change nothing*
51
+ - **1,383,667 labelled spans**, tagged by category
52
+ - Zero train/test leakage, zero token/tag misalignment (both verified — see *Quality guarantees*)
53
+
54
+ ---
55
+
56
+ ## Quick start
57
+
58
+ ```python
59
+ from datasets import load_dataset
60
+
61
+ ds = load_dataset("mohammedaly22/ArabicDeXlit-Corpus")
62
+ print(ds)
63
+ print(ds["train"][0])
64
+ ```
65
+
66
+ Only the sentences that must be left untouched:
67
+
68
+ ```python
69
+ passthrough = ds["train"].filter(lambda r: r["is_passthrough"])
70
+ ```
71
+
72
+ Only a given dialect:
73
+
74
+ ```python
75
+ levantine = ds["train"].filter(lambda r: r["dialect"] == "lev")
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Row format
81
+
82
+ ```json
83
+ {
84
+ "src": "أنا عندي ميتينج مهم",
85
+ "tgt": "أنا عندي meeting مهم",
86
+ "src_tokens": ["أنا", "عندي", "ميتينج", "مهم"],
87
+ "tags": ["O", "O", "B-CS", "O"],
88
+ "spans": [{"start": 2, "end": 3, "category": "CS", "target": "meeting"}],
89
+ "dialect": "egy",
90
+ "source": "sdaia",
91
+ "is_passthrough": false,
92
+ "num_spans": 1
93
+ }
94
+ ```
95
+
96
+ | Field | Type | Meaning |
97
+ |---|---|---|
98
+ | `src` | `string` | The noisy ASR-style input — English rendered in Arabic letters. |
99
+ | `tgt` | `string` | The corrected output. |
100
+ | `src_tokens` | `list[string]` | `src` split on whitespace. |
101
+ | `tags` | `list[string]` | **One tag per token of `src`.** BIO scheme; `O` = copy verbatim. |
102
+ | `spans` | `list[struct]` | `start`, `end` (exclusive), `category`, `target` — token offsets into `src_tokens`. |
103
+ | `dialect` | `string` | Dialect code (see below). |
104
+ | `source` | `string` | `sdaia`, `gemini`, `monolingual`, or `sdaia-mono`. |
105
+ | `is_passthrough` | `bool` | True when every tag is `O`, i.e. `src == tgt`. |
106
+ | `num_spans` | `int32` | Convenience count of `spans`. |
107
+
108
+ ### The tag scheme
109
+
110
+ `O` plus `B-`/`I-` for each of five categories, 11 tags in total.
111
+
112
+ `O` is the **identity tag**: a token tagged `O` is copied to the output byte for byte. A sentence
113
+ whose tags are all `O` is therefore returned completely unchanged. This is what makes the task
114
+ learnable as tagging rather than generation, and it is the property that lets a model built on this
115
+ data be safe to drop into a live pipeline.
116
+
117
+ ### Span categories
118
+
119
+ The category is part of the label because the same characters convert differently depending on it —
120
+ `ايه اي` is `AI` as an acronym, but would be `eh ay` as an ordinary word.
121
+
122
+ | Category | Count | Input | Output |
123
+ |---|---|---|---|
124
+ | `CS` | 1,368,208 | `انترن` | `intern` |
125
+ | `ACRONYM` | 9,126 | `ايه اي` | `AI` |
126
+ | `EMAIL` | 4,370 | `احمد ات جيميل دوت كوم` | `ahmed@gmail.com` |
127
+ | `ENTITY` | 1,963 | `اورانج انوفيشن ايجيبت` | `Orange Innovation Egypt` |
128
+ | `NUMBER` | 0 | `تو زيرو تو فور` | `2024` |
129
+
130
+ ---
131
+
132
+ ## Splits
133
+
134
+ | Split | Rows | Pass-through | Spans |
135
+ |---|---|---|---|
136
+ | `train` | 428,376 | 128,581 (30.0%) | 1,245,593 |
137
+ | `validation` | 23,601 | 7,061 (29.9%) | 68,399 |
138
+ | `test` | 23,968 | 7,141 (29.8%) | 69,675 |
139
+
140
+ Splits are assigned by **hashing a normalised sentence key** rather than shuffling, so a rebuild
141
+ reproduces exactly the same test set — important if this corpus is to serve as a shared benchmark.
142
+
143
+ ## Dialect coverage
144
+
145
+ | Code | Dialect | Rows |
146
+ |---|---|---|
147
+ | `unk` | Mixed / unlabelled (monolingual pass-through) | 142,599 |
148
+ | `msa` | Modern Standard Arabic | 109,929 |
149
+ | `egy` | Egyptian | 104,818 |
150
+ | `glf` | Gulf (Saudi/Emirati/Kuwaiti) | 104,004 |
151
+ | `yem` | Yemeni | 3,566 |
152
+ | `lev` | Levantine (Syrian/Lebanese/Jordanian/Palestinian) | 2,939 |
153
+ | `mgr` | Maghrebi (Moroccan/Algerian/Tunisian) | 2,912 |
154
+ | `sdn` | Sudanese | 2,701 |
155
+ | `irq` | Iraqi | 2,477 |
156
+
157
+ `unk` is monolingual Arabic contributing pass-through examples; it is dialectally mixed and is
158
+ labelled honestly rather than guessed at.
159
+
160
+ ---
161
+
162
+ ## How the data was built
163
+
164
+ ### The core idea: invert the corpus
165
+
166
+ Parallel data for this task barely exists. But corpora of the **target** form — Arabic with English
167
+ correctly in Latin script — are plentiful. So the pipeline runs the problem backwards: given a
168
+ target sentence, it transliterates the English into Arabic letters to *manufacture* the noisy ASR
169
+ input.
170
+
171
+ ```
172
+ target (have it) كنت intern في Orange
173
+ ↓ transliterate the English into Arabic script
174
+ source (make it) كنت انترن في اورانج
175
+ ↓ record where each rewrite landed
176
+ tags O B-CS O B-CS
177
+ ```
178
+
179
+ This matters for correctness, not just convenience. Because spans are recorded **during**
180
+ generation rather than recovered afterwards by alignment, the labels cannot silently drift out of
181
+ sync with the text — the failure mode that quietly poisons hand-aligned corpora.
182
+
183
+ ### The transliterator is deliberately stochastic
184
+
185
+ Real ASR is inconsistent. The same English word comes out differently depending on speaker,
186
+ accent and acoustics. So each call samples among plausible renderings:
187
+
188
+ | English | Sampled Arabic forms |
189
+ |---|---|
190
+ | `intern` | `انترن` · `انتيرن` · `انترين` |
191
+ | `meeting` | `ميتينج` · `ميتنج` · `ميتينغ` |
192
+ | `project` | `بروجكت` · `برجكت` · `بروجيكت` |
193
+
194
+ A model trained across several epochs therefore meets the variation it will actually face in
195
+ production, instead of one canonical spelling it could memorise.
196
+
197
+ The generator also models how things are *spoken*: acronyms letter by letter (`AI` → `ايه اي`),
198
+ emails symbol by symbol (`@` → `ات`, `.` → `دوت`), and digits as words (`2024` → `تو زيرو تو فور`).
199
+
200
+ ### Sources
201
+
202
+ | Source | Contribution | License |
203
+ |---|---|---|
204
+ | [SDAIA ArE-CSTD](https://huggingface.co/datasets/SDAIANCAI/Ar-En-Code-Switching-Textual-Dataset) | 310,578 rows — MSA, Saudi, Egyptian | CC-BY-SA-4.0 |
205
+ | Gemini synthesis | 22,584 rows — the missing dialects and rare categories | generated for this corpus |
206
+ | Arabic Wikipedia + dialectal ASR transcripts | 142,783 rows — pass-through examples | CC-BY-SA |
207
+
208
+ **Why synthesis was necessary.** SDAIA covers three dialects and is almost entirely plain
209
+ word-level code-switching. Measured on 20K of its sentences: ~60,000 ordinary code-switch spans but
210
+ only **178 acronyms, 9 entities, and zero emails or numbers**. Generation was therefore aimed
211
+ narrowly at those gaps — the five uncovered dialects, and the acronym / email / number / entity
212
+ categories — rather than at bulk volume that SDAIA already supplies.
213
+
214
+ **Why external monolingual text was necessary.** SDAIA is ~99% code-switched by construction, so it
215
+ cannot supply the pass-through half of the task. Those rows come from Arabic Wikipedia and
216
+ dialectal ASR transcripts instead.
217
+
218
+ Crucially, they are **screened**: a "monolingual" sentence containing already-transliterated
219
+ English (`الميتينغ`, `الويكند`, `الشوبينج`) is rejected, because using it as a pass-through example
220
+ would teach a model to leave transliteration alone — the exact opposite of the task. The screen is
221
+ generated by running the project's own transliterator over a list of common loanwords, so it covers
222
+ spelling variants without anyone hand-enumerating them.
223
+
224
+ ---
225
+
226
+ ## Quality guarantees
227
+
228
+ Each of these was **verified on the released build**, not assumed:
229
+
230
+ | Check | Result |
231
+ |---|---|
232
+ | Family-key overlap, train ∩ test | **0** |
233
+ | Family-key overlap, train ∩ validation | **0** |
234
+ | Family-key overlap, validation ∩ test | **0** |
235
+ | Rows where `len(tags) != len(src_tokens)` | **0** |
236
+ | Tags outside the 11-tag schema | **0** |
237
+ | Pass-through rows where `src != tgt` | **0** |
238
+
239
+ **On leakage specifically.** SDAIA is LLM-generated and contains large families of near-identical
240
+ sentences (`اليوم عندي meeting مع ال team في المكتب` and dozens of small variants). A random split
241
+ scatters such a family across train and test and inflates every reported score. Here, splitting is
242
+ done on a *normalised* key — diacritics stripped, alef/ya/ta-marbuta variants folded, digits
243
+ collapsed — so an entire family lands in one split.
244
+
245
+ One subtle case is handled explicitly: SDAIA writes English *mall* as `مال`, which is also an
246
+ ordinary Arabic word, so two different targets can collapse to the same input string. Identical
247
+ inputs are pinned to a single split rather than being allowed to follow their differing targets.
248
+
249
+ ---
250
+
251
+ ## Intended uses
252
+
253
+ - **ASR post-processing** — the motivating use: repair code-switched transcripts in place.
254
+ - **Token classification** — detecting transliterated spans (`src_tokens` + `tags`).
255
+ - **Character-level transliteration** — Arabic script → Latin, using the `spans` field alone.
256
+ - **Evaluating pass-through safety** — `is_passthrough` isolates the rows a model must not alter.
257
+
258
+ ### Limitations, stated plainly
259
+
260
+ - **`src` is synthetic.** Inputs are generated from a phonetic model of Arabic ASR errors, not
261
+ transcribed from real ASR output. The generator was tuned against real examples and reproduces
262
+ their characteristic forms, but a held-out set of genuine ASR transcripts is the right way to
263
+ confirm any result from this corpus.
264
+ - **Dialect balance is uneven.** MSA, Egyptian and Gulf dominate, because that is what the free
265
+ corpora cover; the five synthesised dialects are present in the low thousands each.
266
+ - **`ENTITY` and `NUMBER` are thin** relative to `CS`. If your application leans on them, generate
267
+ more with the repository's synthesis script.
268
+ - **Some rows come from an LLM** (SDAIA is GPT-4-generated; the dialect top-up is Gemini-generated)
269
+ and carry the register and topic biases that implies.
270
+
271
+ ---
272
+
273
+ ## License
274
+
275
+ **CC-BY-SA-4.0**, inherited from SDAIA ArE-CSTD's share-alike term. Derivatives must carry the same
276
+ licence.
277
+
278
+ [Casablanca](https://huggingface.co/datasets/UBC-NLP/Casablanca) is deliberately **excluded**. It is
279
+ an excellent multi-dialect corpus that annotates code-switched words in both scripts, but it is
280
+ licensed CC-BY-**NC-ND** — the no-derivatives term forbids republishing transliterated derivatives
281
+ of it. It remains suitable as a held-out evaluation set, cited rather than redistributed.
282
+
283
+ ## Citation
284
+
285
+ ```bibtex
286
+ @misc{arabicdexlit2026,
287
+ title = {ArabicDeXlit: Undoing Transliteration in Arabic ASR Code-Switching},
288
+ author = {Mohammed Aly},
289
+ year = {2026},
290
+ url = {https://github.com/MohammedAly22/Arabic-DeXlit}
291
+ }
292
+ ```
293
+
294
+ Please also cite the underlying corpus:
295
+
296
+ ```bibtex
297
+ @inproceedings{ArECSTD2024,
298
+ title = {Leveraging LLM for Augmenting Textual Data in Code-Switching ASR: Arabic as an Example},
299
+ author = {Alharbi, Sadeen and Aloraini, Raghad and BinMuqbil, Reem and Ali, Ahmed and
300
+ Bari, Saiful and Alowisheq, Areeb and Alonaizan, Yaser},
301
+ year = {2024},
302
+ publisher = {NCAI-SDAIA}
303
+ }
304
+ ```
305
+
306
+ ## Links
307
+
308
+ - **Code & training** — <https://github.com/MohammedAly22/Arabic-DeXlit>
309
+ - **Model** — [`mohammedaly22/ArabicDeXlit-base`](https://huggingface.co/mohammedaly22/ArabicDeXlit-base)
dataset_stats.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "total_seen": 352582,
3
+ "kept": 475945,
4
+ "skipped_no_latin": 3246,
5
+ "skipped_duplicate": 16170,
6
+ "passthrough_examples": 142783,
7
+ "passthrough_ratio": 0.3,
8
+ "total_tokens": 5626914,
9
+ "total_spans": 1383667,
10
+ "by_split": {
11
+ "train": 428376,
12
+ "validation": 23601,
13
+ "test": 23968
14
+ },
15
+ "by_dialect": {
16
+ "msa": 109929,
17
+ "egy": 104818,
18
+ "glf": 104004,
19
+ "sdn": 2701,
20
+ "yem": 3566,
21
+ "irq": 2477,
22
+ "mgr": 2912,
23
+ "lev": 2939,
24
+ "unk": 142599
25
+ },
26
+ "by_source": {
27
+ "sdaia": 310578,
28
+ "gemini": 22584,
29
+ "monolingual": 142599,
30
+ "sdaia-mono": 184
31
+ },
32
+ "by_category": {
33
+ "CS": 1368208,
34
+ "ACRONYM": 9126,
35
+ "ENTITY": 1963,
36
+ "EMAIL": 4370
37
+ }
38
+ }
test.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fcf1ddb8f7339dc64521bd7700a04a2a5d524a1762c083686738d0bf2bf66a9
3
+ size 3329936
train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e482ab3683a627274cb1cdf378330469087d6710d8d2bdd183a878692bd47a8f
3
+ size 61779083
validation.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61a6dd2ace506327aaff03e51946d5d9f17db531c4af967696d8190187243003
3
+ size 3260820