Edi.WordFilter 1.8.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Edi.WordFilter --version 1.8.0                
NuGet\Install-Package Edi.WordFilter -Version 1.8.0                
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="Edi.WordFilter" Version="1.8.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Edi.WordFilter --version 1.8.0                
#r "nuget: Edi.WordFilter, 1.8.0"                
#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 Edi.WordFilter as a Cake Addin
#addin nuget:?package=Edi.WordFilter&version=1.8.0

// Install Edi.WordFilter as a Cake Tool
#tool nuget:?package=Edi.WordFilter&version=1.8.0                

Edi.WordFilter

Module used in my blog system to filter dirty words (e.g. insulting languages, impertinent words)

It uses Dictionary to filter content very quickly.

.NET Build Linux

NuGet

Usage

1.Prepare a text file with banned words, for example splitted by "|". Like this:

fuck|shit|ass

Because I still want to live, I can't give you the entire keywords list, sorry for that.

2.Install from NuGet:

Install-Package Edi.WordFilter

3.Use it like this:

var wordFilterDataFilePath = $"{AppDomain.CurrentDomain.GetData(Constants.DataDirectory)}\\BannedWords.txt";
var maskWordFilter = new MaskWordFilter(wordFilterDataFilePath);
username = maskWordFilter.FilterContent(username);
commentContent = maskWordFilter.FilterContent(commentContent);

4.The disharmony words will be replaced by "*"

Design Details

Split disharmony word into Dictionary, Key points to the first character, Value points to the next character where Value itself is the Key of the next Dictionary. When filtering content, begin search with the first Dictionary, if matching double side, then it is a disharmony word.

For example, given disharmony word "FUCK,FS,ABC", the following structure is created:

image

Each blue box represents a Dictionary, each character of the disharmony word is stored as the Key and pointing to the next Dictionary.

For example, if user input "FUCK FAKE", the flow is:

"F" can be found in the first level of Dictionary(H0), "U" can be found in the Dictionary(H1) where H1's value is reffered to, like this, C and K can be found in H2 and H3, so "FUCK" is a disharmony word.

For the word "FAKE", although "F" can be found in Dictionary(H0), but H0 does not have a value pointing to "A", and "A" also don't have "K" sits in it's value, and "K" also does not exists in the first level of Dictionary, so "FAKE" is not a disharmony word.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.0 149 11/13/2024
2.4.0 138 8/27/2024
2.3.0 310 1/3/2024
2.2.0 134 12/17/2023
2.1.0 111 12/15/2023
2.0.1 109 12/14/2023
2.0.0 122 12/14/2023
1.8.0 158 10/11/2023
1.7.1 117 10/10/2023
1.7.0 2,404 11/9/2022
1.6.1 2,880 8/6/2022
1.6.0 1,665 10/21/2021
1.5.0 430 9/14/2021
1.4.0 3,376 12/18/2020
1.3.1 576 11/27/2020
1.3.0 580 11/11/2020
1.2.3 2,417 2/25/2020
1.2.2 682 12/5/2019
1.2.1 652 10/21/2019
1.2.0 1,132 4/23/2019
1.1.0 954 12/2/2018
1.0.0 717 11/7/2018