Package cedar
implementes double-array trie and aho corasick
It is implements the cedar and paper by golang.
go get -u github.com/vcaesar/cedar
package main
import (
"fmt"
"github.com/vcaesar/cedar"
)
func main() {
// Create a new cedar trie.
d := cedar.New()
d.Insert([]byte("ab"), 1)
d.Insert([]byte("abc"), 2)
d.Insert([]byte("abcd"), 3)
fmt.Println(d.Jump([]byte("ab"), 0))
fmt.Println(d.Find([]byte("bc"), 0))
fmt.Println(d.PrefixMatch([]byte("bc"), 0))
fmt.Println(d.ExactMatch([]byte("ab")))
}
This is released under the BSD-2 license, following the original license of C++ cedar.