A sanitization-based swear filter for Go.
go get github.com/JoshuaDoes/gofuckyourself
package main
import (
"fmt"
swearfilter "github.com/JoshuaDoes/gofuckyourself"
)
var message = "This is a fûçking message with shitty swear words."
var swears = []string{"fuck", "shit"}
func main() {
filter := swearfilter.New(false, false, false, false, false, swears...)
swearFound, swearsFound, err := filter.Check(message)
fmt.Println("Swear found: ", swearFound)
fmt.Println("Swears tripped: ", swearsFound)
fmt.Println("Error: ", err)
}
> go run main.go
Swear found: true
Swears tripped: [fuck shit]
Error: <nil>
The source code for gofuckyourself is released under the MIT License. See LICENSE for more details.
All donations are appreciated and help me stay awake at night to work on this more. Even if it's not much, it helps a lot in the long run!