Module Expr Str ImportFrom alias FunctionDef arguments args NameParam NameParam defaults body Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad If CompareGt NameLoad Num body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Return ListComp SubscriptLoad NameLoad Index Num comprehension NameStore Call NameLoad NameLoad keyword Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index Num keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareGt Call NameLoad NameLoad Call NameLoad NameLoad body Return Num Assign NameStore NameLoad Assign NameStore Num Assign NameStore Num While NameLoad body Assign NameStore Num Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareLt NameLoad Num body Return Num If BoolOpAnd CompareGt NameLoad Num CompareEq SubscriptLoad NameLoad Index BinOpSub NameLoad Num Str body Assign NameStore Num orelse Assign NameStore BinOpSub Num BinOpDiv NameLoad Call NameLoad Call NameLoad NameLoad AugAssignMult NameStore NameLoad Assign NameStore SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num AugAssignAdd NameStore Num If CompareGtE NameLoad Call NameLoad NameLoad body Break Assign NameStore BinOpSub Num BinOpDiv Call NameLoad NameLoad Call NameLoad Call NameLoad NameLoad AugAssignMult NameStore NameLoad Return NameLoad decorator_list
N/A N/A Fuzzy finder for AWS Shell.

This is a fuzzy finder used for the autocompleter
that I've tried to optimize for the AWS CLI set
of commands.

There doesn't seem to be a generic algorithm that
does exactly what I want.  Changing any of these
heuristics so far means that you have to give up
some other component of the idealized matching.

The main things I care about:

* Special weight is given to subsequences on a
  word boundary.  So "drio" scores higher for
  "describe-reserved-instances_offering" than
  "create-spot-datafeed-subscription".
* The more of the word you complete, the higher
  score it has, so given "describe-instance", then
  "describe-instances" should match higher than
  "describe-instance-attribute" because the former
  matches every single character except for one.
* Similar to one, "rinstance" should rank
  "run-instances" higher than "describe-instances"
  because the "r" falls on a word boundary.

High Level Idea
===============

The basic idea is to try to calculate a numeric
score between 0 and 1 given the users's search
string and a possible word in the corpus of words.

You calculate the score for each word and then sort
them appropriately and return the results in order
back to the user.  A score of 1 is the highest
possible score, it would represent an exact match,
and 0 is the lowest meaning these is no possible chance
for the word to be a match.

 __future__ print_function fuzzy_search N/A N/A user_input corpus N/A N/A N/A candidates N/A N/A word corpus N/A N/A current_score N/A calculate_score user_input word N/A N/A current_score 0 N/A N/A N/A N/A candidates append N/A word current_score N/A N/A N/A c N/A 0 N/A c N/A sorted candidates key N/A N/A N/A x N/A N/A x N/A 1 reverse True N/A calculate_score N/A N/A search_string word N/A N/A N/A Calculate how well the search string matches the word. N/A N/A N/A len search_string N/A len word N/A N/A 0 N/A original_word word N/A score 1 N/A search_index 0 N/A True N/A N/A scale 1.0 N/A search_char N/A search_string N/A search_index N/A i N/A N/A word find search_char N/A N/A i 0 N/A N/A 0 N/A N/A N/A i 0 N/A N/A word N/A N/A i 1 - N/A N/A scale 0.95 N/A N/A scale N/A 1 N/A i N/A float N/A len word N/A score scale N/A word N/A word N/A N/A i 1 N/A search_index 1 N/A N/A search_index N/A len search_string N/A N/A N/A completion_scale N/A 1 N/A N/A len word N/A float N/A len original_word N/A score completion_scale N/A score N/A