def do_fuzzy(self, word): """Compute fuzzy extensions of word. FUZZY lilas""" word = list(preprocess_query(word))[0] fuzzy = make_fuzzy(word) print(white(fuzzy)) print(blue("{} items".format(len(fuzzy))))
def pair(word): """See all token associated with a given token. PAIR lilas""" word = list(preprocess_query(word))[0] key = pair_key(word) tokens = [t.decode() for t in DB.smembers(key)] tokens.sort() print(white(tokens)) print(magenta('(Total: {})'.format(len(tokens))))
def pair(cmd, word): """See all token associated with a given token. PAIR lilas""" word = list(preprocess_query(word))[0] key = pair_key(word) tokens = [t.decode() for t in DB.smembers(key)] tokens.sort() print(white(tokens)) print(magenta('(Total: {})'.format(len(tokens))))
def do_fuzzyindex(self, word): """Compute fuzzy extensions of word that exist in index. FUZZYINDEX lilas""" word = list(preprocess_query(word))[0] token = Token(word) neighbors = make_fuzzy(token) neighbors = [(n, DB.zcard(dbkeys.token_key(n))) for n in neighbors] neighbors.sort(key=lambda n: n[1], reverse=True) for token, freq in neighbors: if freq == 0: break print(white(token), blue(freq))
def do_fuzzyindex(self, word): """Compute fuzzy extensions of word that exist in index. FUZZYINDEX lilas""" word = list(preprocess_query(word))[0] token = Token(word) token.make_fuzzy() neighbors = [(n, DB.zcard(dbkeys.token_key(n))) for n in token.neighbors] neighbors.sort(key=lambda n: n[1], reverse=True) for token, freq in neighbors: if freq == 0: break print(white(token), blue(freq))
def do_fuzzy(self, word): """Compute fuzzy extensions of word. FUZZY lilas""" word = list(preprocess_query(word))[0] print(white(make_fuzzy(word)))
def do_AUTOCOMPLETE(cmd, s): """Shows autocomplete results for a given token.""" s = list(preprocess_query(s))[0] keys = [k.decode() for k in DB.smembers(edge_ngram_key(s))] print(white(keys)) print(magenta('({} elements)'.format(len(keys))))
def do_autocomplete(self, s): """Shows autocomplete results for a given token.""" s = list(preprocess_query(s))[0] keys = [k.decode() for k in DB.smembers(edge_ngram_key(s))] print(white(keys)) print(magenta('({} elements)'.format(len(keys))))