Tighten hardcore Krea action wording

This commit is contained in:
2026-06-24 16:00:01 +02:00
parent 81d9b20db7
commit 8589035a07
4 changed files with 215 additions and 70 deletions
+113 -16
View File
@@ -185,20 +185,46 @@ def _label_join(labels: list[str]) -> str:
labels = [_clean(label) for label in labels if _clean(label)]
if not labels:
return "the named adults"
if set(labels) == {"Woman A", "Man A"}:
return "the woman and man"
if len(labels) == 1:
if labels[0] == "Woman A":
return "the woman"
if labels[0] == "Man A":
return "the man"
return labels[0]
if len(labels) == 2:
return f"{labels[0]} and {labels[1]}"
return f"{', '.join(labels[:-1])}, and {labels[-1]}"
def _natural_label_text(text: Any, labels: list[str]) -> str:
text = _clean(text)
if not text:
return ""
if set(labels) == {"Woman A", "Man A"}:
text = re.sub(r"\bWoman A\b", "the woman", text)
text = re.sub(r"\bMan A\b", "the man", text)
elif labels == ["Woman A"]:
text = re.sub(r"\bWoman A\b", "the woman", text)
elif labels == ["Man A"]:
text = re.sub(r"\bMan A\b", "the man", text)
return text
def _cast_prose(text: str, central_label: str = "Woman A") -> tuple[str, list[str]]:
entries = _cast_entries(text)
if not entries:
return (f"{central_label} is {_clean(text)}" if _clean(text) else "", [])
labels = [label for label, _descriptor in entries]
count_phrase = "one named adult" if len(entries) == 1 else f"{len(entries)} named adults"
sentences = [f"The scene contains {count_phrase}."]
if labels == ["Woman A"]:
return f"A {entries[0][1]}", labels
if labels == ["Man A"]:
return f"A {entries[0][1]}", labels
if set(labels) == {"Woman A", "Man A"} and len(labels) == 2:
by_label = {label: descriptor for label, descriptor in entries}
return f"A {by_label['Woman A']} alongside a {by_label['Man A']}", labels
sentences = []
for label, descriptor in entries:
sentences.append(f"{label} is {descriptor}.")
if central_label in labels:
@@ -225,10 +251,72 @@ def _natural_clothing_state(text: Any) -> str:
if not text:
return ""
text = re.sub(r"^Clothing state:\s*", "", text, flags=re.IGNORECASE)
text = re.sub(r";\s*softcore visual reference:\s*", ". Softcore visual reference: ", text, flags=re.IGNORECASE)
match = re.match(
r"^(.*?)\b(?:softcore|teaser) outfit is (.*?)(?: for the (?:hardcore|sex) scene)?;\s*(?:softcore visual reference|teaser outfit detail):\s*(.*?)\.?$",
text,
flags=re.IGNORECASE,
)
if match:
owner = _natural_label_text(match.group(1).strip(" 's"), ["Woman A", "Man A"]).strip() or "the woman"
state = _clean(match.group(2)).lower()
outfit = _clean(match.group(3)).rstrip(".")
if "fully nude" in state:
return f"{owner.capitalize()} is fully nude, with the removed {outfit} visible nearby"
if "nude-adjacent" in state:
return f"{owner.capitalize()} is partly nude, with the {outfit} slipping off and no abstract clothing-reference wording"
if "partially removed" in state or "pushed aside" in state:
return f"{owner.capitalize()}'s {outfit} is pushed aside and partly removed, exposing the sexual contact clearly"
if "keeps" in state:
return f"{owner.capitalize()} keeps the {outfit} on while the sexual contact stays visible"
text = re.sub(r";\s*(?:softcore visual reference|teaser outfit detail):\s*", ". Visual clothing state: ", text, flags=re.IGNORECASE)
text = text.replace("softcore outfit", "outfit")
text = text.replace("teaser outfit", "outfit")
text = text.replace("hardcore scene", "sex scene")
return text
def _hardcore_action_sentence(role_graph: str, hard_item: str) -> str:
role_graph = _clean(role_graph).rstrip(".")
hard_item = _clean(hard_item).rstrip(".")
role_graph = re.sub(
r"\bthe man penetrates the woman while a toy adds a second point of contact\b",
"the man's penis thrusts into the woman while a toy adds a second penetration point",
role_graph,
flags=re.IGNORECASE,
)
role_graph = re.sub(
r"\bthe man penetrates the woman anally\b",
"the man's penis thrusts into the woman's ass",
role_graph,
flags=re.IGNORECASE,
)
role_graph = re.sub(
r"\bthe man penetrates the woman\b",
"the man's penis thrusts into the woman",
role_graph,
flags=re.IGNORECASE,
)
role_graph = re.sub(
r"\bthe woman and the man are in mutual oral contact with mouth-to-genital contact visible\b",
"the woman has the man's penis in her mouth while the man uses his mouth on her pussy",
role_graph,
flags=re.IGNORECASE,
)
role_graph = re.sub(
r"\bthe woman gives oral to the man\b",
"the woman takes the man's penis in her mouth",
role_graph,
flags=re.IGNORECASE,
)
if hard_item and role_graph:
return f"Explicit hardcore action: {role_graph}; {hard_item}"
if role_graph:
return f"Explicit hardcore action: {role_graph}"
if hard_item:
return f"Explicit hardcore action: {hard_item}"
return ""
def _clean_age(age: Any) -> str:
return _clean(age)
@@ -353,19 +441,27 @@ def _normal_row_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
if subject_type == "configured_cast" or _clean(row.get("cast_summary")):
subject = _clean(row.get("subject_phrase") or primary or "adult sexual scene")
cast = _clean(row.get("cast_summary"))
try:
women_count = int(row.get("women_count") or 0)
men_count = int(row.get("men_count") or 0)
except (TypeError, ValueError):
women_count = men_count = 0
cast_descriptor_text = (
_clean(row.get("cast_descriptor_text"))
or _prompt_field(_clean(row.get("prompt")), "Characters")
or _prompt_field(_clean(row.get("prompt")), "Cast descriptors")
)
cast_prose, _cast_labels = _cast_prose(cast_descriptor_text)
role_graph = _clean(row.get("role_graph"))
cast_prose, cast_labels = _cast_prose(cast_descriptor_text)
if not cast_labels and women_count == 1 and men_count == 1:
cast_labels = ["Woman A", "Man A"]
role_graph = _natural_label_text(_clean(row.get("role_graph")), cast_labels)
item = _natural_label_text(item, cast_labels)
action = _hardcore_action_sentence(role_graph, item)
parts = [
f"A consensual explicit adult scene with {subject}",
action,
cast_prose,
f"The cast includes {cast}" if cast and not cast_prose else "",
role_graph,
f"The sexual action is {item}" if item else "",
f"A consensual explicit adult scene with {subject}" if not action else "",
f"The cast includes {cast}" if cast and not cast_prose and not (women_count == 1 and men_count == 1) else "",
f"The setting is {scene}" if scene else "",
f"Facial expressions are {expression}" if expression else "",
f"The image is framed as {composition}" if composition else "",
@@ -452,11 +548,14 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
hard_cast_prose, hard_labels = _cast_prose(cast_descriptor_text)
hard_item = _sanitize_scene_text_for_cast(hard.get("item"), hard_labels)
hard_role_graph = _sanitize_scene_text_for_cast(hard.get("role_graph"), hard_labels)
hard_item = _natural_label_text(hard_item, hard_labels)
hard_role_graph = _natural_label_text(hard_role_graph, hard_labels)
hard_action = _hardcore_action_sentence(hard_role_graph, hard_item)
same_soft_cast = options.get("softcore_cast") == "same_as_hardcore"
soft_cast_presence = (
f"{_label_join(soft_labels)} are together in a non-explicit teaser pose, with no sex act or genital contact"
if same_soft_cast
else "The softcore version focuses on Woman A alone"
else "The image focuses on the woman alone"
)
partner_styling = row.get("softcore_partner_styling")
if isinstance(partner_styling, dict):
@@ -466,13 +565,13 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
else:
partner_outfit_text = ""
partner_pose = ""
partner_outfit_text = _natural_label_text(partner_outfit_text, soft_labels)
soft_parts = [
f"Softcore {soft_level or 'creator'} Insta/OF image",
soft_cast_prose,
soft_cast_presence,
partner_outfit_text,
f"The cast is {partner_pose}" if partner_pose else "",
partner_pose,
f"wearing {soft.get('item')}" if soft.get("item") else "",
f"{soft.get('pose')}" if soft.get("pose") else "",
f"with {soft.get('expression')}" if soft.get("expression") else "",
@@ -482,11 +581,9 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
soft_style if detail_level != "concise" else "",
]
hard_parts = [
f"{hard_level or 'hardcore'} scene",
hard_cast_prose,
hard_action,
_natural_clothing_state(row.get("hardcore_clothing_state")),
hard_role_graph,
f"The explicit detail shows {hard_item}" if hard_item else "",
hard_cast_prose,
f"set in {hard_scene}" if hard_scene else "",
f"with {hard.get('expression')}" if hard.get("expression") else "",
f"framed as {hard_composition}" if hard_composition else "",