Submitted:
23 March 2025
Posted:
24 March 2025
You are already at the latest version
Abstract

Keywords:
1. Introduction
- Tafilah: Each distinct foot.
- Bayt: A poem with single line including a pair of half verses.
- Sadr: The initial segment of the half-verse.
- Ajuz: The subsequent segment of the half-verse.
- Arud: The last segment of Sadr.
- Darb: The last segment of Ajuz.
- The study compares and evaluates the performance of different pretrained transformer models such as Arabic-BERT, AraBERT, MARBERT, AraELECTRA, CAMeLBERT, and ARBERT with BiLSTM, and BiGRU DL models.
- The study evaluates the half-verse poem and tunes the model with different hidden layers for the DL models and batch sizes for the transformer models.
- Different encoding methods were employed in this study such as pretrained tokenizer (WordPiece, and SentencePiece) for transformer models and character-level encoding for DL models.
- Using LIME, the study investigates model behavior and feature significance to clarify the model's decision-making procedures.
- This study opens the path for future developments and helps the expanding area of Arabic NLP by assessing the interpretability and applicability methods for poetry categorization.
2. Literature Review
3. Materials and Methods
3.1. Dataset
3.2. Data Preprocessing
3.2.1. Tokenization
3.2.2. Character-Encoding
3.3. Model Architectures
3.3.1. Transformer Models
3.3.2. Deep Learning Models
3.4. Model Evaluation and Parameter Tuning
- Windows 10 operating system
- 16 GB RAM
- Inter core i7 processor
- GPUS - Nvidia GeForce GTX 1080 Ti
- Deep learning libraires - TensorFlow 2.7, Transformers 4.48.1
- Other evaluation libraries - Scikit-learn 1.0, PyArabic 0.6.14, lime 0.2.0.1
3.5. Performance Evaluation
3.6. Explainability with LIME
4. Results
4.1. Deep Learning Models
4.2. Transformer Models
5. Discussion
5.1. Practical Implications
5.2. Limitation and Future Works
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Yi, X.; Sun, M.; Li, R.; Li, W. Automatic poetry generation with mutual reinforcement learning. Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing 2018, 3143–3153. [Google Scholar] [CrossRef]
- Badawī, M.M. A critical introduction to modern Arabic poetry; Cambridge University Press: 1975.
- Scott, H. Pegs, cords, and ghuls: Meter of classical Arabic poetry. 2010.
- Abandah, G.A.; Suyyagh, A.E.; Abdel-Majeed, M.R. Transfer learning and multi-phase training for accurate diacritization of Arabic poetry. Journal of King Saud University-Computer and Information Sciences 2022, 34, 3744–3757. [Google Scholar] [CrossRef]
- Alkiyumi, M. The creative linguistic achievements of Alkhalil bin Ahmed Al-Farahidi, and motives behind his creations: A case study. Cogent Arts & Humanities 2023, 10, 2196842. [Google Scholar] [CrossRef]
- Mohamed, M.; Al-Azani, S. Enhancing Arabic NLP Tasks through Character-Level Models and Data Augmentation. In Proceedings of the Proceedings of the 31st International Conference on Computational Linguistics, 2025; pp. 2744-2757.
- Kumar, S.; Sharma, S.; Megra, K.T. Transformer enabled multi-modal medical diagnosis for tuberculosis classification. Journal of Big Data 2025, 12, 5. [Google Scholar] [CrossRef]
- Kihal, M.; Hamza, L. Efficient arabic and english social spam detection using a transformer and 2D convolutional neural network-based deep learning filter. International Journal of Information Security 2025, 24, 56. [Google Scholar] [CrossRef]
- Azzeh, M.; Qusef, A.; Alabboushi, O. Arabic Fake News Detection in Social Media Context Using Word Embeddings and Pre-trained Transformers. Arabian Journal for Science and Engineering 2025, 50, 923–936. [Google Scholar] [CrossRef]
- Vaswani, A.; Shazeer, N.M.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention is All you Need. In Proceedings of the Neural Information Processing Systems; 2017. [Google Scholar]
- Rabie, E.M.; Hashem, A.F.; Alsheref, F.K. Recognition model for major depressive disorder in Arabic user-generated content. Beni-Suef University Journal of Basic and Applied Sciences 2025, 14, 7. [Google Scholar] [CrossRef]
- Valcamonico, D.; Baraldi, P.; Macêdo, J.B.; Moura, M.D.C.; Brown, J.; Gauthier, S.; Zio, E. A systematic procedure for the analysis of maintenance reports based on a taxonomy and BERT attention mechanism. Reliability Engineering & System Safety 2025, 257, 110834. [Google Scholar] [CrossRef]
- Al-shaibani, M.S.; Alyafeai, Z.; Ahmad, I. MetRec: A dataset for meter classification of arabic poetry. Data in Brief 2020, 33, 106497. [Google Scholar] [CrossRef]
- Talghalit, I.; Alami, H.; Ouatik El Alaoui, S. Contextual Semantic Embeddings Based on Transformer Models for Arabic Biomedical Questions Classification. HighTech and Innovation Journal 2024, 5, 1024–1037. [Google Scholar] [CrossRef]
- Alosaimi, W.; Saleh, H.; Hamzah, A.A.; El-Rashidy, N.; Alharb, A.; Elaraby, A.; Mostafa, S. ArabBert-LSTM: improving Arabic sentiment analysis based on transformer model and Long Short-Term Memory. Frontiers in Artificial Intelligence 2024, 7. [Google Scholar] [CrossRef] [PubMed]
- AL-ONAZI, B.B.; ELTAHIR, M.M.; ALZAIDI, M.S.A.; EBAD, S.A.; ALOTAIBI, S.D.; SAYED, A. AUTOMATING METER CLASSIFICATION OF ARABIC POEMS: A HARRIS HAWKS OPTIMIZATION WITH DEEP LEARNING PERSPECTIVE. Fractals 2025, 0, 2540008. [Google Scholar] [CrossRef]
- Karfi, I.E.; Fkihi, S.E. A combined Bi-LSTM-GPT Model for Arabic Sentiment Analysis. International Journal of Intelligent Systems and Applications in Engineering 2023, 11, 77–84. [Google Scholar]
- Xu, G.; Meng, Y.; Qiu, X.; Yu, Z.; Wu, X. Sentiment analysis of comment texts based on BiLSTM. Ieee Access 2019, 7, 51522–51532. [Google Scholar] [CrossRef]
- Zhou, H. Research of Text Classification Based on TF-IDF and CNN-LSTM. Journal of Physics: Conference Series 2022, 2171, 012021. [Google Scholar] [CrossRef]
- Refai, D.; Abu-Soud, S.; Abdel-Rahman, M.J. Data Augmentation Using Transformers and Similarity Measures for Improving Arabic Text Classification. IEEE Access 2022, 11, 132516–132531. [Google Scholar] [CrossRef]
- Al Deen, M.M.S.; Pielka, M.; Hees, J.; Abdou, B.S.; Sifa, R. Improving Natural Language Inference in Arabic Using Transformer Models and Linguistically Informed Pre-Training. 2023 IEEE Symposium Series on Computational Intelligence (SSCI), 05-08 December 2023, Mexico City, Mexico 2024, 318-322. [CrossRef]
- Qarah, F. AraPoemBERT: A Pretrained Language Model for Arabic Poetry Analysis. arXiv, 2024; arXiv:abs/2403.12392. [Google Scholar] [CrossRef]
- Hossain, M.M.; Hossain, M.S.; Safran, M.; Alfarhood, S.; Alfarhood, M.; Mridha, M.F. A Hybrid Attention-Based Transformer Model for Arabic News Classification Using Text Embedding and Deep Learning. IEEE Access 2024, 12, 198046–198066. [Google Scholar] [CrossRef]
- Alshammari, H.; El-Sayed, A.; Elleithy, K. AI-Generated Text Detector for Arabic Language Using Encoder-Based Transformer Architecture. Big Data and Cognitive Computing 2024, 8, 32. [Google Scholar] [CrossRef]
- Antoun, W.; Baly, F.; Hajj, H. AraELECTRA: Pre-training text discriminators for Arabic language understanding. In Proceedings of the Proceedings of the Sixth Arabic Natural Language Processing Workshop, Kyiv, Ukraine (Virtual), 2020; pp. 191–195.
- Inoue, G.; Alhafni, B.; Baimukan, N.; Bouamor, H.; Habash, N. The Interplay of Variant, Size, and Task Type in Arabic Pre-trained Language Models. In Proceedings of the Proceedings of the Sixth Arabic Natural Language Processing Workshop, Kyiv, Ukraine (Virtual), 2021; pp. 92–104.
- Alruily, M.; Manaf Fazal, A.; Mostafa, A.M.; Ezz, M. Automated Arabic Long-Tweet Classification Using Transfer Learning with BERT. Applied Sciences 2023, 13, 3482. [Google Scholar] [CrossRef]
- Alammary, A.S. BERT Models for Arabic Text Classification: A Systematic Review. Applied Sciences 2022, 12, 5720. [Google Scholar] [CrossRef]
- Alammary, A.S. Investigating the impact of pretraining corpora on the performance of Arabic BERT models. The Journal of Supercomputing 2024, 81, 187. [Google Scholar] [CrossRef]
- Al-shaibani, M.S.; Alyafeai, Z.; Ahmad, I. Meter classification of Arabic poems using deep bidirectional recurrent neural networks. Pattern Recognition Letters 2020, 136, 1–7. [Google Scholar] [CrossRef]
- Choo, S.; Kim, W. A study on the evaluation of tokenizer performance in natural language processing. Applied Artificial Intelligence 2023, 37. [Google Scholar] [CrossRef]
- Ersoy, A.; Yıldız, O.T.; Özer, S. ORTPiece: An ORT-Based Turkish Image Captioning Network Based on Transformers and WordPiece. 2023 31st Signal Processing and Communications Applications Conference (SIU) 2023, 1–4. [Google Scholar] [CrossRef]
- 최용석; 이공주. Performance Analysis of Korean Morphological Analyzer based on Transformer and BERT. Journal of KIISE 2020, 47, 730–741. [Google Scholar] [CrossRef]
- Antoun, W.; Baly, F.; Hajj, H. AraBERT: Transformer-based model for arabic language understanding. In Proceedings of the In Proceedings of the 4th Workshop on Open-Source Arabic Corpora and Processing Tools, with a Shared Task on Offensive Language Detection, Marseille, France, 2020; pp. 9–15.
- Hussein, H.H.; Lakizadeh, A. A systematic assessment of sentiment analysis models on iraqi dialect-based texts. Systems and Soft Computing 2025, 7, 200203. [Google Scholar] [CrossRef]
- Abdul-Mageed, M.; Elmadany, A.; Nagoudi, E.M.B. ARBERT & MARBERT: Deep Bidirectional Transformers for Arabi. In Proceedings of the Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), 2021; pp. 7088–7105.
- Safaya, A.; Abdullatif, M.; Yuret, D. KUISAIL at SemEval-2020 Task 12: BERT-CNN for Offensive Speech Identification in Social Media. In Proceedings of the Proceedings of the Fourteenth Workshop on Semantic Evaluation, Barcelona (online), December, 2020; pp. 2054–2059.
- Sun, Z.; Zhang, Z.; Zhang, M. Bilstm Personalised-Style Poetry Generation Algorithm. 2023 IEEE 3rd International Conference on Power, Electronics and Computer Applications (ICPECA) 2023, 836-840. [CrossRef]
- Atassi, A.; El Azami, I. COMPARISON AND GENERATION OF A POEM IN ARABIC LANGUAGE USING THE LSTM, BILSTM AND GRU. Journal of Management Information & Decision Sciences 2022, 25. [Google Scholar]
- Kingma, D.P.; Ba, J. Adam: A method for stochastic optimization. arXiv, 2014; arXiv:1412.6980 2014. [Google Scholar]
- Garreau, D.; Luxburg, U. Explaining the explainer: A first theoretical analysis of LIME. In Proceedings of the International conference on artificial intelligence and statistics; 2020; pp. 1287–1296. [Google Scholar]
- Verma, B.; Thomas, A.; Verma, R.K. Innovative abstractive Hindi text summarization model incorporating Bi-LSTM classifier, optimizer and generative AI. Intelligent Decision Technologies 2025, 0, 1–9. [Google Scholar]
- Al-shathry, N.; Al-onazi, B.; Hassan, A.Q.A.; Alotaibi, S.; Alotaibi, S.; Alotaibi, F.; Elbes, M.; Alnfiai, M. Leveraging Hybrid Adaptive Sine Cosine Algorithm with Deep Learning for Arabic Poem Meter Detection. ACM Trans. Asian Low-Resour. Lang. Inf. Process. 2024. [Google Scholar] [CrossRef]
- Kharsa, R.; Elnagar, A.; Yagi, S. BERT-Based Arabic Diacritization: A state-of-the-art approach for improving text accuracy and pronunciation. Expert Systems with Applications 2024, 248, 123416. [Google Scholar] [CrossRef]













