Documentation
¶
Overview ¶
package tree provides a succinct trie containing a set of strings
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { // Add adds a key to the WX // A duplicatad key is removed. Add(key string) // Build builds a WX (Builder is not changed) Build() WX // Num returns the number of registered keys Num() uint64 // TotalByteNum returns the number of bytes of keys. TotalByteNum() uint64 }
Builder is used for building WX.
func NewBuilder ¶
func NewBuilder() Builder
type WX ¶
type WX interface { // ExactMatch examines whether the query exactly matches to any string in WX, // and returns (id, true) if found, or return (0, false) ExactMatch(str string) (id uint64, ok bool) // LongestPrefixMatch returns the longest key that matches the prefix of query. LongestPrefixMatch(str string) (ret WXString, ok bool) // CommonPrefixMatch returns the all keys that match the prefix of the query CommonPrefixMatch(str string) (ret []WXString) // CommonPrefixMatch returns the all keys that match the prefix of the query // limit indicates the maximum number of matched keys. CommonPrefixMatchWithLimit(str string, limit uint64) (ret []WXString) // PredictiveMatch returns the all keys whose prefix matches to the query PredictiveMatch(str string) (ids []uint64) // PredictiveMatchWithLimit returns the all keys whose prefix matches to the query // limit indicates the maximum number of matched keys PredictiveMatchWithLimit(str string, limit uint64) (ids []uint64) // Get returns the key with ID. Get(id uint64) string // Num returns the number of keys Num() uint64 // MarshalBinary encodes WX into a binary form and returns the result. MarshalBinary() ([]byte, error) // UnmarshalBinary decodes WX from a binary form generated MarshalBinary UnmarshalBinary([]byte) error // contains filtered or unexported methods }
WX represents a trie containing a set of strings Given a query Q of length m, WX supports various operations on trie in O(m) time. WX is built by using Builder function
Directories
¶
Path | Synopsis |
---|---|
pkg
|
|
fixvec
package fixvec provides a vector representation of value using fixed bits
|
package fixvec provides a vector representation of value using fixed bits |
rsdic
Package rsdic provides a rank/select dictionary supporting many basic operations in constant time using very small working space (smaller than original).
|
Package rsdic provides a rank/select dictionary supporting many basic operations in constant time using very small working space (smaller than original). |
vecstring
package vecstring provides a space-efficient representation of a vector of strings of variable length.
|
package vecstring provides a space-efficient representation of a vector of strings of variable length. |
Click to show internal directories.
Click to hide internal directories.