Sentiment classification in the Yoruba language using multilingual Bidirectional Encoder Representations from Transformers (mBERT)
摘要
The study presents a transformer-based approach for sentiment classification in the Yoruba language using the multilingual Bidirectional Encoder Representations from Transformers (mBERT) model. Yoruba, a tonal and morphologically rich language, presents unique challenges for computational modeling due to its diacritical orthography and limited digital resources. A manually annotated corpus of 2,000 Yoruba movie reviews was developed, containing balanced positive and negative sentiments. Preprocessing involved Unicode normalization to preserve tonal diacritics and maintain orthographic integrity, avoiding unidecode stripping. The mBERT model, fine-tuned using the Hugging Face Transformers and PyTorch framework, was evaluated against traditional machine learning and deep learning baselines including Naïve Bayes, Support Vector Machine, Long Short-Term Memory (LSTM), and Recurrent Neural Network (RNN). Experimental results revealed that the diacritic-preserving mBERT model achieved 89.4% accuracy, outperforming all baseline models. The inclusion of Unicode normalization improved classification accuracy by 4.5% compared with the diacritic-stripped variant. Macro-averaged metrics confirmed balanced model performance across sentiment classes, while grouped movie-based splitting validated robustness by eliminating data leakage. The findings demonstrate that transformer-based multilingual models can effectively capture contextual and tonal nuances in low-resource African languages. The study highlights the importance of diacritic-sensitive preprocessing and transfer learning in advancing natural language understanding for Yoruba and other underrepresented African languages.