Filter anal axis details for position compatibility

This commit is contained in:
2026-06-27 16:04:39 +02:00
parent d0f2670d9c
commit ff6195473b
6 changed files with 262 additions and 6 deletions
+36 -3
View File
@@ -25,8 +25,41 @@ def _clean(value: Any) -> str:
return text
def sanitize_foreplay_detail(detail: str, role_graph: str = "", composition: str = "") -> str:
def strip_redundant_position_detail(detail: str) -> str:
detail = _clean(detail)
if not detail:
return ""
detail = re.sub(
r"^\s*[^,;]*?\bposition\b\s+(?:while|featuring|with)\s+",
"",
detail,
flags=re.IGNORECASE,
)
detail = re.sub(
r"^\s*[^,;]*?\bposition\b,\s*",
"",
detail,
flags=re.IGNORECASE,
)
detail = re.sub(
r"\s+\bin\s+[^,;]*?\bposition\b",
"",
detail,
flags=re.IGNORECASE,
)
detail = re.sub(
r"\s+\bfrom\s+[^,;]*?\bposition\b",
"",
detail,
flags=re.IGNORECASE,
)
detail = re.sub(r"\s*,\s*", ", ", detail)
detail = re.sub(r",\s*,", ",", detail)
return _clean(detail).strip(" ,;")
def sanitize_foreplay_detail(detail: str, role_graph: str = "", composition: str = "") -> str:
detail = strip_redundant_position_detail(detail)
if not detail:
return ""
if not is_close_foreplay_text(role_graph, detail, composition):
@@ -127,7 +160,7 @@ def hardcore_item_detail(hard_item: str) -> str:
def dedupe_anchor_detail(detail: str, anchor: str) -> str:
detail = _clean(detail)
detail = strip_redundant_position_detail(detail)
anchor_lower = anchor.lower()
duplicate_phrases = {
"front-and-back": (r"front-and-back contact",),
@@ -215,7 +248,7 @@ def dedupe_toy_double_detail(detail: str) -> str:
def dedupe_outercourse_detail(detail: str, role_graph: str, hard_item: str = "", axis_values: Any = None) -> str:
detail = _clean(detail)
detail = strip_redundant_position_detail(detail)
if not detail:
return ""
context = position_context_text(role_graph, hard_item, "", axis_values)