Extract Krea cast and hardcore cleanup helpers

This commit is contained in:
2026-06-26 15:24:19 +02:00
parent a4a8a7a28e
commit 92469daf03
6 changed files with 242 additions and 225 deletions
+20 -5
View File
@@ -61,6 +61,15 @@ route-specific owner. It also preserves ordinary words such as `composition`
inside normal sentences; empty field-label cleanup is limited to standalone
labels.
Shared hardcore phrase cleanup now has one home:
- `hardcore_text_cleanup.py`
It owns environment-anchor normalization used by both prompt generation and
Krea formatting, including malformed surface joins and bed/sheet/couch anchors
that should become model-neutral body-support language. It must stay
route-neutral: no Krea prose, no SDXL tags, and no category selection logic.
Current integration points:
- `prompt_builder.build_prompt`
@@ -95,8 +104,9 @@ Already isolated:
- camera-scene prose and coworking composition adaptation live in
`scene_camera_adapters.py`; `prompt_builder.py` still owns camera config
parsing and row mutation.
- shared hardcore environment-anchor cleanup normalizes malformed pool joins
such as `on against a wall` before metadata reaches formatter routes.
- shared hardcore environment-anchor cleanup lives in
`hardcore_text_cleanup.py` and normalizes malformed pool joins before metadata
reaches formatter routes.
### Pair / Adapter Layer
@@ -125,17 +135,21 @@ Owner: `krea_formatter.py`.
Keep here:
- Krea prose style;
- cast prose;
- hardcore action sentence rewriting;
- POV sentence rewriting;
- clothing naturalization;
- camera-scene preservation;
- fallback text parsing.
Already isolated:
- `krea_cast.py` owns cast descriptor parsing, cast prose, label joining, and
natural label replacement for formatter routes.
Improve later:
- split semantic blocks into modules:
`krea_cast.py`, `krea_actions.py`, `krea_pov.py`, `krea_clothing.py`;
`krea_actions.py`, `krea_pov.py`, `krea_clothing.py`;
- add route-level smoke fixtures for representative metadata rows;
- make `_hardcore_action_sentence` dispatch by action family instead of long
conditional chains.
@@ -316,7 +330,8 @@ Medium-term:
## Recommended Next Passes
1. Split Krea action/POV/clothing helpers into separate modules.
1. Split Krea action/POV/clothing helpers into separate modules, using
`krea_cast.py` as the pattern for stable import aliases and smoke coverage.
2. Split `__init__.py` node classes by family after behavior is covered by smoke
checks.
3. Add metadata fields such as `action_family` / `position_family` to reduce