# Afan Oromo Spellchecker 🔤✨
A tiny, fast HTTP API for spell-checking and suggesting corrections in Afaan Oromo. It loads a Hunspell-style dictionary, ranks suggestions using word frequencies, and exposes a clean Axum-based API.
- Entrypoint: src/main.rs
- Router: `routes::create_router`
- Dictionary: `dictionary::Dictionary` (loader: `dictionary::Dictionary::load`)
- Suggestion engine: src/suggest.rs
- HTTP handlers: src/handlers.rs
- Utilities: src/utils.rs
- Integration tests: tests/integration.rs
## TL;DR
- Put your dictionaries in `data/`:
- data/dictionary.aff
- data/dictionary.dic
- Optional frequency-augmented: data/dictionary.freq.dic
- Run the API:
```sh
cargo run
```
- API starts at
127.0.0.1 and logs:
```
🚀 Spell Checker API running at
127.0.0.1
```
## Why this project?
- Focused on Afaan Oromo with a domain-aware suggestion pipeline.
- Frequency ranking improves real-world suggestions and reduces noise.
- Simple Axum HTTP API suitable for embedding in apps and services.
## Quick start
1) Build and run
```sh
cargo run
```
2) Hit the API
- The primary endpoint is `/check` (see `routes::create_router` and src/handlers.rs for the exact request/response schema).
- Examples you can try (depending on the configured handlers):
POST (JSON):
```sh
curl -s
127.0.0.1 \
-H 'Content-Type: application/json' \
-d '{"text": "Galatoma akkaataa barreessuu"}'
```
GET (query):
```sh
curl -s '
127.0.0.1'
```
Tip: Inspect src/routes.rs and src/handlers.rs to see the latest contract and supported endpoints.
## Dictionaries and frequencies
On startup, `dictionary::Dictionary::load` prefers a pre-aggregated frequency dictionary if present:
- data/dictionary.freq.dic → preferred
- data/dictionary.dic → fallback
Generate the frequency-augmented dictionary via the included helper binary:
```sh
cargo run --bin aggregate_freq
```
Source: src/bin/aggregate_freq.rs
## …