goAcAutoMachine:Go 實現的 AC 自動機
goAcAutoMachine
Go 實現多模式字串匹配的 AC 自動機
Install
go get "github.com/zheng-ji/goAcAutoMachine"
Example
package main import ( "fmt" "github.com/zheng-ji/goAcAutoMachine" ) func main() { ac := goAcAutoMachine.NewAcAutoMachine() ac.AddPattern("紅領巾") ac.AddPattern("祖國") ac.AddPattern("花朵") ac.Build() content := "我是紅領巾,祖國未來的花朵" results := ac.Query(content) for _, result := range results { fmt.Println(result) } }
License
Copyright (c) 2019 byzheng-ji released under MIT License.