Skip to main content

fuzzy.BestMatchWithScore

Find closest match with score and index. Optional threshold: returns empty match and index -1 if best score is below it (score still reported)

fuzzy.BestMatchWithScore(target: string, candidates: []any, threshold?: float64) -> map

Arguments

NameType
targetstring
candidates[]any
threshold?float64

Example

{{ fuzzy.BestMatchWithScore("apple", ["aple", "banana"], 0.7) }}

Returns {"match": "aple", "score": 0.8, "index": 0}.