Skip to content
Go 实现的 AC 自动机
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml
ReadMe.md
ac.go
ac_test.go

ReadMe.md

goAcAutoMachine

Build Status GoDoc

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 by zheng-ji released under MIT License.

You can’t perform that action at this time.