Naturalize composition frame wording
This commit is contained in:
@@ -533,6 +533,8 @@ def _caption_expression_grammar_issues(name: str, caption_text: str) -> list[str
|
||||
flags=re.IGNORECASE,
|
||||
):
|
||||
return [f"{name}.caption: character_expression_has_grammar"]
|
||||
if re.search(r"\bwith expression details showing\b", caption_text, flags=re.IGNORECASE):
|
||||
return [f"{name}.caption: expression_detail_connector"]
|
||||
return []
|
||||
|
||||
|
||||
@@ -546,6 +548,18 @@ def _krea_grammar_issues(name: str, krea_prompt: str) -> list[str]:
|
||||
return []
|
||||
|
||||
|
||||
def _composition_label_issues(name: str, prompts: dict[str, str]) -> list[str]:
|
||||
issues: list[str] = []
|
||||
pattern = re.compile(
|
||||
r"\b(?:framed as|image is framed as|composition is)\s+[^.;]{0,180}\s+composition\b",
|
||||
flags=re.IGNORECASE,
|
||||
)
|
||||
for formatter_name in ("krea", "caption"):
|
||||
if pattern.search(prompts.get(formatter_name, "")):
|
||||
issues.append(f"{name}.{formatter_name}: framed_composition_label")
|
||||
return issues
|
||||
|
||||
|
||||
def _trace_dict(formatter_name: str, payload: dict[str, Any]) -> tuple[dict[str, Any], str]:
|
||||
trace_text = str(payload.get("route_trace_json") or "")
|
||||
if not trace_text:
|
||||
@@ -681,6 +695,7 @@ def _formatter_issues(
|
||||
issues.extend(_caption_cast_descriptor_issues(name, row, caption_text))
|
||||
issues.extend(_caption_expression_grammar_issues(name, caption_text))
|
||||
issues.extend(_krea_grammar_issues(name, krea_prompt))
|
||||
issues.extend(_composition_label_issues(name, prompts))
|
||||
|
||||
for label, value in (
|
||||
(f"{name}.krea_negative", krea.get("negative_prompt")),
|
||||
|
||||
@@ -4029,6 +4029,10 @@ def smoke_caption_policy() -> None:
|
||||
caption_policy.normalize_composition("vertical centered body frame") == "centered body frame",
|
||||
"Caption composition normalization changed",
|
||||
)
|
||||
_expect(
|
||||
caption_policy.normalize_composition("vertical centered body frame composition") == "centered body frame",
|
||||
"Caption composition should drop trailing composition label",
|
||||
)
|
||||
_expect(
|
||||
caption_policy.clean_clothing("silk dress, fashion editorial styling") == "silk dress",
|
||||
"Caption clothing cleanup changed",
|
||||
@@ -6505,7 +6509,11 @@ def smoke_krea_pov_penetration_route() -> None:
|
||||
_expect("woman" in lower and "thigh" in lower, "POV penetration lost body-position anchors")
|
||||
_expect("camera:" not in prompt, "POV penetration emitted normal third-person camera directive")
|
||||
_expect("role graph:" not in lower and "sexual scene:" not in lower, "POV penetration leaked raw prompt labels")
|
||||
_expect("composition. explicit" in lower, "POV penetration composition sentence should keep punctuation before style suffix")
|
||||
style_index = lower.find("explicit consensual")
|
||||
_expect(
|
||||
style_index > 0 and lower[:style_index].rstrip().endswith("."),
|
||||
"POV penetration composition sentence should keep punctuation before style suffix",
|
||||
)
|
||||
|
||||
|
||||
def smoke_pov_outercourse_position_routes() -> None:
|
||||
|
||||
Reference in New Issue
Block a user