goAcAutoMachine:Go 实现的 AC 自动机

栏目: Go · 发布时间: 5年前

内容简介:Go 实现多模式字符串匹配的 AC 自动机Copyright (c) 2019 by

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


以上所述就是小编给大家介绍的《goAcAutoMachine:Go 实现的 AC 自动机》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Text Processing in Python

Text Processing in Python

David Mertz / Addison-Wesley Professional / 2003-6-12 / USD 54.99

Text Processing in Python describes techniques for manipulation of text using the Python programming language. At the broadest level, text processing is simply taking textual information and doing som......一起来看看 《Text Processing in Python》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具