add keywords utility example
parent
22e75cdf78
commit
418f8f6666
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
@ -0,0 +1,21 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/tal-tech/go-zero/core/stringx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
filter := stringx.NewTrie([]string{
|
||||||
|
"AV演员",
|
||||||
|
"苍井空",
|
||||||
|
"AV",
|
||||||
|
"日本AV女优",
|
||||||
|
"AV演员色情",
|
||||||
|
}, stringx.WithMask('?'))
|
||||||
|
safe, keywords, found := filter.Filter("日本AV演员兼电视、电影演员。苍井空AV女优是xx出道, 日本AV女优们最精彩的表演是AV演员色情表演")
|
||||||
|
fmt.Println(safe)
|
||||||
|
fmt.Println(keywords)
|
||||||
|
fmt.Println(found)
|
||||||
|
}
|
Loading…
Reference in New Issue