Sunday, September 27, 2015

autocomplete and variations


Suppose I'm given a list of words, {dog, cat, tv, boing}. When the user enters a new word, I want to let them know that there are exact or similar matches which already exist.

This will happen in a sequence of steps. From simplest to more complex,

phase 1: exact match the beginning of the word.
If I type "d", I am provided "dog"
If I type "o", I have no prompts
If I type "k", I have no prompts

phase 2: exact match anywhere in the word
If I type "d", I am provided "dog"
If I type "o", I am provided "dog" and "boing"
If I type "k", I have no prompts

phase 3: similar match anywhere in the word. Return exact matches and top X% of similar, ranked by similarity
If I type "d", I am provided "dog"
If I type "o", I am provided "dog" and "boing"
If I type "og", I am provided "dog" (exact) and "boing" (similar)
If I type "k", I have no prompts


http://stackoverflow.com/questions/7821661/how-to-code-autocompletion-in-python
https://pymotw.com/2/readline/

I'm not looking for tab completion. Instead, as I type I want the top n matches to automatically refresh


No comments:

Post a Comment