Find spelling variations of similar words within a list of tokens to reduce token set size

    Sorted by length (longest first unless reverse=False) before running through fuzzy-wuzzy
    which results in longer key tokens.

    Arguments:
      tokens (list or set or tuple of str): token strings from which to eliminate similar spellings

    Returns:
      dict: { 'token': ('similar_token', 'similar_token2', ...), ...}

    Examples:
      FIXME: needs to return a dict of sets rather than dict of tuples so order doesn't matter
      >> tokens = set(('on', 'hon', 'honey', 'ones', 'one', 'two', 'three'))
      {'honey': ('on', 'hon', 'one'), 'ones': (), 'three': (), 'two': ()}

def reduce_vocab_by_len(tokens, similarity=.87, limit=20, reverse=True):
    """Find spelling variations of similar words within a list of tokens to reduce token set size

    Sorted by length (longest first unless reverse=False) before running through fuzzy-wuzzy
    which results in longer key tokens.

    Arguments:
      tokens (list or set or tuple of str): token strings from which to eliminate similar spellings

    Returns:
      dict: { 'token': ('similar_token', 'similar_token2', ...), ...}

    Examples:
      FIXME: needs to return a dict of sets rather than dict of tuples so order doesn't matter
      >> tokens = set(('on', 'hon', 'honey', 'ones', 'one', 'two', 'three'))
      {'honey': ('on', 'hon', 'one'), 'ones': (), 'three': (), 'two': ()}
    """
    tokens = set(tokens)
    tokens_sorted = list(zip(*sorted([(len(tok), tok) for tok in tokens], reverse=reverse)))[1]
    return reduce_vocab(tokens=tokens_sorted, similarity=similarity, limit=limit, sort_order=0)