observantdistressed commited on
Commit
57207b5
Β·
1 Parent(s): bb9df7f

Fix auto-LoRA prompt matching: negation guard, typo fixes, phrase coverage

Browse files

- Add _is_negated guard so negated camera/zoom phrases ('no zooming',
'no zooms that crop') don't fire FOV, while positive 'zoom-ins' still do
- Add _TYPO_FIXES map in _normalize (naaked, nuude, niipples, vaagina, ...)
- FOV: drop bare 'zoom', require zoom in/out/zooms in/zooms out
- Remove over-broad phrases: 'spreading her' (Pussy Helper), bare 'facial'
(iGoon Blink_Facial), 'standing position' (Standing Upright Sex),
'bent over' (sfbehind)
- Expand coverage: breast squeeze/cup/caress + pronoun forms, fingering
masturbation phrases, deep penetration wording, vulva/labia close-up,
nudity phrases mapped to General NSFW Booster
- Smashcut requires: add 'into and out of her pussy' so 'thrusts into and
out of her pussy' phrasing gates it correctly
- Tie-break: last-scored group wins on exact score tie (iGoon Facial over
Facesplash on shared 'facial cumshot')

Files changed (1) hide show
  1. lora_loader.py +67 -12
lora_loader.py CHANGED
@@ -183,6 +183,14 @@ def get_lora_choices():
183
  # activate anything. Near-duplicate variants of the same concept are left
184
  # manual-only to keep auto firing on one representative LoRA per concept.
185
 
 
 
 
 
 
 
 
 
186
  def _normalize(text):
187
  """Normalize text for phrase matching.
188
 
@@ -190,11 +198,16 @@ def _normalize(text):
190
  newlines, tabs and punctuation all become spaces), collapses whitespace
191
  runs to single spaces, and pads the result with surrounding spaces so
192
  substring matches respect token boundaries. "face-fucking" and
193
- "face fucking" both normalize to "face fucking".
 
194
  """
195
  if not text or not isinstance(text, str):
196
  return ""
197
  t = text.lower()
 
 
 
 
198
  t = re.sub(r"[^a-z0-9]+", " ", t)
199
  t = re.sub(r"\s+", " ", t)
200
  return " " + t.strip() + " "
@@ -283,7 +296,7 @@ LORA_AUTO_PHRASES = {
283
  "flat on the bed face down", "lying under him face down",
284
  ],
285
  "sfbehind_v2.1": [
286
- "sfbehind", "sfb3hind", "bent over at the waist", "bent over", "bent forward",
287
  "leaning over the bed", "bent over the edge",
288
  ],
