Documentation
¶
Index ¶
- type DoubleArray
- func (d *DoubleArray) Build(keywords []string) (err error)
- func (d *DoubleArray) BuildWithIds(keywords []string, ids []int) (err error)
- func (d *DoubleArray) CommonPrefixSearch(r Reader) (ids, lens []int)
- func (d *DoubleArray) Find(r Reader) (id int, ok bool)
- func (d *DoubleArray) PrefixSearch(r Reader) (id int, ok bool)
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoubleArray ¶
type DoubleArray []struct {
Base, Check int
}
DoubleArray represents the TRIE data structure.
func (*DoubleArray) Build ¶
func (d *DoubleArray) Build(keywords []string) (err error)
Build constructs a double array from given keywords.
func (*DoubleArray) BuildWithIds ¶
func (d *DoubleArray) BuildWithIds(keywords []string, ids []int) (err error)
BuildWithIds constructs a double array from given keywords and ids.
func (*DoubleArray) CommonPrefixSearch ¶
func (d *DoubleArray) CommonPrefixSearch(r Reader) (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(r Reader) (id int, ok bool)
Find searches TRIE by a given keyword and returns the id if found.
func (*DoubleArray) PrefixSearch ¶
func (d *DoubleArray) PrefixSearch(r Reader) (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.