Route clothing choices through clothing seed
This commit is contained in:
+28
-1
@@ -50,6 +50,32 @@ def is_pose_content_category(category: dict[str, Any], subcategory: dict[str, An
|
||||
return bool(tokens.intersection({"pose", "poses", "sex", "sexual"}))
|
||||
|
||||
|
||||
def is_clothing_content_category(category: dict[str, Any], subcategory: dict[str, Any]) -> bool:
|
||||
haystack = " ".join(
|
||||
str(value)
|
||||
for value in (
|
||||
category.get("name", ""),
|
||||
category.get("slug", ""),
|
||||
category.get("item_label", ""),
|
||||
subcategory.get("name", ""),
|
||||
subcategory.get("slug", ""),
|
||||
subcategory.get("item_label", ""),
|
||||
)
|
||||
).lower()
|
||||
tokens = set(re.findall(r"[a-z0-9]+", haystack))
|
||||
if tokens.intersection({"clothes", "clothing", "outfit", "outfits", "streetwear", "menswear", "daywear", "activewear", "lingerie", "wardrobe"}):
|
||||
return True
|
||||
return any(
|
||||
phrase in haystack
|
||||
for phrase in (
|
||||
"casual clothes",
|
||||
"men casual clothes",
|
||||
"couple casual clothes",
|
||||
"provocative erotic clothes",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def cast_count_adjustment(
|
||||
requested_women_count: int,
|
||||
requested_men_count: int,
|
||||
@@ -266,7 +292,8 @@ def select_category_item_route_result(
|
||||
)
|
||||
|
||||
is_pose_category = is_pose_content_category(category, subcategory)
|
||||
content_axis = "pose" if is_pose_category else "content"
|
||||
is_clothing_category = is_clothing_content_category(category, subcategory)
|
||||
content_axis = "pose" if is_pose_category else ("clothing" if is_clothing_category else "content")
|
||||
content_rng = seed_policy.axis_rng(seed_config, content_axis, seed, row_number)
|
||||
item = row_item_policy.weighted_choice(content_rng, _list_from(subcategory.get("items", [subcategory["name"]])))
|
||||
item_text, item_name, item_axis_values, item_template_metadata = row_item_policy.compose_item(
|
||||
|
||||
Reference in New Issue
Block a user