Clean nested Krea figure phrasing
This commit is contained in:
@@ -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}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user