패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.0.0

profanity_filter

비속어 및 음란어에 대해 문자열을 확인하고 검열하는 간단한 필터입니다. 기본 영어 단어 목록(LDNOOBW)이 제공됩니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.7만
좋아요
119
Pub 점수
160

패키지 설치

flutter pub add profanity_filter

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

내장된 영어 단어 목록(LDNOOBW)을 사용하여 문자열의 부적절한 표현을 검사하고 차단하는 가벼운 Flutter/Dart 패키지입니다. 공격적인 언어를 식별하고 대체함으로써 앱 내에서 존중받는 소통을 유지하는 데 도움이 됩니다. 사용자 생성 콘텐츠 모니터링, 채팅 애플리케이션 또는 텍스트 필터링이 필요한 모든 상황에 이상적입니다. 패키지는 쉽게 통합 가능하며 모바일, 웹, 데스크톱 등 다양한 플랫폼을 지원합니다.

사용 사례

  • 사용자 댓글 관리
  • 채팅 애플리케이션 필터링
  • 양식 내 콘텐츠 안전성
  • 실시간 메시지 스크리닝
  • 자동 텍스트 정리

주요 기능

  • 내장 영어 욕설 목록
  • 간단한 문자열 검사 및 감시
  • 사용자 정의 단어 목록
  • 크로스 플랫폼 지원
  • Flutter와의 간편한 통합

적합한 대상

  • 콘텐츠 안전성을 우선시하는 앱 개발자
  • 채팅 또는 소셜 미디어 앱
  • 사용자 입력을 위한 모더레이션 도구
  • 교육용 또는 가족 친화적인 앱
  • 공개 댓글 섹션이 있는 앱

고려 사항

  • 기본적으로 영어로 제한됨
  • 사용자 정의 단어 목록 업데이트가 필요할 수 있습니다
  • 검열 정확도는 단어 목록의 완전성에 달려 있다
  • 사전 맞춤 설정 없이 다국어 콘텐츠에 적합하지 않습니다
  • 맥락 민감 단어로 인한 잠재적 오진

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

profanity_filter

Dart CI

Pub Version

Simple Dart class to create filters with methods to check and censor strings against profanity. A default English words list is provided (from LDNOOBW on GitHub).

You can also use the filters to filter out a custom set of words, by using the ProfanityFilter.filterOnly() constructor.

Usage

To use this plugin, add profanity_filter as a dependency in your pubspec.yaml file.

Note: The latest version of the package is null-safe. The last package version that wasn't null-safe is 1.0.4

Example
import 'package:profanity_filter/profanity_filter.dart';

void main() {
  //Create the filter with the default constructor.
  //The default constructor uses the default list of words provided by [LDNOOBW on GitHub](
  //https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words)
  //Other constructors are available, see [README.md](https://pub.dev/packages/profanity_filter).
  final filter = ProfanityFilter();

  //This string contains the profanity 'ass'
  String badString = 'You are an ass';

  //Check for profanity - returns a boolean (true if profanity is present)
  bool hasProfanity = filter.hasProfanity(badString);
  print('The string $badString has profanity: $hasProfanity');

  //Get the profanity used - returns a List<String>
  List<String> wordsFound = filter.getAllProfanity(badString);
  print('The string contains the words: $wordsFound');

  //Censor the string - returns a 'cleaned' string.
  String cleanString = filter.censor(badString);
  print('Censored version of "$badString" is "$cleanString"');
}

Methods

hasProfanity - Detect if a string contains profanity

Use the hasProfanity() method of the filter instance. Pass in the string to be tested.

Example
final filter = ProfanityFilter();
String badString = 'you are an ass';
filter.hasProfanity(badString); //Returns true.
getAllProfanity - Get a list of all profane words found

Use the getAllProfanity() method of the filter instance. Pass in the string to be tested.

Example

final filter = ProfanityFilter();
String badString = 'you are an ass';
List<String> wordsFound = filter.getAllProfanity(badString); //Returns ['ass']
censor - Censor a string (replace profanity with something clean)

Use the censor() method of the filter instance. Pass in the string to be censored.

Example
final filter = ProfanityFilter();
String badString = 'you are an ass';
String cleanString = filter.censor('you are an ass'); //cleanString: 'you are an ***'

Optionally, you can provide your own clean replacement word to the replaceWith named parameter. filter.censor(string, replaceWith:'[censored]') will replace any profanity in string with [censored]

Default Profanity List

The default profanity list is taken from the LDNOOBW list, licensed under a Creative Commons Attribution 4.0 International License.

To create a filter with the default list, use the default constructor ProfanityFilter()

Variations
To include custom words alongside default list

Use ProfanityFilter.filterAdditionally() constructor and pass your list of custom words.

This will use a list which is equivalent to Default List + Custom List

To filter only custom words (default list is ignored)

Use ProfanityFilter.filterOnly() constructor and pass a list containing your custom set of words.

This will use a list which is equivalent to Custom List

To filter with a few exclusions from default list

Use ProfanityFilter.ignore() constructor and pass your list of custom words. Those words will be removed from the default list if they exist there.

This will use a list which is equivalent to Default List - Custom List

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트