Score similarity between two strings
Heuristicmatching_scoreBest-effort — fuzzy, approximate, or inferred; check the confidence score.
Score the similarity between two strings using fuzzy matching. Returns score (0.0–1.0), is_match flag (>=0.80 threshold), and the strategy used. Strategies: ratio (character-level), partial_ratio (best substring), token_sort_ratio (word-order agnostic), token_set_ratio (word-order + duplicate agnostic, default). Inputs are case-insensitive and whitespace-trimmed. Tip: for organization or facility names, clean them with names_org_name_clean first; this is raw fuzzy matching, not semantic resolution. Processing multiple inputs? Use `matching_score_batch` to do up to 1000 in one call.
Parameters
astringrequiredFirst string to compare.
bstringrequiredSecond string to compare.
strategystringoptionalSimilarity strategy: ratio (character-level), partial_ratio (best substring), token_sort_ratio (ignores word order), token_set_ratio (ignores order + duplicates, default).
Call it
curl -X POST https://api.snipget.ai/v1/matching/score \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"a":"Jon Smith","b":"John Smith","strategy":"token_set_ratio"}'The Batch tab sends up to 1000 inputs in one call via /v1/matching/score/batch.
Example response
{
"score": 0.9474,
"strategy": "token_set_ratio",
"is_match": true
}FAQ
Why use this instead of just eyeballing whether two values match?
It turns a fuzzy judgment into a repeatable number from 0 to 1, so the same two strings always get the same score. An AI model asked 'are these the same?' will answer inconsistently and can't give you a threshold to act on; this does.
Does a high score mean the two things are definitely the same?
No. This is a heuristic, best-effort similarity score based only on how the text looks, not on any real-world knowledge that the two refer to the same person or company. Treat it as a strong hint and read the score: is_match flips to true at 0.80 and above, but you should pick the cutoff that fits your data.
What are the strategy options and which should I use?
Four strategies: ratio (plain character-by-character), partial_ratio (best matching substring, good when one value is contained in the other), token_sort_ratio (ignores word order, so 'John Smith' equals 'Smith John'), and token_set_ratio (ignores word order and duplicate words, the default and the most forgiving). Leave it on the default unless you have a reason to change it.
Does it care about capitalization or extra spaces?
No. Both values are lowercased and trimmed before scoring, so 'Acme Corp' and 'ACME corp' compare as identical.
What happens if I pass an empty or missing value?
You get a normal response with a score of 0.0, is_match false, and confidence 0 plus a short reason in the trace. It does not raise an error, so check the score rather than expecting a failure.