Spaces:
Sleeping
Sleeping
Commit History
-
fix(api): fuzzy-match 'myself' typos in pre-filter reflexive lookaheadβ
Without this, "I wanna kill mslf" matched the modal+verb pattern and fell through \S+ as a "target" β short-circuiting to Directed Aggression when the input was clearly self-directed. The model itself handles partial typos correctly ("kil myself" -> Suicidal), but the regex was overriding it with a wrong call on typo'd reflexives. Replaces the fixed typo list (myslf|mysef|meself) with a fuzzy pattern: m[ye]?s?[el]+f+e? Catches: myself, myslf, mysef, mslf, mself, meself, mesef, meslf, myseff, myselff, myselfe. Carefully does not match common M-names (Mel, Mae, Max, Mike, Mark, Mason, Megan, Melissa, Melanie, Mercedes) β covered by 6 new positive test cases.9725f68 -
feat(api): expand pre-filter to AAVE imma/ima + comprehensive regex testsβ
Adds 'imma', 'ima', "'mma", "'ma" to the modal list so AAVE contractions of "I'm gonna" ("imma kill John", "I'mma kill John") short-circuit correctly. The "'mma"/"'ma" forms work via the same \b-after-apostrophe trick used for "'ll". Test file rewritten as a categorized regression suite β 141 cases across 21 categories (named targets, all 11 modals, all 14 verbs, casing, punctuation, multi-clause, whitespace, slang; reflexives canonical/ typo/spaced/"me", idioms bare-noun/det-noun/phrase/food, no-modal, non-violent verb, no-target). Prints per-category pass/fail summary and lists known limitations (negation, 'wanted to', 'would') as info.56573d1 -
fix(api): treat 'myslf' / 'my self' / 'me' as self-directed in pre-filterβ
The reflexive lookahead only matched the canonical spelling "myself", so typos ("myslf", "mysef"), the space-separated form ("my self"), and the bare 1st-person object ("kill me") slipped through to \S+ and got flagged as Directed Aggression β exactly wrong for self-harm input. Broadens the lookahead with \s* between "my" and "self" (and the other reflexives), an enumerated set of common typos, and "me\b". The \b on "me" preserves matching for names that start with "me" (Megan, Melissa).cda47b9 -
fix(api): catch named-target threats in explicit-threat pre-filterβ
The third capture group required a fixed determiner (my/that/the/him/...), so "I wanna kill John" fell through to the model and got misclassified. Replace it with \S+ plus negative lookaheads that exclude reflexives (self-harm β model decides) and common non-violent idioms (kill it, kill the lights, smash that like button, murder some pizza, etc.). Also handles the 'll contraction so "I'll punch X" matches. Adds tests/test_explicit_threat_regex.py β 53 dependency-free assertions pinning the positive cases and the idiom carve-outs.73c2561