Skip to content

killtw/lemonade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Sensitive word filter written in Golang.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published