File size: 3,925 Bytes
87f030e
 
 
 
211159a
9f02f7d
87f030e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b0cd82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
configs:
- config_name: default
  data_files:
  - split: Dialect2SQL
    path: Dialect2SQL.csv
  - split: train
    path: train.csv
  - split: validation
    path: validation.csv
  - split: test
    path: test.csv
task_categories:
- text-generation
- translation
language:
- en
- ar
tags:
- text-to-sql
- question-to-sql
- nlq-to-sql
- SQL
- english-to-sql
- low-resource-languages
- darija
- Arabic-dialect
size_categories:
- 1K<n<10K
---

# Dialect2SQL

## Dataset Description

**Dialect2SQL** is a novel dataset designed for the **Text-to-SQL** task in **Arabic dialects**, with a particular focus on **Moroccan Darija**.  
It provides natural language questions written in Darija, paired with corresponding SQL queries and database schemas.  
The dataset enables research on **low-resource natural language interfaces to databases (NLIDB)** in non-standard Arabic varieties.

---

## Dataset Summary

Dialect2SQL aims to bridge the gap between Arabic dialects and structured query understanding.  
The dataset consists of manually and semi-automatically curated **Darija–SQL** pairs mapped to realistic database schemas spanning multiple domains (e.g., education, e-commerce, banking, and transportation).  
Each entry contains:
- a **Darija** question (`darija_question`)
- an optional **English translation** (`en_question`)
- the **SQL query** (`sql`)
- the **database schema** (`db_schema`)
- the **database name** (`db_id`)

---

## Supported Tasks and Leaderboards

### Task: Text-to-SQL / NLQ-to-SQL

Given a natural language question written in **Darija (Moroccan Arabic)**, the goal is to generate the correct **SQL query** that retrieves the requested information.

**Example Task:**

| Field | Example |
|-------|----------|
| `darija_question` | شحال من تلميذ عندو أكثر من 15 ف الرياضيات؟ |
| `en_question` | How many students scored more than 15 in mathematics? |
| `sql` | SELECT COUNT(*) FROM Grades WHERE subject = 'Mathematics' AND grade > 15; |
| `db_schema` | CREATE TABLE Grades(student_id number, subject varchar, grade real); |
| `db_id` | School_DB |

---

## Languages

- **Darija (Moroccan Arabic)** — primary source language  
- **English** — provided for reference and cross-lingual studies  

---

## Data Splits

| Split | Size (approx.) | Description |
|-------|----------------|-------------|
| `train` | ~7,000 | Main training set |
| `validation` | ~1,000 | Development split |
| `test` | ~1,000 | Evaluation split |
| `Dialect2SQL` | full dataset | Combined dataset file |

---

## Dataset Structure

Each row in the dataset includes:

| Column | Description |
|---------|--------------|
| `db_id` | Database identifier |
| `db_schema` | SQL table definitions |
| `darija_question` | Question in Moroccan Darija |
| `en_question` | English translation (optional) |
| `sql` | Target SQL query |

---

## Use Cases

- Fine-tuning **text-to-SQL models** for Arabic dialects  
- Research on **multilingual and dialectal NLIDB systems**  
- **Cross-lingual transfer learning** for SQL understanding  
- Evaluating **low-resource adaptation** of code LLMs (e.g., Qwen, StarCoder, Codex)

---

## Limitations

- The dataset currently focuses on **Moroccan Darija**, and performance may not generalize to other Arabic dialects.
- Some questions are written using **Arabic script**, while others mix **Latin characters** (Arabizi), reflecting real user input diversity.
- SQL coverage is limited to **single-domain, schema-bounded** tasks.

---

## Citation

If you use this dataset, please cite the following paper:

```bibtex
@inproceedings{chafik2025dialect2sql,
  title={Dialect2SQL: A Novel Text-to-SQL Dataset for Arabic Dialects with a Focus on Moroccan Darija},
  author={Chafik, Salmane and Ezzini, Saad and Berrada, Ismail},
  booktitle={Proceedings of the 4th Workshop on Arabic Corpus Linguistics (WACL-4)},
  pages={86--92},
  year={2025}
}