Add naming scheme support for genlockes with lineage-aware suggestions #20

Merged
TheFurya merged 2 commits from feature/genlocke-naming-scheme into develop 2026-02-14 10:00:38 +01:00
4 changed files with 26 additions and 11 deletions
Showing only changes of commit 0728d55f06 - Show all commits

View File

@@ -1,11 +1,11 @@
--- ---
# nuzlocke-tracker-5tac # nuzlocke-tracker-5tac
title: Enable naming generator for Genlockes title: Enable naming generator for Genlockes
status: in-progress status: completed
type: task type: task
priority: normal priority: normal
created_at: 2026-02-11T21:14:21Z created_at: 2026-02-11T21:14:21Z
updated_at: 2026-02-14T08:37:11Z updated_at: 2026-02-14T08:52:16Z
--- ---
## Overview ## Overview

View File

@@ -9,7 +9,6 @@ Create Date: 2026-02-14 00:00:00.000000
from collections.abc import Sequence from collections.abc import Sequence
import sqlalchemy as sa import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.

View File

@@ -8,6 +8,7 @@ from sqlalchemy.orm import joinedload, selectinload
from app.core.database import get_session from app.core.database import get_session
from app.models.boss_result import BossResult from app.models.boss_result import BossResult
from app.models.encounter import Encounter from app.models.encounter import Encounter
from app.models.evolution import Evolution
from app.models.game import Game from app.models.game import Game
from app.models.genlocke import GenlockeLeg from app.models.genlocke import GenlockeLeg
from app.models.genlocke_transfer import GenlockeTransfer from app.models.genlocke_transfer import GenlockeTransfer
@@ -19,10 +20,13 @@ from app.schemas.run import (
RunResponse, RunResponse,
RunUpdate, RunUpdate,
) )
from app.models.evolution import Evolution
from app.models.genlocke import Genlocke
from app.services.families import build_families from app.services.families import build_families
from app.services.naming import get_naming_categories, strip_roman_suffix, suggest_names, to_roman from app.services.naming import (
get_naming_categories,
strip_roman_suffix,
suggest_names,
to_roman,
)
router = APIRouter() router = APIRouter()

View File

@@ -1,6 +1,6 @@
import json import json
import re
import random import random
import re
from functools import lru_cache from functools import lru_cache
from pathlib import Path from pathlib import Path
@@ -28,12 +28,24 @@ def get_words_for_category(category: str) -> list[str]:
_ROMAN_NUMERALS = [ _ROMAN_NUMERALS = [
(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (1000, "M"),
(100, "C"), (90, "XC"), (50, "L"), (40, "XL"), (900, "CM"),
(10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I"), (500, "D"),
(400, "CD"),
(100, "C"),
(90, "XC"),
(50, "L"),
(40, "XL"),
(10, "X"),
(9, "IX"),
(5, "V"),
(4, "IV"),
(1, "I"),
] ]
_ROMAN_SUFFIX_RE = re.compile(r"\s+(M{0,3}(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3}))$") _ROMAN_SUFFIX_RE = re.compile(
r"\s+(M{0,3}(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3}))$"
)
def to_roman(n: int) -> str: def to_roman(n: int) -> str: