MCPcopy
hub / github.com/dgraph-io/dgraph / BuildNGramQueryTokens

Function BuildNGramQueryTokens

tok/tok.go:122–132  ·  view source on GitHub ↗
(val interface{}, t NGramTokenizer)

Source from the content-addressed store, hash-verified

120}
121
122func BuildNGramQueryTokens(val interface{}, t NGramTokenizer) ([]string, error) {
123 tokens, err := t.QueryTokens(val)
124 if err != nil {
125 return nil, err
126 }
127 id := t.Identifier()
128 for i := range tokens {
129 tokens[i] = encodeToken(tokens[i], id)
130 }
131 return tokens, nil
132}
133
134// LoadCustomTokenizer reads and loads a custom tokenizer from the given file.
135func LoadCustomTokenizer(soFile string) {

Calls 3

encodeTokenFunction · 0.85
QueryTokensMethod · 0.80
IdentifierMethod · 0.65