Documentation ¶
Index ¶
- Constants
- func IsProfane(s string) bool
- type ProfanityDetector
- func (g *ProfanityDetector) IsProfane(s string) bool
- func (g *ProfanityDetector) WithSanitizeAccents(sanitize bool) *ProfanityDetector
- func (g *ProfanityDetector) WithSanitizeLeetSpeak(sanitize bool) *ProfanityDetector
- func (g *ProfanityDetector) WithSanitizeSpecialCharacters(sanitize bool) *ProfanityDetector
Constants ¶
const Space = " "
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ProfanityDetector ¶
type ProfanityDetector struct {
// contains filtered or unexported fields
}
ProfanityDetector
func NewProfanityDetector ¶
func NewProfanityDetector() *ProfanityDetector
NewProfanityDetector creates a new ProfanityDetector
func (*ProfanityDetector) IsProfane ¶
func (g *ProfanityDetector) IsProfane(s string) bool
IsProfane takes in a string (word or sentence) and look for profanities. Returns a boolean
func (*ProfanityDetector) WithSanitizeAccents ¶
func (g *ProfanityDetector) WithSanitizeAccents(sanitize bool) *ProfanityDetector
WithSanitizeAccents allows configuring of whether the sanitization process should also take into account accents. By default, this is set to true, but since this adds a bit of overhead, you may disable it if your use case is time-sensitive or if the input doesn't involve accents (i.e. if the input can never contain special characters)
func (*ProfanityDetector) WithSanitizeLeetSpeak ¶
func (g *ProfanityDetector) WithSanitizeLeetSpeak(sanitize bool) *ProfanityDetector
WithSanitizeLeetSpeak allows configuring whether the sanitization process should also take into account leetspeak
func (*ProfanityDetector) WithSanitizeSpecialCharacters ¶
func (g *ProfanityDetector) WithSanitizeSpecialCharacters(sanitize bool) *ProfanityDetector
WithSanitizeSpecialCharacters allows configuring whether the sanitization process should also take into account special characters