ThisCalculator

Everyday

Similarity Score in Semantic Record Linking

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Similarity Score in Semantic Record Linking

A similarity score in semantic record linking is a numeric value, usually between 0 and 1, that measures how closely two records match in meaning, not just in exact text. You enter two records (like customer names, addresses, or product descriptions) and the system returns a score where 1 means the records likely refer to the same real-world entity and 0 means they are completely unrelated.

Formula

The similarity score is computed by combining several sub-scores, each measuring a different aspect of semantic similarity. A common formula is a weighted average:

Score = w1·Schar + w2·Stoken + w3·Ssemantic

  • Schar – character-level similarity (e.g., Levenshtein distance, Jaro-Winkler) – captures typos and minor spelling differences.
  • Stoken – token-level similarity (e.g., Jaccard similarity on word sets) – captures word order and common words.
  • Ssemantic – embedding-based similarity (e.g., cosine similarity between vector representations) – captures meaning, synonyms, and paraphrases.
  • w1, w2, w3 – weights that sum to 1, tuned to the specific dataset.

Each sub-score also ranges from 0 to 1. The weights allow you to emphasize the type of matching that matters most for your data.

Worked Example

Using the defaults from the calculator: Record 1 = “John A. Smith, 123 Main St� and Record 2 = “Jon Smith, 123 Main Street�.

  1. Character similarity (Schar): The strings differ by “A.� and “Main St� vs “Main Street�. A Jaro-Winkler score would be around 0.92 because the differences are small.
  2. Token similarity (Stoken): Common tokens are “John/Jon� (not exact), “Smith�, “123�, “Main�. Jaccard similarity on token sets is about 0.67 (4 common tokens out of 6 unique tokens).
  3. Semantic similarity (Ssemantic): Embeddings would place “John� and “Jon� very close, and “St� and “Street� as synonyms, so cosine similarity might be 0.95.
  4. Weighted combination: With weights w1=0.3, w2=0.3, w3=0.4, the score = 0.3·0.92 + 0.3·0.67 + 0.4·0.95 = 0.276 + 0.201 + 0.380 = 0.857, which rounds to 0.86.

The calculator shows 0.85 because it uses slightly different normalization, but the logic is identical.

Why Semantic Matching Matters

Traditional record linking (often called fuzzy matching) compares strings character by character. It fails when two records refer to the same entity but use different words: “Bill� vs “William�, “NYC� vs “New York City�, or “Dr.� vs “Doctor�. Semantic similarity uses language models or knowledge graphs to understand that these are equivalent. This is critical in real-world datasets like customer databases, healthcare records, or product catalogs where data entry is inconsistent.

For example, a hospital might have “John Smith, DOB 1980-05-14� and “Jon Smith, born May 14 1980�. A character-based match would give a low score because the date format differs, but a semantic model understands that “DOB� and “born� both refer to birth date, and “1980-05-14� and “May 14 1980� are the same date.

How to Choose a Threshold

The score alone is meaningless without a threshold. You must decide: above what score do you consider two records a match? There is no universal threshold; it depends on your tolerance for false positives vs false negatives.

  • High threshold (e.g., 0.9): Few false matches, but you may miss many true duplicates. Use when merging critical data where errors are costly (e.g., medical records).
  • Low threshold (e.g., 0.7): Catches more duplicates, but also links unrelated records. Use for exploratory analysis or when a human will review the matches.
  • Adaptive threshold: Use a different threshold for different fields. For example, exact match on Social Security Number might override a low name similarity.

A common approach is to label a small sample of pairs as match/non-match, then plot precision-recall to find the threshold that maximizes your F1 score.

Common Mistakes and Pitfalls

Even with a good score, there are traps:

  • Ignoring field importance: A match on last name is more meaningful than a match on street name. Weight fields accordingly.
  • Over-relying on embeddings: Embeddings can be biased by training data. “Appleâ€� (fruit) and “Appleâ€� (company) are far apart in a good embedding, but not always.
  • Not normalizing data: Always standardize case, punctuation, and common abbreviations before computing similarity. “St.â€� and “Streetâ€� should be normalized to the same token.
  • Assuming symmetry: Some similarity measures are not symmetric (e.g., Levenshtein is symmetric, but a directional measure like Jaro-Winkler gives higher scores when the first characters match). For record linking, you usually want a symmetric measure.
  • Ignoring context: Two records might have the same name and address but refer to different people (e.g., father and son). Semantic similarity cannot solve that without additional data like age or ID.

Semantic vs. Syntactic Similarity

Syntactic similarity (also called lexical similarity) looks at the surface form: characters, words, and structure. Semantic similarity looks at meaning. The key difference is that semantic methods can link “car� and “automobile� or “USA� and “United States of America� even though they share no characters. Syntactic methods would give those pairs a score near 0.

In practice, you often need both. A pure semantic model might incorrectly link “President of the United States� and “President of the United States of America� (they are the same) but also “President of Mexico� and “President of New Mexico� (not the same, but close in text). Combining syntactic and semantic scores helps disambiguate.

How to Interpret the Score

A score of 0.85 does not mean there is an 85% chance the records match. It is a similarity measure, not a probability. To convert to a probability, you need to calibrate using a logistic regression on labeled data. In practice, most people use the score as a ranking: sort all pairs by score and review the top ones.

Also, the score is relative. A score of 0.8 might be excellent for noisy social media data but poor for clean government records. Always compare scores within your own dataset.

Frequently Asked Questions

What is the difference between similarity score and match probability?

A similarity score measures how alike two records are in terms of content and meaning. It is not a probability. A match probability would tell you the chance that the records refer to the same entity, which requires training on labeled data to calibrate the similarity score.

Can I use a similarity score for deduplication?

Yes, that is a common use. You compute the similarity between every pair of records (or use blocking to reduce pairs) and then group records that have a score above your threshold. This is called entity resolution or record linkage.

Why does my similarity score change when I reorder the words?

Some token-based measures are order-sensitive. For example, “John Smith� and “Smith John� would have a high token overlap but a low character-based similarity. Semantic embeddings are usually order-insensitive because they average word vectors, but they may lose word-order information. Choose a measure that matches your data: if word order matters, use a sequence-aware model.

How do I handle missing values in one record?

Missing values should be treated as unknown, not as a mismatch. You can either exclude that field from the similarity calculation or impute a neutral value. For example, if one record has no phone number, you might set that field’s similarity to 0.5 (neutral) instead of 0.

What is the best similarity measure for names?

For personal names, a combination of Jaro-Winkler (which handles common typos and transpositions) and a phonetic algorithm like Soundex or Metaphone works well. For semantic matching, you can use a pre-trained name embedding or a simple rule that maps nicknames (Bob→Robert). No single measure is best; it depends on your data.

Is a higher threshold always better?

No. A higher threshold reduces false positives but increases false negatives. The optimal threshold balances the cost of missing a true match against the cost of linking two different entities. In many applications, missing a duplicate is more costly than having a human review a few extra pairs, so a lower threshold may be better.

Related

Formula used
in text1 | Record 1 | - | "John A. Smith, 123 Main St" | 0
in text2 | Record 2 | - | "Jon Smith, 123 Main Street" | 0
out score | Similarity Score | 0-1 | 0.85 | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.