Logo Lanfrica

tayebrhn/amharic-writing-assistant

Domain:

natural language processing

Record type:

software
Creator:
tay
Host:
# Amharic Writing Assistant Status: Phase 1 (spell check) working end to end. Grammar, similarity, and rewrite are stubbed out as empty folders for later phases. ## Run it docker-compose up --build This starts the API on localhost (docs at /docs) and a Postgres instance with the pgvector extension on :5432. The `db` service isn't used by any code yet - it's provisioned early for Phase 2 (similarity engine). Check it's up: curl localhost Spell-check some text: curl -X POST localhost \ -H "Content-Type: application/json" \ -d '{"text": "ሰላም እንደምን ነህ"}' Response is one entry per word, in reading order: { "results": [ {"word": "ሰላም", "is_correct": true, "suggestions": []}, {"word": "እንደምን", "is_correct": true, "suggestions": []}, {"word": "ነህ", "is_correct": true, "suggestions": []} ] } ## Local dev without Docker pip install -r api/requirements.txt uvicorn api.main:app --reload ## Tests pip install pytest httpx pytest tests/ -v ## How the spell checker works 1. `nlp/preprocessing/amharic_normalizer.py` folds Amharic's homophone letter families (e.g. ሰ/ሠ, ጸ/ፀ, ሀ/ሐ/ኀ/ኸ, አ/ዐ - letters pronounced identically today but historically distinct) down to one canonical spelling, and cleans whitespace/legacy punctuation. 2. `nlp/dictionaries/amharic_words.txt` is a ~270k word frequency dictionary, normalized with the *exact same* folding function, built by `nlp/dictionaries/build_dictionary.py` from a public ~490k word Amharic web-crawl frequency list (yididiyan/amharic_spell_corrector, MIT licensed). Words appearing fewer than 3 times in the source crawl are dropped as likely noise. 3. `api/services/spell_checker.py` wraps `symspellpy` (Symmetric Delete algorithm) over that dictionary for fast fuzzy lookup, edit distance ≤2. 4. `api/models/loaded_models.py` loads the dictionary once at startup (~7s) and caches it, so requests don't pay that cost. ## Known limitations (read before you trust the output) - **Th …