Table of Contents
Fetching ...

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

Abayomi O. Agbeyangi

TL;DR

This paper tackles text detoxification for isiXhosa and Yorùbá, two low-resource African languages, where toxic online content hampers safe participation and resources are scarce. It introduces a pragmatic hybrid pipeline combining TF-IDF + Logistic Regression for toxicity detection with lexicon- and token-guided rewriting, trained on a parallel toxic–detoxified sentence corpus. The method achieves detection accuracies of $61$–$72\%$ (isiXhosa) and $72$–$86\%$ (Yorùbá) with ROC-AUC up to $0.88$, and detoxifies all toxic sentences while preserving non-toxic ones, using language-specific thresholds ($0.45$ for isiXhosa and $0.50$ for Yorùbá). The work demonstrates the value of interpretable, resource-efficient tooling for low-resource NLP safety, provides a dataset and framework that can be extended with multilingual models and larger corpora, and sets a benchmark for low-resource Text Style Transfer in African languages.

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 and 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% 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.

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

TL;DR

This paper tackles text detoxification for isiXhosa and Yorùbá, two low-resource African languages, where toxic online content hampers safe participation and resources are scarce. It introduces a pragmatic hybrid pipeline combining TF-IDF + Logistic Regression for toxicity detection with lexicon- and token-guided rewriting, trained on a parallel toxic–detoxified sentence corpus. The method achieves detection accuracies of (isiXhosa) and (Yorùbá) with ROC-AUC up to , and detoxifies all toxic sentences while preserving non-toxic ones, using language-specific thresholds ( for isiXhosa and for Yorùbá). The work demonstrates the value of interpretable, resource-efficient tooling for low-resource NLP safety, provides a dataset and framework that can be extended with multilingual models and larger corpora, and sets a benchmark for low-resource Text Style Transfer in African languages.

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 and 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% 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.
Paper Structure (17 sections, 5 equations, 9 figures, 3 tables, 1 algorithm)

This paper contains 17 sections, 5 equations, 9 figures, 3 tables, 1 algorithm.

Figures (9)

  • Figure 1: Text detoxification sample.
  • Figure 2: Overview of the text detoxification task, including detection and meaning-preserving rewriting phases.
  • Figure 3: Stratified K-fold confusion matrices for isiXhosa across 5 folds.
  • Figure 4: Stratified K-fold confusion matrices for Yorùbá across 5 folds.
  • Figure 5: ROC curves across folds for isiXhosa.
  • ...and 4 more figures