Text Detoxification in isiXhosa and Yorùbá: A Cross-Lingual Machine Learning Approach for Low-Resource African Languages

Abayomi O. Agbeyangi · 2026

Read Text Detoxification in isiXhosa and Yorùbá: A Cross-Lingual Machine Learning Approach for Low-Resource African Languages by Abayomi O. Agbeyangi (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-05624.txt.

Introduction

Abayomi O Agbeyangi tackles, in a solo 2026 study, automatic rewriting of toxic text into neutral text in isiXhosa and Yoruba, two low-resource African languages. Toxic language makes online spaces less safe, yet moderation tools barely exist for these languages. His approach pairs transparent checks with controlled rewriting.

A lightweight model using word-frequency aspects and logistic regression flags toxic text in a way readers can follow. A lexicon-guided component then rewrites flagged sentences toward neutral wording. The team built a parallel corpus capturing idioms, diacritics, and code-switching for training and testing. Scores varied by language, while rewriting reportedly cleaned every flagged sentence and left non-toxic sentences untouched, offering a resource-efficient benchmark for African language safety tools. All of this runs on light tools that small teams can afford and can inspect with ease.

Catalog record

CREATORAbayomi O. Agbeyangi
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE47 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2601-05624

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Text Detoxification in isiXhosa and Yorùbá: A Cross-Lingual Machine Learning Approach for Low-Resource African Languages Abayomi O. Agbeyangi Abstract Toxic language is one of the major barrier to safe online participation, yet robust mitigation tools are scarce for African languages. This study addresses this critical gap by investigating automatic text detoxification (toxic to neutral rewriting) for two low-resource African languages, isiXhosa and Yorùbá . The work contributes a novel, pragmatic hybrid methodology: a lightweight, interpretable TF–IDF + Logistic Regression model for transparent toxicity detection, and a controlled lexicon- and token-guided rewriting component. A parallel corpus of toxic to neutral rewrites, which captures idiomatic usage, diacritics, and code-switching, was developed to train and evaluate the model. The detection component achieved stratified K-fold accuracies of 61–72% (isiXhosa) and 72–86% (Yorùbá), with per-language ROC-AUCs up to 0.88. The rewriting component successfully detoxified all detected toxic sentences while preserving 100 % 100\% of non-toxic sentences. These results demonstrate that scalable, interpretable machine learning detectors combined with rule-based edits offer a competitive and resource-efficient solution for culturally adaptive safety tooling, setting a new benchmark for low-resource Text Style Transfer (TST) in African languages. † † tocauthor: Abayomi O. Agbeyangi † † institute: Walter Sisulu University, Buffalo City Campus, East London, South Africa, 1 Introduction As digital platforms increasingly mediate human interaction, the prevalence of toxic language, including insults, threats, and culturally insensitive remarks, presents a growing challenge to safe and inclusive online spaces 9 ; 38 . While considerable progress has been made in detecting and mitigating toxic content using natural language processing (NLP) techniques 35 ; 43 , these advancements have primarily focused on high-resource languages, such as English, leaving a significant gap in tools and resources for African languages. The scarcity of annotated datasets, combined with cultural and linguistic diversity, complicates the effectiveness and applicability of existing models in low-resource contexts. Text detoxification (often referred to as text style transfer (TST)) is a method for transforming toxic or offensive text (example in Figure 1 ) into a more neutral or respectful form while preserving its original meaning and intent 18 ; 19 ; 36 . Most approaches typically involved identifying and removing toxic words based on predefined vocabularies. With recent advances in neural models and large-scale pretraining, the quality of detoxification outputs has significantly improved, enabling more context-aware and semantically correct rewriting 12 ; 17 . Conversely, most of this progress has been concentrated even in high-resource languages. Consequently, low-resource languages, particularly from Africa, remain underserved in this domain. Figure 1: Text detoxification sample. isiXhosa and Yorùbá, spoken widely in South Africa and Nigeria, respectively, are linguistically rich and culturally significant African languages that remain underrepresented in the field of natural language processing (NLP) 32 ; 4 ; 40 . Despite their widespread use, isiXhosa and Yorùbá face persistent challenges, such as the scarcity of annotated datasets, limited integration into mainstream multilingual models, and minimal representation in existing research efforts. Specifically, based on available literature, the task of text detoxification (Text Style Transfer or TST) remains largely unexplored for isiXhosa and Yorùbá. Foundational work, such as AfriHate 34 , has provided crucial datasets for toxicity detection in these languages. Advancements in multilingual NLP, particularly the PAN TextDetox challenge 1 1 1 https://pan.webis.de/clef25/pan25-web/text-detoxification.html , which established parallel detoxification data for Amharic 14 ; 13 , provide promising foundations; no known work has previously addressed end-to-end, meaning-preserving detoxification rewriting for isiXhosa and Yorùbá. Notably, for isiXhosa, cross-lingual transfer techniques 31 and multilingual model adaptation 20 offer a viable strategy for extending the capabilities of detoxification. For Yorùbá, foundational work in machine translation efforts 1 ; 7 ; 3 , text-to-speech synthesis 2 ; 10 ; 25 , text synthesis 8 ; 5 , and corpus development cite Akinwale2015, Agbeyangi2017 lays the foundation for implementing more advanced tasks, such as text detoxification. While foundational work has introduced some datasets for toxicity detection in multiple languages, and dedicated parallel corpora for detoxification are emerging for languages like Amharic, a functional detoxification system for isiXhosa and Yorùbá has been critically missing. This study addresses this gap by presenting the first dedicated end-to-end detoxification approach for both languages. The study presents a novel, pragmatic hybrid methodology that utilises a lightweight, interpretable TF–IDF + Logistic Regression model for transparent toxicity detection, and employs a controlled lexicon- and token-guided rewriting component. This departure from resource-intensive, black-box large language models (LLMs) offers a computationally efficient and culturally adaptive solution that reliably preserves diacritics and idiomatic usage, setting a new benchmark for low-resource NLP safety tooling and motivating future research into controlled, nuance-sensitive cross-lingual text style transfer. 2 Related Work Text detoxification, as a subtask of text style transfer (TST), involves modifying the stylistic properties of a sentence, such as tone, sentiment, or toxicity, while preserving its semantic content 18 ; 36 ; 17 . It focuses explicitly on rewriting offensive or toxic text into a more neutral or non-offensive form 19 . Most of the early research in TST utilised rule-based methods 35 ; 12 ; 16 ; 29 and handcrafted features; however, the field has since advanced with the development of neural models and large-scale pretraining. According to Logacheva et al. 29 , rule-based detoxification methods, such as the Delete model, remove toxic words using a predefined vocabulary, effectively censoring offensive content. These methods produce outputs that are easier to classify for toxicity but may lack nuanced rewriting, as they primarily eliminate toxic tokens rather than paraphrase sentences. Research by Dementieva et al. 16 demonstrated that rule-based methods provide a minimal baseline compared to state-of-the-art approaches. Thus, emphasising the importance of the recent advancement in NLP. State-of-the-art approaches, such as sequence-to-sequence learning 39 , adversarial training 41 , and controlled generation 24 ; 26 , have become common for tasks like politeness transfer, sentiment modification, and reducing toxic content. Floto et al. 19 introduced DiffuDetox, a mixed diffusion model for text detoxification, combining a conditional diffusion model that reduces toxicity in text with an unconditional model that improves fluency. The approach addresses challenges from limited detoxification data by generating a diverse set of detoxified sentences with high fluency and content preservation. The performance of the model on the ParaDetox dataset 2 2 2 https://github.com/s-nlp/paradetox achieved a J score of 0.67 and also shows improvements in BLEU 3 3 3 https://huggingface.co/spaces/evaluate-metric/bleu (62.13 vs 64.53). Similarly, Logacheva et al. 29 employed advanced models, such as ruT5 4 4 4 https://huggingface.co/ai-forever/ruT5-base and RuGPT3-XL 5 5 5 https://huggingface.co/ai-forever/rugpt3xl , alongside baselines that included rule-based methods and fine-tuned large pre-trained language models. The evaluation with human references scored highest manually (joint score Jm = 0.65), closely followed by ruT5-based models (e.g., ruT5-clean Jm = 0.63). Also, Logacheva et al. 30 created parallel datasets (ParaDetox and filtered ParaNMT) for toxic-to-neutral sentence pairs and fine-tuned the BART model, achieving performance superior to existing unsupervised and other baseline methods on both automatic metrics (e.g., BLEU, J) and human evaluations. They all focus on the languages English 19 ; 30 and Russian 29 . Another notable state-of-the-art approach for massively multilingual machine translation was developed by Chan and Li 12 . They introduced “Specialis Revelio”, a text pre-processing module that significantly enhances the detection of disguised toxic content by applying

Read the complete text