Hate speech and content safety
Worked example. Last reviewed: 2026-07-07.
This page applies the four steps from Before You Start to hate speech and abusive language detection. It uses AfriHate as the example because it is the largest community-built hate speech collection for African languages, with native-speaker annotators and a published paper. Many smaller, single-language datasets exist, and new ones appear often. If your language is not mentioned here, go back to Step 1 and search.
This task is different from the others in this chapter in three ways. Annotators read harmful content for hours, so they need support from the first day. A classifier used for automated moderation can cause the same harm it is meant to reduce. And what counts as hate is contested, culturally and politically.
Step 1: What a search turns up
Search Hugging Face, Lanfrica, or the ACL Anthology for hate speech in a major African language and you will find many small datasets, each with its own labels and guidelines. The one that brings most of them together is:
- AfriHate (Muhammad et al., 2025): tweets in 15 languages. Algerian Arabic, Amharic, Hausa, Igbo, Kinyarwanda, Moroccan Arabic, Nigerian Pidgin, Oromo, Somali, Swahili, Tigrinya, Twi, isiXhosa, Yoruba, and isiZulu. Each tweet is labelled hate, abusive, or normal, and hateful tweets also carry a target (ethnicity, politics, gender, disability, religion, or other).
The data is on the Hugging Face Hub. The GitHub repository lists the language coordinators, who are good people to contact.
You will also find datasets for nearby tasks that look useful: emotion data such as BRIGHTER (28 languages, with labels that include anger and disgust), or polarization data such as POLAR (22 languages, including Amharic, Hausa, and Swahili).
Step 2: Judging AfriHate against the checklist
- Licence. The Hugging Face card lists Apache 2.0, which allows commercial use. The text is tweets, so also check whether the platform's terms affect what you plan to do.
- Access. Gated. You must log in to Hugging Face and agree to share your contact details before you can download it.
- Fit. Twitter/X posts from 2012 to 2023. Comments on other platforms, radio call-ins, WhatsApp messages, or forums look different. Hate speech also changes fast: new slurs, codewords, and spellings appear all the time, so older data misses them.
- Script. Mostly Latin script. Amharic and Tigrinya are in Ethiopic script, Algerian Arabic is in Arabic script, and Moroccan Arabic appears in both Arabic and Latin script.
- Code-switching. African-language hate speech often mixes in English, French, or Arabic, and the offensive part is often exactly where the switch happens. Check how much of your target text mixes languages, and include such text in your evaluation.
- Labels. Hate, abusive, and normal, plus a target for hateful tweets. What counts as hate is specific to a culture, a region, and a time: a word that is neutral in one place can carry a history of violence in another. Read the paper's definitions before assuming they match yours. Do not import a label scheme from an English corpus without consulting the affected communities.
- Splits. Fixed splits. Each test set has at least 100 examples of each class, so the rare hate class can be measured. Real content is mostly not hate, so also report results per class with the number of examples, not just one overall score.
- Guidelines. The paper describes the definitions, the keyword lists, and the annotation process. Check what has been released before planning to reuse them, and ask the authors if you cannot find the full guidelines.
- Quality. Annotated by native speakers from the local communities, with three or four annotators per tweet. Agreement is reported per language and ranges from 0.46 to 0.81 (Randolph's kappa), so quality varies by language. Look at the number for yours. The individual annotations are released, which helps if you want to study disagreement.
- Documentation. The paper has limitations and ethics sections. Tweets were found with keyword lists, so the data has selection bias: it only contains hate that matches the words the team searched for. The Twitter/X academic API used to collect it is no longer free, so extending the data the same way is harder today.
Step 3: Reuse, extend, or build
Find the row that matches your situation, then follow it across. The first question is whether your language is covered by AfriHate.
| What you found | Your choice | What to do |
|---|---|---|
| Your language is covered by AfriHate, and its labels (hate, abusive, normal, plus target) and domain (Twitter/X) fit your task | Reuse AfriHate | Do not build a new corpus for these labels. Spend your effort on a small evaluation set from the platform you actually care about. |
| Your language is covered, but you need other labels or another platform | Extend it | For example, split incitement from slurs, or add calls to violence. Read the AfriHate paper first, extend its definitions rather than replace them, and involve the affected communities in label design, not just annotation. Do not re-annotate hate, abusive, and normal; merge. |
| Your language is not covered, but it is related to one of the 15 | Borrow, then build small | Try cross-language transfer from the closest covered language, but treat it as a pilot only. What counts as hate does not transfer well between cultures. Build a target-language evaluation set of 500–2,000 examples before trusting any result. |
| Your language is not covered and not related to any of the 15 | Build from scratch | Start with the long-tail language onboarding chapter, then Data Collection, Annotation Design, and Data Quality. Involve the affected communities in label design from the start, and aim for 5,000–10,000 examples. Do not start without counselling support in place for annotators. |
Step 4: Learning from the people who built it
AfriHate was built by language teams across Africa, each with a coordinator, working under a shared set of labels. Its hardest problems were finding hateful posts in languages the Twitter API did not support, and handling honest disagreement about what counts as hate.
Read first:
- The AfriHate paper (Muhammad et al., 2025): the 15-language dataset, especially the data collection, limitations, and ethics sections.
- The participatory research paper (Nekoto et al., 2020): how to involve communities in dataset work. This matters more for label design here than for most tasks.
Questions to ask the authors:
- How did you build the keyword lists, and what hate did they miss?
- Where did annotators disagree most, and did disagreement follow region, age, or politics?
- What support did annotators need, and what would you add next time?
Further reading
- Challenges and frontiers in abusive content detection (Vidgen et al., 2019): a survey of the method problems in this field. Read it before writing guidelines.
- The risk of racial bias in hate speech detection (Sap et al., 2019): how annotator background creates biased labels.
Once you have your data, training a model is well covered elsewhere. The Hugging Face sequence classification tutorial is a good start.



