【文件属性】:
文件名称:aho-corasick:Go中的Aho-Corasick字符串搜索算法
文件大小:4.84MB
文件格式:ZIP
更新时间:2021-05-19 01:19:46
Go
Aho-Corasick
Go中Aho-Corasick字符串搜索算法的实现。
根据MIT许可获得许可。
细节
从几年前的,此实现就没有使用 。
这大大减少了构建时间,但以更高的内存消耗为代价。
搜索时间仍然很快,并且可以与我在github上发现的其他声称快的Go实现相媲美(请参阅 )。
文献资料
可以在上找到。
用法示例
使用TrieBuilder来构建Trie :
trie := NewTrieBuilder ().
AddStrings ([] string { "or" , "amet" }).
Build ()
然后去匹配一些有趣的东西:
matches := trie . MatchString ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit." )
fmt . Printf
【文件预览】:
aho-corasick-master
----match.go(1KB)
----go.mod(51B)
----go.sum(1B)
----trie.go(2KB)
----stream_test.go(2KB)
----.travis.yml(29B)
----builder.go(4KB)
----LICENSE(1KB)
----README.md(3KB)
----builder_test.go(1KB)
----test_data()
--------opphavsrett.txt(2KB)
--------NSF-ordlisten.txt(10.97MB)
--------Ibsen.txt(199KB)
--------strings.txt(91B)
--------NSF-ordlisten.cleaned.txt(7.61MB)
--------NSF-ordlisten.cleaned.uniq.txt(7.38MB)
--------patterns.txt(169B)
--------gpl.txt(34KB)
----stream.go(3KB)
----trie_test.go(6KB)