Mofilo Content Filter

Multi-layer content filtering for Flutter apps. Blocks offensive language, hate speech, and harmful content with 12+ detection layers.

pub package License: MIT


Quick Start

import 'package:mofilo_content_filter/mofilo_content_filter.dart';

// Check any text input
final result = ContentFilter.check(userInput);

if (result.isBlocked) {
  showError('This content is not allowed');
} else {
  submitContent(userInput);
}

That's it! The filter handles the rest.


Features

  • ๐Ÿ›ก๏ธ 12+ Detection Layers - Catches sophisticated bypass attempts
  • ๐ŸŒ Multi-Language - English, Spanish, French, German, Polish, Russian, Portuguese, Italian, Dutch
  • โšก Fast & Offline - <5ms latency, no external API calls
  • ๐Ÿ”’ Privacy-Friendly - All processing happens locally
  • ๐ŸŽฏ Comprehensive - Profanity, slurs, hate speech, violence, CSAM, terrorism, grooming
  • ๐Ÿงช Well-Tested - 1000+ comprehensive tests with 92%+ pass rate
  • ๐Ÿ” Child Safety Focus - Advanced grooming and CSAM detection

Installation

Add to your pubspec.yaml:

dependencies:
  mofilo_content_filter: ^1.0.6

Then run:

flutter pub get

Usage Examples

import 'package:mofilo_content_filter/mofilo_content_filter.dart';

final result = ContentFilter.check("chocolate cake");

if (result.isBlocked) {
  print('Blocked: ${result.reason}');
  print('Severity: ${result.severity}');
} else {
  print('Content is safe!');
}

Validate Food Names

final result = ContentFilter.validateFoodName("apple pie");

if (result.isAllowed) {
  saveFoodName("apple pie");
}

Validate Multiple Fields

final results = ContentFilter.validateAll(
  foodName: "pizza",
  brandName: "Pizza Hut",
);

if (results.isEmpty) {
  // All fields are safe
  saveToDatabase();
} else {
  // Show which fields failed
  results.forEach((field, result) {
    print('$field: ${result.reason}');
  });
}

What Gets Blocked

Language-Based Content

  • Profanity and vulgar language
  • Racial, ethnic, and religious slurs
  • Homophobic and transphobic slurs
  • Sexist and misogynistic language
  • Ableist slurs

Harmful Content

  • Hate speech and Nazi/white supremacy symbols
  • Terrorism and extremism references
  • Self-harm and suicide encouragement
  • Child abuse (CSAM) references
  • Sexual harassment and violence
  • Drug references

Advanced Bypass Detection

Defends against sophisticated bypass techniques:

  1. Character Substitution - l33tspeak (f0ck, sh1t), symbols (@ss, f*ck)
  2. Spacing/Separators - f.u.c.k, f-u-c-k, f u c k
  3. Unicode Tricks - Cyrillic (ั„uck), fullwidth (๏ฝ†๏ฝ•๏ฝƒ๏ฝ‹), circled (โ“•โ“คโ“’โ“š)
  4. Zero-Width Characters - Invisible Unicode characters
  5. Emojis - f๐Ÿ˜€u๐Ÿ˜€c๐Ÿ˜€k
  6. Encoding - Base64, ROT13, Hex, reversed text
  7. Mixed Case - FuCk, FUCK, fUcK
  8. Asterisks - fk, ner
  9. Homoglyphs - Visually similar characters
  10. Fuzzy Spelling - Levenshtein distance matching

Best Practices & Limitations

โœ… Best Used For:

  • Food names and brand names
  • Product titles and descriptions
  • Usernames and display names
  • Form inputs with limited scope
  • First-pass content filtering

โš ๏ธ Important to Know:

This is a first-line defense tool. Like all automated filters, it's not perfect:

  • Not 100% accurate - May produce false positives or miss some content
  • Context matters - Best for names/titles, not ideal for full conversations
  • Human review recommended - Especially for chat, comments, and user-generated content
  • Best practices - Use as your first filter, add human moderation as backup

For comprehensive content moderation, combine this filter with:

  • User reporting system
  • Human review queue for flagged content
  • Regular monitoring and updates

See DISCLAIMER.md for complete details.


Result Object

class ContentFilterResult {
  final bool isAllowed;          // Whether content passes filter
  final bool isBlocked;           // Opposite of isAllowed
  final String? reason;           // Reason for blocking (if blocked)
  final List<String> violations;  // Specific violations found
  final ContentFilterSeverity severity;
}

enum ContentFilterSeverity {
  none,      // Content is safe
  low,       // Suspicious but might be legitimate
  medium,    // Likely violation
  high,      // Definite violation
  critical,  // Severe violation (slurs, hate speech, CSAM)
}

Performance

  • โšก Latency: <5ms on average
  • ๐Ÿ”’ Privacy: All processing happens locally, no external APIs
  • ๐Ÿ“ฑ Offline: Works without internet connection
  • ๐Ÿงช Tested: 870+ comprehensive tests across bypass techniques

Use Cases

Companies Using This

Great for apps that need content filtering for:

  • Food & recipe apps (filter inappropriate food names)
  • E-commerce platforms (filter product names)
  • Social platforms (filter usernames, bio text)
  • Gaming platforms (filter clan names, character names)
  • Business directories (filter business names)

MIT License - Copyright (c) 2025 Mofilo

This software is provided "AS IS" without warranty of any kind. See LICENSE for full terms.

Important: By using this package, you accept full responsibility for content moderation in your application. See DISCLAIMER.md for complete legal terms and limitations.

Libraries

content_filter
mofilo_content_filter
Mofilo Content Filter - A comprehensive content filtering package for Flutter