Python toolkit for preprocessing Swahili, English and Sheng narratives for NLP applications.
Classifying Women's Economic Narratives: A Small-Scale, Explainable NLP Prototype
Submitted by: Samson Odhiambo
For: FemDigiNomics — NLP and AI Intern application
Files in this sample: `annotated_narratives.csv` (data), `classify_narratives.py` (code), `run_output.txt` (a real run of the pipeline against this data), this document (methodology and discussion)
---
## 1. Objective
FemDigiNomics needs language tools that reflect how women *actually* describe their economic realities — not how a standard, English-first NLP toolkit assumes they will. This sample builds a small, end-to-end prototype of the kind of workflow described in the internship's responsibilities: collecting and annotating code-mixed Swahili/English/Sheng narratives, defining category taxonomy around lived financial experience (savings, debt, chama obligations,
business risk, care work, health shocks, lending readiness), and testing a first-pass classifier — while being explicit about what a 25-narrative prototype can and cannot tell us.
## 2. The data and annotation approach
`annotated_narratives.csv` contains 25 short, first-person narratives written in the register women commonly use in these conversations: Swahili with embedded English financial terms, Sheng-adjacent phrasing, and code-switching mid-sentence. Each narrative carries:
- `categories` — one or more of the seven taxonomy labels, or `none` for narratives that are financially stable and shouldn't be forced into a risk category (N022 exists specifically to guard against this failure mode).
- `annotator_notes` — a short justification for the label choice. This is the single most important column in the file. In real annotation work, disagreements between annotators almost always trace back to an unstated assumption; writing the reasoning down at annotation time, not after the fact, is what makes the label set auditable later.
Two design choices are deliberate and worth flagging to a reviewer:
1. Multi-label, not multi-class. Narr …