Add name suggestion engine with API endpoint and tests

Expand services/naming.py with suggest_names() that picks random words
from a category while excluding nicknames already used in the run. Add
GET /runs/{run_id}/name-suggestions?count=10 endpoint that reads the
run's naming_scheme and returns filtered suggestions. Includes 12 unit
tests covering selection, exclusion, exhaustion, and cross-category
independence.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-11 21:45:04 +01:00
parent 15283ede91
commit 2ac6c23577
5 changed files with 146 additions and 10 deletions

View File

@@ -1,11 +1,11 @@
---
# nuzlocke-tracker-c6ly
title: Build name suggestion engine
status: todo
status: completed
type: task
priority: normal
created_at: 2026-02-11T15:56:44Z
updated_at: 2026-02-11T20:23:35Z
updated_at: 2026-02-11T20:44:27Z
parent: nuzlocke-tracker-igl3
blocking:
- nuzlocke-tracker-bi4e
@@ -29,8 +29,8 @@ Build the backend service and API endpoint that picks random name suggestions fr
## Checklist
- [ ] Create a service module for name suggestion logic (e.g. `services/name_suggestions.py`)
- [ ] Implement dictionary loading with in-memory caching
- [ ] Implement random selection from a category with exclusion of used names
- [ ] Add API endpoint for fetching suggestions
- [ ] Add unit tests for the suggestion logic
- [x] Create a service module for name suggestion logic (e.g. `services/name_suggestions.py`)
- [x] Implement dictionary loading with in-memory caching
- [x] Implement random selection from a category with exclusion of used names
- [x] Add API endpoint for fetching suggestions
- [x] Add unit tests for the suggestion logic

View File

@@ -5,7 +5,7 @@ status: todo
type: epic
priority: normal
created_at: 2026-02-05T13:45:15Z
updated_at: 2026-02-11T20:41:56Z
updated_at: 2026-02-11T20:44:23Z
---
Implement a dictionary-based nickname generation system for Nuzlocke runs. Instead of using an LLM API to generate names on the fly, provide a static dictionary of words categorised by theme. A word can belong to multiple categories, making it usable across different naming schemes.
@@ -28,7 +28,7 @@ Implement a dictionary-based nickname generation system for Nuzlocke runs. Inste
## Success Criteria
- [x] Word dictionary data file exists with multiple categories, each containing 150-200 words
- [ ] Name suggestion engine picks random names from the selected category, avoiding duplicates already used in the run
- [x] Name suggestion engine picks random names from the selected category, avoiding duplicates already used in the run
- [ ] Encounter registration UI shows 5-10 clickable name suggestions
- [ ] User can regenerate suggestions if none fit
- [x] User can select a naming scheme per run