How to use the keyvi.PrefixCompletion function in keyvi

To help you get started, we’ve selected a few keyvi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github KeyviDev / keyvi / python / examples / completion / prefix_completion_fuzzy_tester.py View on Github external
import keyvi

query = ""

d=keyvi.Dictionary("prefix-completion.keyvi")
c=keyvi.PrefixCompletion(d)

def get_lookup_key(query):
    return query

while query!="exit":
    query = raw_input("Query:")
    for m in c.GetFuzzyCompletions(get_lookup_key(query.strip()), 3):
        print "{} {}".format(m.GetMatchedString(), m.GetAttribute("weight"))
github KeyviDev / keyvi / python / examples / completion / prefix_completion_tester.py View on Github external
import keyvi

query = ""

d=keyvi.Dictionary("prefix-completion.keyvi")
c=keyvi.PrefixCompletion(d)

def get_lookup_key(query):
    return query

while query!="exit":
    query = raw_input("Query:")
    for m in c.GetCompletions(get_lookup_key(query.strip())):
        print "{} ({})".format(m.GetMatchedString(), m.GetAttribute("weight"))