Edi.WordFilter 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.

Showing the top 20 packages that depend on Edi.WordFilter.

Packages Downloads
MoongladePure.Comments
Package Description
12
MoongladePure.Comments
Package Description
9
MoongladePure.Comments
Package Description
7

.NET 6.0

  • No dependencies.

.NET 8.0

  • No dependencies.

Version Downloads Last updated
2.5.0 113 11/13/2024
2.4.0 87 08/28/2024
2.3.0 239 03/26/2024
2.2.0 6 04/29/2024
2.1.0 5 04/29/2024
2.0.1 6 04/29/2024
2.0.0 5 04/29/2024
1.8.0 5 04/29/2024
1.7.1 5 04/11/2024
1.7.0 6 04/29/2024
1.6.1 6 04/29/2024
1.6.0 5 04/29/2024
1.5.0 6 04/29/2024
1.4.0 6 04/29/2024
1.3.1 7 04/29/2024
1.3.0 7 04/29/2024
1.2.3 5 04/29/2024
1.2.2 6 04/29/2024
1.2.1 5 04/29/2024
1.2.0 4 04/29/2024
1.1.0 6 04/29/2024
1.0.0 5 04/29/2024