claudewheel v0.20.1 /claudewheel.fuzzy
Edit
On this page

Fuzzy search functions for matching user input against option lists.

#claudewheel.fuzzy

#claudewheel.fuzzy

Score, rank, and highlight fuzzy matches between queries and option lists.

#fuzzy_score

python
def fuzzy_score(query: str, candidate: str) -> tuple[int, list[int]]

Score: 100 exact, 80 prefix, 60 contains, 40 subsequence, 0 no match.

Returns (score, matched_positions) where positions are indices in candidate that count as matched (for highlighting). Empty list if no match.

#fuzzy_rank

python
def fuzzy_rank(query: str, candidates: list[str]) -> list[str]

Return candidates sorted by fuzzy match score (best first). Excludes non-matches.

#fuzzy_match_positions

python
def fuzzy_match_positions(query: str, candidate: str) -> list[int]

Return the list of indices in candidate matched by query, or empty if no match.