profane

package module
v0.0.0-...-d39b684 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2021 License: MIT Imports: 5 Imported by: 0

README

Profane

Go Reference

Profane checks for profanity and also provides an option to replace them.

package main

import (
	"log"

	"github.com/alextanhongpin/profane"
)

func main() {
	profane := profane.New()
	log.Println(profane.ReplaceGarbled("hello @ssh0l3"))              // hello $@!#%
	log.Println(profane.ReplaceStars("hello @ssh0l3"))                // hello a*****e
	log.Println(profane.ReplaceVowels("hello @ssh0l3"))               // hello *ssh*l*
	log.Println(profane.ReplaceCustom("hello @ssh0l3", "[CENSORED]")) // hello [CENSORED]
}

Installation

$ go get github.com/alextanhongpin/profane

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profane

type Profane struct {
	// contains filtered or unexported fields
}

func New

func New() *Profane

func (*Profane) Add

func (p *Profane) Add(words ...string)

Add adds a new words the profanity list.

func (*Profane) Has

func (p *Profane) Has(word string) bool

Has checks if the word is in the list.

func (*Profane) Match

func (p *Profane) Match(word string) bool

func (*Profane) Regexp

func (p *Profane) Regexp() *regexp.Regexp

func (*Profane) Remove

func (p *Profane) Remove(words ...string)

Remove remove a list of words from the profanity list.

func (*Profane) ReplaceCustom

func (p *Profane) ReplaceCustom(s, t string) string

ReplaceCustom replaces the profane word with the custom string.

func (*Profane) ReplaceGarbled

func (p *Profane) ReplaceGarbled(s string) string

ReplaceGarbled replaces profane words with $@!#%.

func (*Profane) ReplaceStars

func (p *Profane) ReplaceStars(s string) string

ReplaceStars replaces profane words with '*' up to the word's length.

func (*Profane) ReplaceVowels

func (p *Profane) ReplaceVowels(s string) string

ReplaceVowels replaces the vowels in the profane word with '*'.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL