Fuzzy match

Find the candidates that are most similar to a query, ranked with a score from 0 to 1.

Input

The text to look for.
The strings to search, as a list.
How many matches to return at most.
Leave out candidates that score below this (0 to 1).
Treat upper and lower case as different.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/fuzzy-match \
  -H 'Content-Type: application/json' \
  -d '{"input":{"query":"aple","candidates":["apple","maple","grape","banana"]}}'
import json, urllib.request

body = {'input': {'query': 'aple', 'candidates': ['apple', 'maple', 'grape', 'banana']}}
request = urllib.request.Request("https://setget.net/v1/tools/fuzzy-match", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/fuzzy-match", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"query":"aple","candidates":["apple","maple","grape","banana"]}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "fuzzy-match",
  "input": {
    "query": "aple",
    "candidates": [
      "apple",
      "maple",
      "grape",
      "banana"
    ]
  }
}
{
  "input": {
    "query": "aple",
    "candidates": [
      "apple",
      "maple",
      "grape",
      "banana"
    ]
  }
}

Endpoint: POST /v1/tools/fuzzy-match. Over MCP: run_tool with slug: "fuzzy-match". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
query string yes The text to look for.
candidates array yes The strings to search, as a list.
limit integer no How many matches to return at most. Default: 5. From 1 to 100.
min_score number no Leave out candidates that score below this (0 to 1). Default: 0.3. From 0 to 1.
case_sensitive boolean no Treat upper and lower case as different. Default: false.

Examples

Input
{
  "query": "aple",
  "candidates": [
    "apple",
    "maple",
    "grape",
    "banana"
  ]
}
Result
{
  "matches": [
    {
      "candidate": "apple",
      "score": 0.8889,
      "index": 0
    },
    {
      "candidate": "maple",
      "score": 0.8889,
      "index": 1
    },
    {
      "candidate": "grape",
      "score": 0.6667,
      "index": 2
    }
  ],
  "best": "apple",
  "count": 3
}

Only the best match

Input
{
  "query": "instal",
  "candidates": [
    "uninstall",
    "install",
    "init"
  ],
  "limit": 1
}
Result
{
  "matches": [
    {
      "candidate": "install",
      "score": 0.9231,
      "index": 1
    }
  ],
  "best": "install",
  "count": 1
}

Questions

How is the score calculated?
It is twice the number of matching characters divided by the total length of both strings. 1 is an exact match.
Which candidate wins a tie?
The one that comes first in your list. "index" is its position in the list, counting from 0.