BogaNet.BadWordFilter
0.9.0-alpha3
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
<PackageReference Include="BogaNet.BadWordFilter" Version="0.9.0-alpha3" />
paket add BogaNet.BadWordFilter --version 0.9.0-alpha3
#r "nuget: BogaNet.BadWordFilter, 0.9.0-alpha3"
// 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
- Pacifier: Combines all filters into one.
- BadWordFilter: Filter to remove bad words aka profanity.
- DomainFilter: Filter to remove domains (urls/emails etc.).
- CapitalizationFilter: Filter to remove excessive capitalization.
- PunctuationFilter: Filter to remove excessive punctuation.
// 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:
API:
https://www.crosstales.com/media/data/BogaNet/api/
GitHub:
Product | Versions 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. |
-
net8.0
- BogaNet.Common (>= 1.4.0)
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.