Extract caption metadata route assembly

This commit is contained in:
2026-06-27 11:31:39 +02:00
parent 0ccb87799b
commit b38b27acfd
5 changed files with 589 additions and 247 deletions
+9 -1
View File
@@ -427,9 +427,17 @@ Owner: `caption_naturalizer.py`.
Keep here:
- natural sentence caption assembly;
- top-level natural caption orchestration;
- training-caption trigger behavior;
- style-tail policy from `caption_policy.py`.
Already isolated:
- `caption_metadata_routes.py` owns metadata row natural-language assembly for
single, couple, configured-cast, group/layout, and Insta/OF pair routes behind
`CaptionMetadataRouteRequest`, `CaptionMetadataRouteDependencies`, and
`CaptionMetadataRoute`; `caption_naturalizer.py` keeps compatibility wrappers,
profile handling, trigger behavior, and text fallback.
- metadata-family action labels from `action_family` and `position_family` via
`caption_policy.py`.
- shared row route metadata reads from `route_metadata.py`.
+6 -4
View File
@@ -724,7 +724,9 @@ JSON category pools unless the raw builder text is also wrong.
### Naturalizer
`naturalize_caption` chooses metadata-specific renderers such as
`_configured_cast_from_row`, `_couple_from_row`, and single/group renderers.
`caption_metadata_routes.configured_cast_from_row_result`,
`caption_metadata_routes.couple_from_row_result`, and the other metadata route
renderers through compatibility wrappers.
Use this route when the row metadata is correct but the sentence-style caption is
too mechanical or unsuitable for training captions.
@@ -733,9 +735,9 @@ Naturalizer field consumption:
| Branch | Reads most from | Key functions |
| --- | --- | --- |
| Normal single/couple/group | subject fields, age/body, item, scene, expression, composition, camera scene | `_single_from_row`, `_couple_from_row`, `_group_or_layout_from_row` |
| Configured cast/hardcore | `cast_descriptor_text`, `action_family`, `position_family`, `role_graph`, `item`, `scene_text`, expression, composition | `_configured_cast_from_row`, `_metadata_action_label` |
| Insta/OF pair | `softcore_row`, `hardcore_row`, pair options and continuity | `_insta_pair_from_row` |
| Normal single/couple/group | subject fields, age/body, item, scene, expression, composition, camera scene | `caption_metadata_routes.single_from_row_result`, `caption_metadata_routes.couple_from_row_result`, `caption_metadata_routes.group_or_layout_from_row_result` |
| Configured cast/hardcore | `cast_descriptor_text`, `action_family`, `position_family`, `role_graph`, `item`, `scene_text`, expression, composition | `caption_metadata_routes.configured_cast_from_row_result`, `_metadata_action_label` |
| Insta/OF pair | `softcore_row`, `hardcore_row`, pair options and continuity | `caption_metadata_routes.insta_of_pair_from_row_result` |
| Text fallback | `caption` or `prompt` text | `_text_to_prose` |
### Final Text Hygiene