index/suffixarray

Package suffixarray implements substring search in logarithmic time using an in-memory suffix array.

Example use:

// create index for some data
index := suffixarray.New(data)

// lookup byte slice s
offsets1 := index.Lookup(s, -1) // the list of all indices where s occurs in data
offsets2 := index.Lookup(s, 3)  // the list of at most 3 indices where s occurs in data

API

type Index

    func New(data []byte) *Index
    func (x *Index) Bytes() []byte
    func (x *Index) FindAllIndex(r *regexp.Regexp, n int) (result [][]int)
    func (x *Index) Lookup(s []byte, n int) (result []int)
    func (x *Index) Read(r io.Reader) error
    func (x *Index) Write(w io.Writer) error

results matching ""

    No results matching ""