Namespace: go.std.index.suffixarray
v1.0Contents
Summary
Provides a low-level interface to the index/suffixarray package.
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
Index
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
New
Function v1.0(New data)
New creates a new Index for data.
Index creation time is O(N) for N = len(data).
Go input arguments: (data []byte)
Go returns: *Index
Joker input arguments: [^arrayOfByte data]
Joker returns: ^*Index
Types
-
*Index
Concrete Type v1.0Index implements a suffix array for fast substring search.
-
Bytes
Receiver for *Index v1.0([])
Bytes returns the data over which the index was created.
It must not be modified.
-
FindAllIndex
Receiver for *Index v1.0([r n])
FindAllIndex returns a sorted list of non-overlapping matches of the
regular expression r, where a match is a pair of indices specifying
the matched slice of x.Bytes(). If n < 0, all matches are returned
in successive order. Otherwise, at most n matches are returned and
they may not be successive. The result is nil if there are no matches,
or if n == 0.
-
Lookup
Receiver for *Index v1.0([s n])
Lookup returns an unsorted list of at most n indices where the byte string s
occurs in the indexed data. If n < 0, all occurrences are returned.
The result is nil if s is empty, s is not found, or n == 0.
Lookup time is O(log(N)*len(s) + len(result)) where N is the
size of the indexed data.
-
Read
Receiver for *Index v1.0([r])
Read reads the index from r into x; x must not be nil.
-
Write
Receiver for *Index v1.0([w])
Write writes the index x to w.
-
Index
Concrete Type v1.0Index implements a suffix array for fast substring search.
-
arrayOfIndex
Concrete Type v1.0Index implements a suffix array for fast substring search.