Naturalize caption character expressions

This commit is contained in:
2026-06-27 21:30:23 +02:00
parent 4de00bcc9d
commit 4f97057fc4
3 changed files with 77 additions and 5 deletions
+11
View File
@@ -526,6 +526,16 @@ def _caption_cast_descriptor_issues(name: str, row: dict[str, Any] | None, capti
return []
def _caption_expression_grammar_issues(name: str, caption_text: str) -> list[str]:
if re.search(
r"\b(?:with|are|show|shows|is|include|includes)\s+(?:woman|man) [a-z]\s+has\b",
caption_text,
flags=re.IGNORECASE,
):
return [f"{name}.caption: character_expression_has_grammar"]
return []
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:
@@ -659,6 +669,7 @@ def _formatter_issues(
issues.append(f"{name}.{formatter_name}: not_metadata_route:{method}")
issues.extend(_formatter_trace_issues(name, formats, target=target, row=row))
issues.extend(_caption_cast_descriptor_issues(name, row, caption_text))
issues.extend(_caption_expression_grammar_issues(name, caption_text))
for label, value in (
(f"{name}.krea_negative", krea.get("negative_prompt")),