BogaNet.BadWordFilter 0.9.0-alpha3

This is a prerelease version of BogaNet.BadWordFilter.
There is a newer version of this package available.
See the version list below for details.
dotnet add package BogaNet.BadWordFilter --version 0.9.0-alpha3                
NuGet\Install-Package BogaNet.BadWordFilter -Version 0.9.0-alpha3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BogaNet.BadWordFilter" Version="0.9.0-alpha3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BogaNet.BadWordFilter --version 0.9.0-alpha3                
#r "nuget: BogaNet.BadWordFilter, 0.9.0-alpha3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BogaNet.BadWordFilter as a Cake Addin
#addin nuget:?package=BogaNet.BadWordFilter&version=0.9.0-alpha3&prerelease

// Install BogaNet.BadWordFilter as a Cake Tool
#tool nuget:?package=BogaNet.BadWordFilter&version=0.9.0-alpha3&prerelease                

BogaNet.BadWordFilter

The “Bad Word Filter” (aka profanity or obscenity filter) is a fresh implementation for .NET8 of the well-known Unity package BadWordFilter PRO and is exactly what the title suggests: a tool to filter swearwords and other “bad sentences”. The library already includes support for over 5’000 of regular expressions (equivalent to tens of thousands of word variations) in 25 languages: Arabic, Chinese, Czech, Danish, Dutch, English, Finnish, French, German, Greek, Hindi, Hungarian, Italian, Japanese, Korean, Norwegian, Persian, Polish, Portuguese, Russian, Spanish, Swedish, Thai, Turkish and Vietnamese.

Fell free to add any words and languages that are missing!

BWF also includes those additional filters:

  • Domains (URLs/emails)
  • Global bad words
  • Emojis (miscellaneous symbols)
  • Excessive capitalization
  • Excessive punctuation.

It supports any language and any writing system.

Main classes and example code

// load bad words for all left-to-right written languages
BadWordFilter.Instance.LoadFiles(true, BWFConstants.BWF_LTR);

// load bad words for all right-to-left written languages
BadWordFilter.Instance.LoadFiles(false, BWFConstants.BWF_RTL);

// load all domains to detect urls, emails etc.
DomainFilter.Instance.LoadFiles(BWFConstants.DOMAINS);

string foulText = "MARTIANS are assholes/arschlöcher!!!!!!!!!!  => WATCH: https//mytruthpage.com/weirdowatch/martians123.divx or WRITE an EMAIL: weirdo@gmail.com";

// does the text contain any bad words, domains, excessive capitalizations/punctuations?
bool contains = Pacifier.Instance.Contains(foulText);
Console.WriteLine("Contains: " + contains);

// get all bad words, domains and excessive capitalizations/punctuations
var allBaddies = Pacifier.Instance.GetAll(foulText);
Console.WriteLine(allBaddies.BNDump());

// replace all bad words, domains or excessive capitalizations/punctuations
string removedProfanity = Pacifier.Instance.ReplaceAll(foulText);
Console.WriteLine(removedProfanity);

Nuget:

BogaNet.BadWordFilter

API:

https://www.crosstales.com/media/data/BogaNet/api/

GitHub:

https://github.com/slaubenberger/BogaNet/

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BogaNet.BadWordFilter:

Package Downloads
BogaNet.Avalonia

Little helpers for Avalonia development.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.0 110 8/5/2024
0.9.0-alpha3 85 8/5/2024
0.9.0-alpha2 78 8/5/2024
0.9.0-alpha1 83 8/5/2024

Initial release.