# Luganda Text Normalizer
A Python library for preprocessing Luganda text for NLP pipelines:
cleaning, elision expansion, abbreviation/acronym expansion, currency
normalization, date/time expansion, number-to-words expansion,
tokenization, dictionary-based spelling standardization, noun/verb
morphology stripping, and English–Luganda code-switching detection.
> Status: actively developed. See `docs/architecture.md`
> for the full design rationale, module inventory, and known limitations.
## Install
From the project root, editable install (recommended for development):
```bash
pip install -e .
# with dev/test dependencies:
pip install -e ".[dev]"
```
Requires Python ≥ 3.9. Depends on `nltk>=3.8` (see `requirements.txt`).
## Quick start
```python
import normalizer
normalizer.normalize("Nasasula UGX 50,000 nga 16/07/2026 essaawa 07:00.")
```
Or use individual stages directly, without the full pipeline:
```python
from normalizer import number_to_words, expand_currency_to_words, expand_abbreviations
number_to_words(45) # -> "amakumi ana mu ttaano"
expand_currency_to_words("Ekiguzibwa $10 nedda.")
# -> "Ekiguzibwa ddoola kkumi nedda."
expand_abbreviations("URA basoma tax.") # -> "Uganda Revenue Authority basoma tax."
```
## What it does
The pipeline covers ten preprocessing capabilities, each implemented
in its own module so you can use just the pieces you need:
| # | Capability | Module | Example |
|---|---|---|---|
| 1 | Unicode normalization | `cleaner` | NFC-normalizes text, fixes stray control characters |
| 2 | Lowercasing | `pipeline` | applied after tokenization, before spelling lookup |
| 3 | Punctuation cleanup | `cleaner` | standardizes quotes/dashes, collapses repeated punctuation |
| 4 | Number expansion | `number_words` | `25` → `amakumi abiri mu ttaano` |
| 5 | Date/time expansion | `datetime_expand` | `16/07/2026` → `Lwakutaano, olunaku 16 mu mwezi gwa Julaayi, mu mwaka 2026` |
| 6 | Currency normalization | `currency` | …