mofilo_content_filter 1.0.8
mofilo_content_filter: ^1.0.8 copied to clipboard
Multi-language content filtering for Flutter. Blocks offensive language, hate speech, and harmful content with advanced bypass detection.
Mofilo Content Filter #
A local, rule-based content filter for Flutter/Dart apps. Blocks offensive language, threats, and harmful content while allowing legitimate text.
Quick Start #
import 'package:mofilo_content_filter/mofilo_content_filter.dart';
final result = ContentFilter.check(userInput);
if (result.isBlocked) {
showError(result.reason);
} else {
submitContent(userInput);
}
What It Does #
This is pattern matching, not AI. It blocks text we're 100% certain is harmful.
Blocks #
| Category | Examples |
|---|---|
| Racial slurs | n-word, chnk, spc, etc. |
| Homophobic slurs | f-word (slur), d*ke, etc. |
| Profanity | fck, sht, c*nt |
| Violence + Children | "attack children", "hurt kids" |
| Violence + Person | "kill you", "rape her" |
| CSAM terms | pedo, loli, childporn |
| Grooming | "our little secret", "age is just a number" |
| Self-harm | "kill yourself", "kys" |
| Hate symbols | 1488, "heil hitler" |
| Sexual harassment | "send nudes" |
Allows (Scunthorpe Problem) #
Legitimate words containing bad substrings are correctly allowed:
| Word | Contains | Allowed |
|---|---|---|
| grape | "rape" | ✓ |
| therapist | "rapist" | ✓ |
| class | "ass" | ✓ |
| spicy | "spic" | ✓ |
| bigger | "nigg" | ✓ |
| cocktail | "cock" | ✓ |
| shiitake | "shit" | ✓ |
| arsenal | "arse" | ✓ |
| scunthorpe | "cunt" | ✓ |
Allows (Motivational) #
Context-aware detection allows:
- "I am unstoppable"
- "I am unbreakable"
- "Attack my goals"
- "Kill it at work"
- "Crush the competition"
- "What doesn't kill you makes you stronger"
How It Works #
1. Check famous quotes allowlist → Allow motivational phrases
2. Check hate codes → Block 1488, etc.
3. Check dangerous phrases → Block "kill you" (not "kill")
4. Check Scunthorpe allowlist → Allow "grape", "therapist"
5. Check hard slurs → Block profanity/slurs
6. Default → Allow
Design principle: Only block what we're 100% certain about.
Bypass Resistance #
Handles common evasion:
| Technique | Example | Result |
|---|---|---|
| Leetspeak | f0ck, sh1t | Blocked |
| Spacing | f.u.c.k | Blocked |
| Character repeat | fuuuck | Blocked |
Limitations #
This filter is NOT:
- AI/ML - It's pattern matching
- 100% comprehensive - New bypasses need manual updates
- Multi-language - English-focused
Recommendation: Use as first-pass filter for names/titles. For chat, add human review.
Installation #
dependencies:
mofilo_content_filter: ^1.0.8
API #
// Main check
ContentFilter.check(text) → ContentFilterResult
// Convenience methods
ContentFilter.validateFoodName(name)
ContentFilter.validateAll(foodName: x, brandName: y)
Result #
result.isAllowed // true if safe
result.isBlocked // true if blocked
result.reason // blocking reason (if blocked)
Contributing #
Found a false positive or bypass? Open an issue or PR.
License #
MIT - See LICENSE