Adds the assembler module that converts classified tokens into natural language prompts: - base.py: AssemblerConfig, AssembledPrompt, CategorySection classes - rules.py: Phrase templates, gender detection, grammar helpers - standard.py: StandardAssembler with NATURAL/TAGS/HYBRID styles The assembler takes ClassifiedImage from Phase 3 and produces prompts following the canonical category order. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
53 lines
1.0 KiB
Python
53 lines
1.0 KiB
Python
"""Assembler module for generating natural language prompts.
|
|
|
|
This module handles Phase 4 of the pipeline:
|
|
- Rule-based assembly (templates, phrase mappings, grammar rules)
|
|
- Converts classified tokens into coherent prompts
|
|
"""
|
|
|
|
from .base import (
|
|
BaseAssembler,
|
|
AssemblerConfig,
|
|
AssembledPrompt,
|
|
CategorySection,
|
|
PromptStyle,
|
|
)
|
|
|
|
from .rules import (
|
|
Gender,
|
|
detect_gender,
|
|
get_pronouns,
|
|
clean_token_for_output,
|
|
join_tokens_natural,
|
|
build_subject_phrase,
|
|
CATEGORY_TEMPLATES,
|
|
SUBJECT_DETAIL_TEMPLATES,
|
|
)
|
|
|
|
from .standard import (
|
|
StandardAssembler,
|
|
assemble_prompt,
|
|
)
|
|
|
|
|
|
__all__ = [
|
|
# Base classes
|
|
"BaseAssembler",
|
|
"AssemblerConfig",
|
|
"AssembledPrompt",
|
|
"CategorySection",
|
|
"PromptStyle",
|
|
# Rules
|
|
"Gender",
|
|
"detect_gender",
|
|
"get_pronouns",
|
|
"clean_token_for_output",
|
|
"join_tokens_natural",
|
|
"build_subject_phrase",
|
|
"CATEGORY_TEMPLATES",
|
|
"SUBJECT_DETAIL_TEMPLATES",
|
|
# Standard assembler
|
|
"StandardAssembler",
|
|
"assemble_prompt",
|
|
]
|