Crosstales.BWF.Filter.BadWordFilter Class Reference

Filter for bad words. The class can also replace all bad words inside a string. More...

Inheritance diagram for Crosstales.BWF.Filter.BadWordFilter:
Crosstales.BWF.Filter.BaseFilter Crosstales.BWF.Filter.IFilter

Public Member Functions

 BadWordFilter (System.Collections.Generic.List< BadWordProvider > badWordProviderLTR, System.Collections.Generic.List< BadWordProvider > badWordProviderRTL, string replaceCharacters="*", ReplaceMode mode=ReplaceMode.Default, bool simpleCheck=false, bool removeSpaces=false, bool disableOrdering=false, string removeCharacters="")
 Instantiate the class. More...
 
override bool Contains (string text, params string[] sourceNames)
 Searches for bad words in a text. More...
 
override System.Collections.Generic.List< string > GetAll (string text, params string[] sourceNames)
 Searches for bad words in a text. More...
 
override string ReplaceAll (string text, bool markOnly=false, string prefix="", string postfix="", params string[] sourceNames)
 Searches and replaces all bad words in a text. More...
 
- Public Member Functions inherited from Crosstales.BWF.Filter.BaseFilter
 BaseFilter (bool disableOrdering)
 Instantiate the class. More...
 
virtual string Unmark (string text, string prefix="<b><color=red>", string postfix="</color></b>")
 Unmarks the text with a prefix and postfix. More...
 
virtual string Mark (string text, bool replace=false, string prefix="<b><color=red>", string postfix="</color></b>", params string[] sourceNames)
 Marks the text with a prefix and postfix. More...
 

Public Attributes

string ReplaceCharacters
 Replace characters for bad words. More...
 
ReplaceMode Mode
 Replace mode operations on the input string. More...
 
bool RemoveSpaces
 Remove unnecessary spaces between letters in the input string. More...
 
int MaxTextLength = 3
 Maximal text length for the space detection. More...
 
string RemoveCharacters
 Remove unnecessary characters from the input string. More...
 
bool SimpleCheck
 Use simple detection algorithm. More...
 
- Public Attributes inherited from Crosstales.BWF.Filter.BaseFilter
bool DisableOrdering
 

Protected Member Functions

string replaceText (string input)
 

Properties

System.Collections.Generic.List< BadWordProvider >? BadWordProviderLTR [get, set]
 List of all left-to-right providers. More...
 
System.Collections.Generic.List< BadWordProvider >? BadWordProviderRTL [get, set]
 List of all right-to-left providers. More...
 
override bool?? isReady [get]
 Checks the readiness status of the filter. More...
 
- Properties inherited from Crosstales.BWF.Filter.BaseFilter
virtual System.Collections.Generic.List< SourceSources [get]
 
abstract bool isReady [get]
 
- Properties inherited from Crosstales.BWF.Filter.IFilter
System.Collections.Generic.List< Crosstales.BWF.Data.SourceSources [get]
 All sources of the current filter. More...
 
bool isReady [get]
 Checks the readiness status of the current filter. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Crosstales.BWF.Filter.BaseFilter
static void logFilterNotReady ()
 
static void logResourceNotFound (string res)
 
static void logContains ()
 
static void logGetAll ()
 
static void logReplaceAll ()
 
- Protected Attributes inherited from Crosstales.BWF.Filter.BaseFilter
readonly System.Collections.Generic.Dictionary< string, Source_sources = new System.Collections.Generic.Dictionary<string, Source>()
 
readonly System.Collections.Generic.List< string > _getAllResult = new System.Collections.Generic.List<string>()
 

Detailed Description

Filter for bad words. The class can also replace all bad words inside a string.

Constructor & Destructor Documentation

◆ BadWordFilter()

Crosstales.BWF.Filter.BadWordFilter.BadWordFilter ( System.Collections.Generic.List< BadWordProvider badWordProviderLTR,
System.Collections.Generic.List< BadWordProvider badWordProviderRTL,
string  replaceCharacters = "*",
ReplaceMode  mode = ReplaceMode.Default,
bool  simpleCheck = false,
bool  removeSpaces = false,
bool  disableOrdering = false,
string  removeCharacters = "" 
)

