Clean up paired expressions and Krea ages
This commit is contained in:
+7
-1
@@ -168,6 +168,12 @@ def _clean_age(age: Any) -> str:
|
||||
return _clean(age)
|
||||
|
||||
|
||||
def _age_detail_phrase(age: Any) -> str:
|
||||
text = _clean(age)
|
||||
text = re.sub(r"\s+adults?$", "", text).strip()
|
||||
return text.replace("-year-old", " years old")
|
||||
|
||||
|
||||
def _age_subject(row: dict[str, Any], fallback_subject: str = "adult person") -> str:
|
||||
subject = _clean(row.get("subject_phrase") or row.get("primary_subject") or row.get("subject") or fallback_subject)
|
||||
age = _clean_age(row.get("age_band") or row.get("age"))
|
||||
@@ -281,7 +287,7 @@ def _normal_row_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
|
||||
subject = _clean(row.get("subject_phrase") or primary or "adult couple")
|
||||
if subject == "woman and man":
|
||||
subject = "a woman and a man"
|
||||
ages = _row_value(row, "age", ("Ages",)) or _clean(row.get("age_band"))
|
||||
ages = _age_detail_phrase(_row_value(row, "age", ("Ages",)) or row.get("age_band"))
|
||||
body = _row_value(row, "body", ("Body types",)) or _clean(row.get("body_type"))
|
||||
parts = [
|
||||
f"An adult couple: {subject}, all visibly adult",
|
||||
|
||||
Reference in New Issue
Block a user