289
  "mql_casting_sex_doggy_kneel_diagonally_behind_vagina_wan22_i2v_v1": [
@@ -323,7 +336,7 @@ LORA_AUTO_PHRASES = {
323
  "suspended congress position", "suspended in the air",
324
  ],
325
  "Standing Upright Sex": [
326
- "standing sex", "upright sex", "standing against the wall", "standing position",
327
  "standing pressed against the wall", "upright against wall", "standing doggy",
328
  "sex while standing",
329
  ],
@@ -336,6 +349,10 @@ LORA_AUTO_PHRASES = {
336
  "Fingering": [
337
  "fingering", "fingers her", "finger her pussy", "fingers inside her",
338
  "playing with her pussy", "finger her", "rub her clit", "fingering her pussy",
 
 
 
 
339
  ],
340
  "Oral Insertion": [
341
  "oral insertion", "oral insert", "tip of his cock", "just the tip",
@@ -365,7 +382,7 @@ LORA_AUTO_PHRASES = {
365
  "load on her face", "cum across her face", "cum on her face and mouth",
366
  ],
367
  "iGoon - Blink_Facial_I2V": [
368
- "facial", "cum across her face", "cum on her face", "facial cumshot",
369
  "cums on her face", "facial finish",
370
  ],
371
  "Pornmaster_wan 2.2_14b_I2V_bukkake_v1.4": [
@@ -391,18 +408,23 @@ LORA_AUTO_PHRASES = {
391
  # ── pussy / penetration ──
392
  "Pussy Helper": [
393
  "pussy spread", "spread her pussy", "pussy helper", "rub her vagina",
394
- "opens her pussy", "spreading her", "pussy spread open",
395
  ],
396
  "wan2.2_i2v_high_ulitmate_pussy_asshole": [
397
  "pussy and asshole", "asshole focus", "pussy and anus", "asshole spread",
398
- "anus focus", "pussy and ass", "both holes",
 
 
399
  ],
400
  "Penetration Insert": [
401
  "penetration insert", "moment of entry", "penetrating her", "entering her",
402
  "sliding inside her", "first penetration", "cock entering", "sliding in",
403
  "penetration close up", "thrusting into her pussy", "thrusting into and out of her",
404
- "thrusting in and out of her pussy", "thrusts into her pussy",
405
- "penetrating her pussy", "entering her pussy",
 
 
 
406
  ],
407
  # ── expressions / foreplay ──
408
  "Ahegao Drooling": [
@@ -420,6 +442,10 @@ LORA_AUTO_PHRASES = {
420
  "mql_massage_tits_wan22_i2v_v1": [
421
  "breast massage", "massage her tits", "boob massage", "massaging her breasts",
422
  "cupping her breasts", "fondling her breasts", "kneading her tits", "groping her tits",
 
 
 
 
423
  ],
424
  "mql_panties_aside_wan22_i2v_v1": [
425
  "panties aside", "panties to the side", "pulled to one side", "panties pulled aside",
@@ -427,8 +453,8 @@ LORA_AUTO_PHRASES = {
427
  ],
428
  # ── camera / scene effects ──
429
  "FOV Slider (camera)": [
430
- "camera zooms", "push in", "fov slider", "zoom", "zoom in", "push in close",
431
- "camera pushes in", "fov change", "close up on",
432
  ],
433
  "Smashcut (camera)": [
434
  "smashcut", "sm4shcut", "jump cut", "quick cut", "hard cut", "instant cut",
@@ -444,6 +470,10 @@ LORA_AUTO_PHRASES = {
444
  "having sex", "have sex", "sexual intercourse", "intercourse", "making love",
445
  "fucking her", "fucking him", "fucking each other", "hardcore sex", "rough sex",
446
  "sex scene", "porn scene",
 
 
 
 
447
  ],
448
  }
449
 
@@ -532,6 +562,7 @@ LORA_AUTO_REQUIRES = {
532
  "thrusting into and out of her pussy",
533
  "penis into and out of her pussy",
534
  "cock into and out of her pussy",
 
535
  "in and out of her pussy",
536
  "thrusting into her pussy",
537
  "pounding her pussy",
@@ -576,6 +607,27 @@ for _g in LORA_AUTO_PHRASES:
576
  AUTO_SCORE_THRESHOLD = 0.35
577
 
578
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  def auto_activation_details(prompt):
580
  """Score every LoRA group against the prompt and return activation details.
581
 
@@ -606,7 +658,7 @@ def auto_activation_details(prompt):
606
  # morphological variants: "deepthroat" matches "deepthroats",
607
  # "piston" matches "pistoning", "face fuck" matches "face fucks".
608
  inner = np.strip()
609
- if inner in text:
610
  matched.append(inner)
611
  score += _phrase_icf[np]
612
  if not matched:
@@ -632,7 +684,10 @@ def auto_activation_details(prompt):
632
  for members in cat_groups.values():
633
  best = None
634
  for score, group, matched in scored:
635
- if group in members and (best is None or score > best[0]):
 
 
 
636
  best = (score, group, matched)
637
  if best and best[0] >= AUTO_SCORE_THRESHOLD:
638
  results.append({"group": best[1], "score": round(best[0], 3), "matched": best[2]})
 
183
  # activate anything. Near-duplicate variants of the same concept are left
184
  # manual-only to keep auto firing on one representative LoRA per concept.
185
 
186
+ _TYPO_FIXES = {
187
+ "naaked": "naked", "nuude": "nude", "nuudity": "nudity",
188
+ "niipples": "nipples", "tiits": "tits", "tiitty": "titty",
189
+ "arreola": "areola", "vaagina": "vagina", "vuulva": "vulva",
190
+ "coompletely": "completely", "sqquirting": "squirting",
191
+ }
192
+
193
+
194
  def _normalize(text):
195
  """Normalize text for phrase matching.
196
 
 
198
  newlines, tabs and punctuation all become spaces), collapses whitespace
199
  runs to single spaces, and pads the result with surrounding spaces so
200
  substring matches respect token boundaries. "face-fucking" and
201
+ "face fucking" both normalize to "face fucking". Curated misspellings are
202
+ corrected first, on intact words, before punctuation stripping.
203
  """
204
  if not text or not isinstance(text, str):
205
  return ""
206
  t = text.lower()
207
+ # Typo/misspelling fixes β€” applied AFTER lowercase but BEFORE the character
208
+ # filter, so they run on intact words ("naaked" -> "naked", etc.).
209
+ for _wrong, _right in _TYPO_FIXES.items():
210
+ t = t.replace(_wrong, _right)
211
  t = re.sub(r"[^a-z0-9]+", " ", t)
212
  t = re.sub(r"\s+", " ", t)
213
  return " " + t.strip() + " "
 
296
  "flat on the bed face down", "lying under him face down",
297
  ],
298
  "sfbehind_v2.1": [
299
+ "sfbehind", "sfb3hind", "bent over at the waist", "bent forward",
300
  "leaning over the bed", "bent over the edge",
301
  ],
302
  "mql_casting_sex_doggy_kneel_diagonally_behind_vagina_wan22_i2v_v1": [
 
336
  "suspended congress position", "suspended in the air",
337
  ],
338
  "Standing Upright Sex": [
339
+ "standing sex", "upright sex", "standing against the wall",
340
  "standing pressed against the wall", "upright against wall", "standing doggy",
341
  "sex while standing",
342
  ],
 
349
  "Fingering": [
350
  "fingering", "fingers her", "finger her pussy", "fingers inside her",
351
  "playing with her pussy", "finger her", "rub her clit", "fingering her pussy",
352
+ "rubbing her vagina", "rubs her vagina", "rubbing her pussy", "rubs her pussy",
353
+ "rubbing her clit", "masturbating", "masturbation", "touching herself",
354
+ "finger herself", "fingering herself", "spread pussy lips", "spreads her pussy lips",
355
+ "circling clit",
356
  ],
357
  "Oral Insertion": [
358
  "oral insertion", "oral insert", "tip of his cock", "just the tip",
 
382
  "load on her face", "cum across her face", "cum on her face and mouth",
383
  ],
384
  "iGoon - Blink_Facial_I2V": [
385
+ "cum across her face", "cum on her face", "facial cumshot",
386
  "cums on her face", "facial finish",
387
  ],
388
  "Pornmaster_wan 2.2_14b_I2V_bukkake_v1.4": [
 
408
  # ── pussy / penetration ──
409
  "Pussy Helper": [
410
  "pussy spread", "spread her pussy", "pussy helper", "rub her vagina",
411
+ "opens her pussy", "pussy spread open",
412
  ],
413
  "wan2.2_i2v_high_ulitmate_pussy_asshole": [
414
  "pussy and asshole", "asshole focus", "pussy and anus", "asshole spread",
415
+ "anus focus", "pussy and ass", "both holes", "vulva", "vulva close up",
416
+ "labia", "labial folds", "pussy close up", "vagina close up",
417
+ "intimate close up of her pussy",
418
  ],
419
  "Penetration Insert": [
420
  "penetration insert", "moment of entry", "penetrating her", "entering her",
421
  "sliding inside her", "first penetration", "cock entering", "sliding in",
422
  "penetration close up", "thrusting into her pussy", "thrusting into and out of her",
423
+ "thrusting in and out of her pussy", "thrusts into her pussy", "into and out of her pussy",
424
+ "penetrating her pussy", "entering her pussy", "deep vaginal penetration",
425
+ "deep penetration", "penetrating deep inside", "penetrates her",
426
+ "slides deep into her", "slides deep inside", "slides deep into her vagina",
427
+ "thrust deeper inside", "penetrating her deeply",
428
  ],
429
  # ── expressions / foreplay ──
430
  "Ahegao Drooling": [
 
442
  "mql_massage_tits_wan22_i2v_v1": [
443
  "breast massage", "massage her tits", "boob massage", "massaging her breasts",
444
  "cupping her breasts", "fondling her breasts", "kneading her tits", "groping her tits",
445
+ "squeezes her breasts", "squeezing her breasts", "squeeze her breasts",
446
+ "squeezing them", "squeezes them", "cup her breasts", "cupping them",
447
+ "caressing her breasts", "caress her breasts", "caressing them",
448
+ "pinching her nipples", "pinching nipples",
449
  ],
450
  "mql_panties_aside_wan22_i2v_v1": [
451
  "panties aside", "panties to the side", "pulled to one side", "panties pulled aside",
 
453
  ],
454
  # ── camera / scene effects ──
455
  "FOV Slider (camera)": [
456
+ "camera zooms", "push in", "fov slider", "zoom in", "zoom out", "zooms in",
457
+ "zooms out", "push in close", "camera pushes in", "fov change", "close up on",
458
  ],
459
  "Smashcut (camera)": [
460
  "smashcut", "sm4shcut", "jump cut", "quick cut", "hard cut", "instant cut",
 
470
  "having sex", "have sex", "sexual intercourse", "intercourse", "making love",
471
  "fucking her", "fucking him", "fucking each other", "hardcore sex", "rough sex",
472
  "sex scene", "porn scene",
473
+ "naked", "nude", "undressed", "undressing", "stripped", "no underwear",
474
+ "completely bare", "bare body", "shedding her clothes", "removes all clothing",
475
+ "removes her clothes", "discard garments", "completely naked", "fully naked",
476
+ "standing naked", "naked body",
477
  ],
478
  }
479
 
 
562
  "thrusting into and out of her pussy",
563
  "penis into and out of her pussy",
564
  "cock into and out of her pussy",
565
+ "into and out of her pussy",
566
  "in and out of her pussy",
567
  "thrusting into her pussy",
568
  "pounding her pussy",
 
607
  AUTO_SCORE_THRESHOLD = 0.35
608
 
609
 
610
+ _NEGATION_TOKENS = ("no ", "zero ", "not ", "never ", "without ", "without any ")
611
+
612
+
613
+ def _is_negated(text, phrase):
614
+ """True if a phrase occurrence is preceded by a negation token
615
+ (no/zero/not/never/without) within a few words. Handles 'no zooming',
616
+ 'no zooms that crop', 'no panning tilting zooming', but NOT positive
617
+ 'quick greedy zooms in'."""
618
+ start = 0
619
+ while True:
620
+ i = text.find(phrase, start)
621
+ if i == -1:
622
+ return False
623
+ before = text[max(0, i - 30):i]
624
+ # \s*$ allows the slice to end with a space right before the phrase
625
+ # ("no zooms that crop" -> before ends "...no ").
626
+ if re.search(r"\b(no|zero|not|never|without)\b(?:\s+\w+){0,3}\s*$", before):
627
+ return True
628
+ start = i + 1
629
+
630
+
631
  def auto_activation_details(prompt):
632
  """Score every LoRA group against the prompt and return activation details.
633
 
 
658
  # morphological variants: "deepthroat" matches "deepthroats",
659
  # "piston" matches "pistoning", "face fuck" matches "face fucks".
660
  inner = np.strip()
661
+ if inner in text and not _is_negated(text, inner):
662
  matched.append(inner)
663
  score += _phrase_icf[np]
664
  if not matched:
 
684
  for members in cat_groups.values():
685
  best = None
686
  for score, group, matched in scored:
687
+ # On an exact score tie the LAST-scored group wins (>=), so the
688
+ # more specific/later variant (e.g. iGoon Facial over Facesplash
689
+ # when both share "facial cumshot") takes the category slot.
690
+ if group in members and (best is None or score >= best[0]):
691
  best = (score, group, matched)
692
  if best and best[0] >= AUTO_SCORE_THRESHOLD:
693
  results.append({"group": best[1], "score": round(best[0], 3), "matched": best[2]})