Documentation
¶
Overview ¶
Package da implements the double array library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoubleArray ¶
type DoubleArray []struct { Base, Check int32 }
DoubleArray represents the TRIE data structure.
func Build ¶
func Build(keywords []string) (DoubleArray, error)
Build constructs a double array from given keywords.
func BuildWithIDs ¶
func BuildWithIDs(keywords []string, ids []int) (DoubleArray, error)
BuildWithIDs constructs a double array from given keywords and ids.
func (DoubleArray) CommonPrefixSearch ¶
func (d DoubleArray) CommonPrefixSearch(input string) (ids, lens []int)
CommonPrefixSearch finds keywords sharing common prefix in an input and returns the ids and it's lengths if found.
func (DoubleArray) Find ¶
func (d DoubleArray) Find(input string) (id int, ok bool)
Find searches TRIE by a given keyword and returns the id if found.
func (DoubleArray) PrefixSearch ¶
func (d DoubleArray) PrefixSearch(input string) (id int, ok bool)
PrefixSearch returns the longest commom prefix keyword in an input if found.
Click to show internal directories.
Click to hide internal directories.