Abstract:
Dividing the Qur’an’s chapters into Makki and Madani, according to where their verses were revealed, is a foundational step in Qur’anic scholarship and increasingly a task for computational text analysis. Prior automated work treats this problem with classical machine learning term frequency inverse document frequency (TF-IDF) features fed to support vector machines, decision trees, random forests, or voting ensembles and reports accuracy on a corpus in which roughly three of every four verses are Makki. On such an imbalanced corpus, accuracy is a weak signal: a classifier that always answers “Makki” already reaches about 74% accuracy while its macro-averaged F1 sits near 0.43. We present, to our knowledge, the first application of a fine-tuned Arabic transformer to Makki/Madani verse classification. Our model fine-tunes AraBERTv2 and augments its [CLS] representation, the special classification token whose final hidden state summarises the whole verse, with two normalized structural features (verse length in words and sub-word token count) via a small fusion head. It is trained with a class-weighted loss to counter the 2.84:1 imbalance. Every verse of the 6,236-verse corpus is labeled from the standard mushaf classification of its surah (86 Makki, 28 Madani), and models are evaluated under surah-grouped five-fold cross-validation so that no verse from a given surah appears in both training and test folds. Under pooled out-of-fold evaluation, the proposed model reaches a macro-F1 of 0.927 and accuracy of 0.944 (per-fold mean 0.929 ± 0.014), improving on a length-only structural baseline (macro-F1 0.690), the classical RF+DT+KNN ensemble (0.760), and a fine-tuned MARBERT baseline (0.916). At the verse level, the proposed model significantly outperforms both the classical ensemble (McNemar χ2 = 712.2, p < 0.001) and MARBERT (χ2 = 16.9, p < 0.001); at the surah level, the two transformer models are comparable, as indicated by a non-significant McNemar test at the surah level. We report per-class scores and a pooled confusion matrix over all 6,236 verses, and we discuss the disputed and mixed surahs on which a subset of the Residual errors falls.