Local Gradio demo for Amharic and Afaan Oromo news topic classification. It auto-detects language from script, normalises text, and applies a TF-IDF + logistic regression model to predict the news topic from short sentences.
# Amharic / Afaan Oromo News Topic Classifier
Type a sentence in Amharic or Afaan Oromo and get its news topic. The language
is detected from the script and routed to the matching model, so there is
nothing to select.
TF-IDF over character n-grams plus logistic regression, trained on
MasakhaNEWS. No
transformers, no GPU — the whole thing trains in about ten minutes on a laptop.
**Macro-F1 of 0.92 on Amharic and 0.86 on Afaan Oromo**, both on held-out test
splits, where always guessing the most common topic would score 0.27 and 0.31
accuracy respectively.
---
## Why these languages
Amharic and Afaan Oromo each have tens of millions of speakers and almost no
public NLP tooling. Afaan Oromo in particular is badly served: the obvious
sentiment corpus for African languages, AfriSenti, ships an Afaan Oromo
training split containing zero rows — 396 validation and 2,096 test examples
and nothing whatsoever to fit on.
MasakhaNEWS was chosen precisely because it gives both languages a real
training split and lets Afaan Oromo be a first-class half of the project rather
than an afterthought.
## Results
Both models were selected on validation and scored once on test.
**Amharic** — 4 topics, 373 test documents
| Topic | F1 (full article) | F1 (headline only) | Test support |
| --- | --- | --- | --- |
| sports | 0.962 | 0.968 | 95 |
| politics | 0.926 | 0.902 | 100 |
| business | 0.902 | 0.823 | 81 |
| health | 0.897 | 0.851 | 97 |
| **macro average** | **0.922** | **0.886** | 373 |
**Afaan Oromo** — 5 topics, 325 test documents
| Topic | F1 (full article) | F1 (headline only) | Test support |
| --- | --- | --- | --- |
| sports | 0.982 | 0.929 | 81 |
| health | 0.912 | 0.910 | 97 |
| politics | 0.902 | 0.893 | 100 |
| technology | 0.857 | 0.815 | 15 |
| entertainment | 0.645 | 0.656 | 32 |
| **macro average** | **0.860** | **0.841** | 325 |
The "headline only" column matters more than it looks. Training articles run to
a median of 324 words in Amharic and 341 in Afa …