thai_profanity_filter 0.1.0 copy "thai_profanity_filter: ^0.1.0" to clipboard
thai_profanity_filter: ^0.1.0 copied to clipboard

Thai-aware profanity filter: detect, censor, and score Thai bad words with evasion handling (spacing, repeats, zero-width) and a false-positive allow-list, dependency-free pure Dart.

example/thai_profanity_filter_example.dart

import 'package:thai_profanity_filter/thai_profanity_filter.dart';

void main() {
  final filter = ThaiProfanityFilter();

  // 1. Detection
  print(filter.hasProfanity('ไอ้ควย')); // true
  print(filter.isClean('สวัสดีครับ ยินดีต้อนรับ')); // true

  // 2. False-positive guard — หีบ ("chest") contains หี but is not profane.
  print(filter.hasProfanity('เปิดหีบสมบัติ')); // false

  // 3. Evasion handling (on by default).
  print(filter.hasProfanity('เหี้ยยยย')); // true (repeated chars collapsed)
  print(filter.hasProfanity('ค ว ย')); // true (spaced letters joined)

  // 4. Censor, keeping the surrounding clean text.
  print(filter.censor('เอ๊ย ไอ้ควย')); // 'เอ๊ย ไอ้***'

  // 5. Inspect matches with positions and severity.
  for (final m in filter.findMatches('มึงมันเหี้ยจริงๆ')) {
    print('${m.word}  [${m.start}..${m.end}]  ${m.severity}');
  }

  // 6. Strict mode — ignore the mild rude pronouns.
  final strict = ThaiProfanityFilter(minSeverity: Severity.moderate);
  print(strict.isClean('มึงกับกู')); // true
  print(strict.hasProfanity('ควย')); // true
}
0
likes
150
points
4
downloads

Documentation

API reference

Publisher

verified publisher10v3n4m.cc

Weekly Downloads

Thai-aware profanity filter: detect, censor, and score Thai bad words with evasion handling (spacing, repeats, zero-width) and a false-positive allow-list, dependency-free pure Dart.

Repository (GitHub)
View/report issues

Topics

#thai #profanity #moderation #text-filter #i18n

License

MIT (license)

More

Packages that depend on thai_profanity_filter