Bridging the NLP Gap: A Transformer-Based Sentiment Analysis Framework for Code-Mixed Nigerian Pidgin
Abstract
This study addresses the limitations of existing Natural Language Processing (NLP) systems in analyzing Nigerian Pidgin, a widely spoken but low-resource language. Traditional sentiment analysis models, primarily designed for English, perform poorly due to challenges such as non-standardized spelling, semantic drift, and code-mixing. These limitations hinder accurate interpretation of public opinion expressed in Nigerian Pidgin. This project therefore aims to develop an effective sentiment analysis system capable of classifying Pidgin text into positive, negative, and neutral categories. A transformer-based approach was adopted using pretrained multilingual models, specifically AfriBERTa and XLM-R. The system was trained on the Nigerian Pidgin subset of the AfriSenti dataset (approximately 14,000 labeled tweets). A preprocessing pipeline involving data cleaning, normalization of spelling variations, and SentencePiece tokenization was implemented to improve model performance. The models were fine-tuned using supervised learning and evaluated using accuracy, precision, recall, and weighted F1-score. The model achieved a peak accuracy of 70.25%, with a precision of 0.6805, recall of 0.7025, and an F1-score of 0.6819. Comparative evaluation showed AfroXLM-R performed slightly better with 71.10% accuracy, emphasizing the advantage of African language-specific pretraining. These results demonstrate that transformer models can effectively capture sentiment in Nigerian Pidgin despite its linguistic complexity. In conclusion, the study confirms the viability of transformer-based NLP for low-resource languages. While challenges such as sarcasm, code-mixing, and limited datasets remain, the system provides a strong foundation for real-world applications and future improvements in indigenous language processing.