Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoubleArrayBuilder ¶
type DoubleArrayBuilder struct {
// contains filtered or unexported fields
}
DoubleArrayBuilder represents the builder of the double array.
func NewDoubleArrayBuilder ¶
func NewDoubleArrayBuilder(progress ProgressFunction) *DoubleArrayBuilder
NewDoubleArrayBuilder returns a builder of the double array with progress function. The parameter progress sets nil if no progress bar.
type DoubleArrayUint32 ¶
type DoubleArrayUint32 struct {
// contains filtered or unexported fields
}
DoubleArrayUint32 represents the TRIE data structure.
func BuildDoubleArray ¶
func BuildDoubleArray(keys []string, values []uint32, progress ProgressFunction) (*DoubleArrayUint32, error)
BuildDoubleArray constructs a double array from given keywords and values. The parameter values sets nil if no values.
func Open ¶
func Open(name string) (*DoubleArrayUint32, error)
Open opens the named file of the double array.
func (DoubleArrayUint32) CommonPrefixSearch ¶
func (a DoubleArrayUint32) CommonPrefixSearch(key string, offset int) ([][2]int, error)
CommonPrefixSearch finds keywords sharing common prefix in an input and returns the array of pairs (id and it's length) if found.
func (DoubleArrayUint32) CommonPrefixSearchCallback ¶
func (a DoubleArrayUint32) CommonPrefixSearchCallback(key string, offset int, callback func(id, size int)) error
CommonPrefixSearchCallback finds keywords sharing common prefix in an input and callback with id and it's length.
func (DoubleArrayUint32) ExactMatchSearch ¶
func (a DoubleArrayUint32) ExactMatchSearch(key string) (id, size int, err error)
ExactMatchSearch searches TRIE by a given keyword and returns the id and it's length if found.
type ProgressFunction ¶
type ProgressFunction interface { // SetMaximum sets the maximum of the progress bar. SetMaximum(int) // Increment with increase the current count on the progress bar. Increment() }
ProgressFunction indicates progress bar of building double array.