Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NGramIndex ¶
type NGramIndex struct {
// contains filtered or unexported fields
}
NGramIndex can be initialized by default (zeroed) or created with "NewNgramIndex"
func NewNGramIndex ¶
func NewNGramIndex(opts ...Option) (*NGramIndex, error)
NewNGramIndex is N-gram index c-tor. In most cases must be used withot parameters. You can pass parameters to c-tor using functions SetPad, SetWarp and SetN.
func (*NGramIndex) Add ¶
func (ngram *NGramIndex) Add(input string, id TokenID) error
Add token to index. Function returns token id, this id can be converted to string with function "GetString".
func (*NGramIndex) BestMatch ¶
func (ngram *NGramIndex) BestMatch(input string, threshold ...float64) (*SearchResult, error)
BestMatch is the same as Search except that it's returning only one best result instead of all.
func (*NGramIndex) Search ¶
func (ngram *NGramIndex) Search(input string, threshold ...float64) ([]SearchResult, error)
Search for matches between query string (input) and indexed strings. First parameter - threshold is optional and can be used to set minimal similarity between input string and matching string. You can pass only one threshold value. Results is an unordered array of 'SearchResult' structs. This struct contains similarity value (float32 value from threshold to 1.0) and token-id.
type Option ¶
type Option func(*NGramIndex) error
type SearchResult ¶
SearchResult contains token id and similarity - value in range from 0.0 to 1.0