| Model | Tokenizer |
|---|---|
| AraBERT | SentencePiece |
| AraELECTRA | WordPiece |
| ARBERT | WordPiece |
| MARBERT | WordPiece |
| Arabic-BERT | SentencePiece |
| CAMeLBERT | WordPiece |
| Model | Parameter | Values | Tuning |
|---|---|---|---|
| Transformer model | Batch size | [32, 64, 128] | Yes |
| Epoch | 50 | No | |
| Learning rate | 5e-5 | No | |
| Bidirectional model | Batch size | 128 | No |
| Layers | [1, 2, 3, 4, 5, 6, 7] | Yes | |
| Epoch | 50 | No | |
| Learning rate | 1e-3 | No |
| Model | Hidden layers | Training Time (in seconds) | Validation Accuracy (%) | Testing Time (in seconds) | EarlyStopping epochs | Testing Accuracy (%) | Recall | Precision | F1-score |
|---|---|---|---|---|---|---|---|---|---|
| BiGRU | 1 | 184.51 | 86.34 | 10.09 | 14 | 86.42 | 0.86 | 0.86 | 0.86 |
| 2 | 439.77 | 89.16 | 16.57 | 18 | 88.88 | 0.89 | 0.89 | 0.89 | |
| 3 | 636.27 | 90.07 | 26.29 | 18 | 90.06 | 0.90 | 0.90 | 0.90 | |
| 4 | 1236.31 | 90.21 | 31.20 | 27 | 90.34 | 0.90 | 0.90 | 0.90 | |
| 5 | 1090.65 | 90.44 | 36.79 | 18 | 90.39 | 0.90 | 0.90 | 0.90 | |
| 6 | 2295.92 | 90.25 | 47.03 | 34 | 90.04 | 0.90 | 0.90 | 0.90 | |
| 7 | 3135.84 | 90.53 | 56.34 | 39 | 90.09 | 0.90 | 0.90 | 0.90 | |
| BiLSTM | 1 | 200.68 | 86.09 | 8.59 | 14 | 85.83 | 0.86 | 0.86 | 0.86 |
| 2 | 390.16 | 88.88 | 15.88 | 14 | 88.68 | 0.89 | 0.89 | 0.89 | |
| 3 | 712.73 | 88.79 | 23.63 | 17 | 89.13 | 0.89 | 0.89 | 0.89 | |
| 4 | 907.06 | 89.84 | 32.77 | 16 | 89.66 | 0.90 | 0.90 | 0.90 | |
| 5 | 1144.01 | 90.20 | 38.75 | 16 | 90.05 | 0.90 | 0.90 | 0.90 | |
| 6 | 1632.94 | 90.37 | 47.11 | 18 | 90.53 | 0.90 | 0.91 | 0.91 | |
| 7 | 2022.12 | 90.56 | 54.70 | 20 | 90.33 | 0.90 | 0.90 | 0.90 |
| Meters | Encoded meters | Precision | Recall | F1-score |
|---|---|---|---|---|
| saree | 0 | 0.82 | 0.82 | 0.82 |
| kamel | 1 | 0.88 | 0.88 | 0.88 |
| mutakareb | 2 | 0.92 | 0.93 | 0.93 |
| mutadarak | 3 | 0.90 | 0.88 | 0.89 |
| munsareh | 4 | 0.92 | 0.93 | 0.93 |
| madeed | 5 | 0.80 | 0.85 | 0.82 |
| mujtath | 6 | 0.94 | 0.96 | 0.95 |
| ramal | 7 | 0.93 | 0.93 | 0.93 |
| baseet | 8 | 0.96 | 0.96 | 0.96 |
| khafeef | 9 | 0.93 | 0.93 | 0.93 |
| taweel | 10 | 0.95 | 0.96 | 0.96 |
| wafer | 11 | 0.94 | 0.94 | 0.94 |
| hazaj | 12 | 0.91 | 0.90 | 0.91 |
| rajaz | 13 | 0.80 | 0.77 | 0.79 |
| Model | Batch size | Training Time (in seconds) | Validation Accuracy (%) | Testing Time (in seconds) | EarlyStopping epochs | Testing Accuracy (%) | Recall | Precision | F1-score |
|---|---|---|---|---|---|---|---|---|---|
| AraBERT | 32 | 2561.87 | 84.36 | 66.83 | 10 | 85.24 | 0.85 | 0.85 | 0.85 |
| 64 | 2017.41 | 79.91 | 60.01 | 10 | 79.95 | 0.80 | 0.79 | 0.79 | |
| 128 | 1505.03 | 78.76 | 61.73 | 10 | 78.85 | 0.78 | 0.78 | 0.78 | |
| Arabic-BERT | 32 | 2167.33 | 81.44 | 81.31 | 9 | 62.71 | 0.81 | 0.81 | 0.81 |
| 64 | 1566.64 | 78.93 | 62.03 | 8 | 79.04 | 0.79 | 0.79 | 0.79 | |
| 128 | 1148.03 | 76.08 | 57.26 | 8 | 75.92 | 0.76 | 0.76 | 0.76 | |
| AraELECTRA | 32 | 2204.53 | 87.59 | 60.23 | 14 | 87.14 | 0.87 | 0.87 | 0.87 |
| 64 | 1901.09 | 83.46 | 56.83 | 10 | 83.72 | 0.83 | 0.83 | 0.83 | |
| 128 | 1623.86 | 79.63 | 55.83 | 12 | 79.60 | 0.79 | 0.79 | 0.79 | |
| ARBERT | 32 | 2299.88 | 72.92 | 58.11 | 9 | 73.21 | 0.73 | 0.74 | 0.73 |
| 64 | 1546.04 | 78.01 | 57.02 | 8 | 78.37 | 0.78 | 0.79 | 0.78 | |
| 128 | 1094.12 | 77.57 | 53.76 | 8 | 77.23 | 0.77 | 0.77 | 0.77 | |
| CAMeLBERT | 32 | 2431.07 | 90.59 | 35.18 | 12 | 90.26 | 0.90 | 0.90 | 0.90 |
| 64 | 1769.59 | 90.49 | 54.08 | 12 | 90.62 | 0.91 | 0.91 | 0.91 | |
| 128 | 1232.03 | 90.57 | 52.28 | 12 | 90.21 | 0.90 | 0.90 | 0.90 | |
| MARBERT | 32 | 1875.58 | 83.95 | 59.64 | 7 | 83.43 | 0.83 | 0.83 | 0.83 |
| 64 | 1348.81 | 82.79 | 57.97 | 7 | 82.69 | 0.82 | 0.83 | 0.82 | |
| 128 | 929.73 | 83.07 | 62.54 | 7 | 83.35 | 0.83 | 0.83 | 0.83 |
| Meters | Encoded meters | Precision | Recall | F1-score |
|---|---|---|---|---|
| saree | 0 | 0.84 | 0.84 | 0.84 |
| kamel | 1 | 0.89 | 0.88 | 0.89 |
| mutakareb | 2 | 0.93 | 0.93 | 0.93 |
| mutadarak | 3 | 0.90 | 0.86 | 0.88 |
| munsareh | 4 | 0.91 | 0.92 | 0.91 |
| madeed | 5 | 0.83 | 0.83 | 0.83 |
| mujtath | 6 | 0.93 | 0.96 | 0.94 |
| ramal | 7 | 0.91 | 0.92 | 0.92 |
| baseet | 8 | 0.97 | 0.96 | 0.96 |
| khafeef | 9 | 0.93 | 0.92 | 0.93 |
| taweel | 10 | 0.96 | 0.97 | 0.96 |
| wafer | 11 | 0.93 | 0.95 | 0.94 |
| hazaj | 12 | 0.91 | 0.92 | 0.91 |
| rajaz | 13 | 0.80 | 0.79 | 0.80 |
| Tokenizer | Layers | F1-score | Accuracy (%) | Recall | Precision |
|---|---|---|---|---|---|
| AraBERT | 1 | 0.45 | 45.66 | 0.45 | 0.45 |
| 5 | 0.52 | 52.28 | 0.52 | 0.53 | |
| CAMeLBERT | 1 | 0.40 | 40.98 | 0.40 | 0.41 |
| 5 | 0.40 | 40.24 | 0.39 | 0.41 |
| Reference, year | Model | Verse length | Accuracy (%) | F1-score |
|---|---|---|---|---|
| [30], 2020 | BiGRU 5 layers | 110,880 | 88.80 | - |
| The proposed study | BiLSTM 6 layers | 110,880 | 90.53 | 0.91 |
| CAMeLBERT | 90.62 | 0.91 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).