Instantiate the class.

Parameters
badWordProviderLTRList of all left-to-right providers.
badWordProviderRTLList of all right-to-left providers.
replaceCharactersReplace characters for bad words (default: *, optional).
modeReplace mode operations on the input string (default: Default, optional).
simpleCheckUse simple detection algorithm (default: false, optional).
removeSpacesRemove unnecessary spaces between letters in the input string (default: false, optional).
disableOrderingDisables the ordering of the 'GetAll'-method (default: false, optional).
removeCharactersRemove unnecessary characters from the input string (default: empty, optional).

Member Function Documentation

◆ Contains()

override bool Crosstales.BWF.Filter.BadWordFilter.Contains ( string  text,
params string[]  sourceNames 
)
virtual

Searches for bad words in a text.

Parameters
textText to check
sourceNamesRelevant sources (e.g. "english", optional)
Returns
True if a match was found

Implements Crosstales.BWF.Filter.BaseFilter.

◆ GetAll()

override System.Collections.Generic.List<string> Crosstales.BWF.Filter.BadWordFilter.GetAll ( string  text,
params string[]  sourceNames 
)
virtual

Searches for bad words in a text.

Parameters
textText to check
sourceNamesRelevant sources (e.g. "english", optional)
Returns
List with all the matches

Implements Crosstales.BWF.Filter.BaseFilter.

◆ ReplaceAll()

override string Crosstales.BWF.Filter.BadWordFilter.ReplaceAll ( string  text,
bool  markOnly = false,
string  prefix = "",
string  postfix = "",
params string[]  sourceNames 
)
virtual

Searches and replaces all bad words in a text.

Parameters
textText to check
markOnlyOnly mark the words (default: false, optional)
prefixPrefix for every found bad word (optional)
postfixPostfix for every found bad word (optional)
sourceNamesRelevant sources (e.g. "english", optional)
Returns
Clean text

Implements Crosstales.BWF.Filter.BaseFilter.

Member Data Documentation

◆ MaxTextLength

int Crosstales.BWF.Filter.BadWordFilter.MaxTextLength = 3

Maximal text length for the space detection.

◆ Mode

ReplaceMode Crosstales.BWF.Filter.BadWordFilter.Mode

Replace mode operations on the input string.

◆ RemoveCharacters

string Crosstales.BWF.Filter.BadWordFilter.RemoveCharacters

Remove unnecessary characters from the input string.

◆ RemoveSpaces

bool Crosstales.BWF.Filter.BadWordFilter.RemoveSpaces

Remove unnecessary spaces between letters in the input string.

◆ ReplaceCharacters

string Crosstales.BWF.Filter.BadWordFilter.ReplaceCharacters

Replace characters for bad words.

◆ SimpleCheck

bool Crosstales.BWF.Filter.BadWordFilter.SimpleCheck

Use simple detection algorithm.

Property Documentation

◆ BadWordProviderLTR

System.Collections.Generic.List<BadWordProvider>? Crosstales.BWF.Filter.BadWordFilter.BadWordProviderLTR
getset

List of all left-to-right providers.

Returns
All left-to-right providers.

◆ BadWordProviderRTL

System.Collections.Generic.List<BadWordProvider>? Crosstales.BWF.Filter.BadWordFilter.BadWordProviderRTL
getset

List of all right-to-left providers.

Returns
All right-to-left providers.

◆ isReady

override bool?? Crosstales.BWF.Filter.BadWordFilter.isReady
get

Checks the readiness status of the filter.

Returns
True if the filter is ready.

The documentation for this class was generated from the following file:
  • C:/Users/slaub/Unity/assets/BWFPro/BWFPro/Assets/Plugins/crosstales/BadWordFilter/Scripts/Filter/BadWordFilter.cs