lemonade

command module
v0.0.0-...-b29e16e Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: MIT Imports: 5 Imported by: 0

README

lemonade

A sensitive word filter service based on DFA

Install

go get -u -v github.com/killtw/lemonade

Usage

package main

import (
	"fmt"
	"github.com/killtw/lemonade/lemonade"
	"log"
)

func main() {
	if err := lemonade.InitTrie(); err != nil {
		log.Fatalln(err)
	}

	lemonade.Add("test")

	f1, m1 := lemonade.Replace("123test321")
	fmt.Printf("filtered: %s, matches: %s\n", f1, m1)

	f2, m2 := lemonade.Replace("123te!@#$%st321")
	fmt.Printf("filtered: %s, matches: %s\n", f2, m2)
}
Output
filtered: 123****321, matches: [test]
filtered: 123*********321, matches: [te!@#$%st]

Credits

License

The MIT License (MIT). Please see License File for more information.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
rpc

Jump to

Keyboard shortcuts

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