Clean nested Krea figure phrasing

This commit is contained in:
2026-06-27 22:00:01 +02:00
parent 42857e938e
commit d546061959
3 changed files with 30 additions and 2 deletions
+10
View File
@@ -86,6 +86,16 @@ def _appearance_with_phrase(appearance: str, with_indefinite_article: Callable[[
return ""
first_clause = appearance.split(",", 1)[0].lower()
if re.search(r"\b(?:body|build|figure|frame|physique|silhouette)\b", first_clause):
nested_shape = re.match(
r"^(.+\b(?:body|build|figure|frame|physique|silhouette))\s+with\s+(.+?)(?=,\s+[^,]*(?:skin|hair|eyes)\b|$)(.*)$",
appearance,
flags=re.IGNORECASE,
)
if nested_shape:
shape = with_indefinite_article(nested_shape.group(1).strip())
detail = nested_shape.group(2).strip()
rest = nested_shape.group(3).strip()
return f"with {shape} defined by {detail}{rest}"
appearance = with_indefinite_article(appearance)
return f"with {appearance}"