Class OffensiveWordFilter.Builder
java.lang.Object
dev.getelements.elements.sdk.util.OffensiveWordFilter.Builder
- Enclosing class:
OffensiveWordFilter
Builder for constructing an OffensiveWordFilter with a list of offensive words.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds the default offensive words from the built-in properties file.Adds a word to the offensive word list.addWords(InputStream stream) Adds words from an InputStream containing properties to the offensive word list.addWords(Properties properties) Adds words from a Properties object to the offensive word list.build()Builds the OffensiveWordFilter instance.Configures the filter to ignore case when checking for offensive words.
-
Field Details
-
DEFAULT_OFFENSIVE_WORDS_PATH
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addWord
Adds a word to the offensive word list.- Parameters:
word- the word- Returns:
- the builder
-
addWords
Adds words from a Properties object to the offensive word list.- Parameters:
properties- the properties containing words and their edit distances- Returns:
- the builder
-
addWords
Adds words from an InputStream containing properties to the offensive word list.- Parameters:
stream- the input stream- Returns:
- the builder
- Throws:
IOException- if an I/O error occurs
-
addDefaultWords
Adds the default offensive words from the built-in properties file.- Returns:
- the builder
-
ignoringCase
Configures the filter to ignore case when checking for offensive words.- Returns:
- the builder
-
build
Builds the OffensiveWordFilter instance.- Returns:
- the OffensiveWordFilter
-