ngrams module¶
-
class
ngrams.
NGramIndex
(length)¶ Bases:
object
-
index_token
(token)¶ creates an index with the ngrams of each token. :param token: :return:
-
post_filtering
(wildcard_input, suggestions)¶ checks if the suggestion actually matches the wildcard query :param wildcard_input: :param suggestions: :return:
-
suggestions
(ngrams)¶ gets all the common tokens from an ngram list. :param ngrams: :return:
-
wildcard_ngrams
(wildcard_input)¶ creates the ngrams that based on the wildcard input. :param wildcard_input: :return:
-
-
ngrams.
get_n_grams
(token, grams_count)¶ returns the ngrams of a token :param token: ex. results :param grams_count: ex. 2 :return: [‘$r’, ‘re’, ‘es’, ‘su’, ‘ul’, ‘lt’, ‘ts’, ‘s$’]
-
ngrams.
query_combinations
(parts)¶ creates a combination of all the possible queries that could come out of wildcard query :param parts: :return: