Data Matching

Token Sort Ratio: How It Works, Examples and Applications in Fuzzy Data Matching

Token Sort Ratio: How It Works, Examples and Applications in Fuzzy Data Matching

Definition

What Is Token Sort Ratio?

Token Sort Ratio is a fuzzy string matching technique that compares text by sorting its individual words, or tokens, into a consistent order before calculating their similarity. Unlike traditional string comparison methods that are sensitive to word position, Token Sort Ratio helps identify matching text even when the same words appear in a different sequence.

This makes it particularly useful for data matching, data deduplication, record linkage and entity resolution, where inconsistent word ordering can prevent conventional matching algorithms from recognising equivalent records.
For example, consider these two company names:

  • Record A: Global Technology Solutions
  • Record B: Solutions Global Technology

Although the words appear in a different order, they contain the same name components and are therefore identical after token sorting. Whether they refer to the same organisation still requires other evidence.
A traditional character-based similarity algorithm may assign a lower similarity score because of the different word positions. Token Sort Ratio addresses this problem by splitting both strings into individual words, sorting them alphabetically and comparing the resulting strings.

Try the Token Sort Ratio Calculator

Enter two strings into the interactive Token Sort Ratio calculator below to explore how changes in word order affect fuzzy matching similarity. Scores depend on the calculator’s implementation and do not establish that two records refer to the same entity.

FREE MATCHING TOOL

Token Sort Similarity Calculator

Compare two text values after sorting their words into a consistent order.

Try an example
100% Token Sort similarity
Very strong similarity

These values contain the same words in a different order.

Token Sort normalizes text, sorts the tokens alphabetically, and then compares the reordered values. This makes it useful when word order changes but the underlying words remain the same.

Sorted Value A john smith
Sorted Value B john smith
Difference Word order only
Remember: Token Sort is useful when token order should not matter, but it may be less appropriate when word order changes the meaning of a value.
From token order to intelligent matching

WinPure AdaptiveMatch™ can apply Token Sort alongside other matching algorithms, thresholds and field-level rules to improve matching across names, addresses, company data and other text fields.

How Does the Token Sort Ratio Algorithm Work?

Token Sort Ratio typically follows four main stages to calculate the similarity between two strings.

Token Sort Ratio infographic showing how two company names with different word orders are normalised, split into tokens, sorted alphabetically and compared to achieve a 100% similarity score.
How Token Sort Ratio works: by sorting words into a consistent order before comparing strings, the algorithm identifies matching strings even when the original word sequence differs.

Step 1: Normalise the Text

The input strings are prepared for comparison. Depending on the implementation, this may involve converting text to lowercase, removing unnecessary punctuation and standardising whitespace.

Step 2: Split the Text into Tokens

Each string is separated into individual words or tokens.

For example:

“Technology Global Solutions”

Becomes:

[“Technology”, “Global”, “Solutions”]

Step 3: Sort the Tokens Alphabetically

The tokens are arranged into a consistent alphabetical order and joined together.

“global solutions technology”

This removes differences caused solely by word ordering.

Step 4: Calculate String Similarity

The sorted strings are compared using an underlying character-based similarity function.

The resulting score is typically expressed as a percentage from 0% to 100%, where 100% indicates that the normalised, sorted strings are identical.

Importantly, Token Sort Ratio is not a standalone mathematical distance formula. It is a preprocessing and comparison technique, and exact scores can vary depending on the implementation and underlying similarity calculation.

Token Sort Ratio Examples

The following examples demonstrate where Token Sort Ratio can improve matching accuracy.

Record ARecord BExpected behaviour
John Michael SmithSmith John Michael100% after token sorting
Global Tech SolutionsSolutions Global Tech100% after token sorting
London Data ServicesData Services London100% after token sorting
Advanced Software LtdAdvanced Software LimitedPartial similarity
Microsoft CorporationCorporation Microsoft100% after token sorting

The examples assume conventional case-insensitive tokenisation and sorting. Differences such as “Ltd” versus “Limited” may require additional data standardisation. A 100% token-sort score means the processed strings match; it does not by itself prove that two records refer to the same real-world entity.

Token Sort Ratio vs Other Fuzzy Matching Algorithms

Different fuzzy matching algorithms are designed to recognise different types of similarity.

Token Sort Ratio vs Levenshtein Distance vs Token Set Ratio infographic comparing three fuzzy string matching algorithms, including how they handle different word orders, spelling variations and additional words in data matching.
Comparing Token Sort Ratio, Levenshtein Distance and Token Set Ratio: three fuzzy matching techniques designed to identify different types of text similarity. Token Sort Ratio handles reordered words, Levenshtein detects character-level differences, and Token Set Ratio recognises shared words even when additional terms are present.
AlgorithmPrimary strengthIdeal application
Token Sort RatioDifferent word orderingCompany names, full names
LevenshteinCharacter insertions, deletions and substitutionsTypographical errors
Damerau-LevenshteinCharacter transpositionsMisspelled names
Jaro-WinklerSimilar strings with matching prefixesPersonal names
Token Set RatioShared words despite additional or missing tokensBusiness names with extra descriptors
WinPureFuzzy™General-purpose fuzzy comparisonEnterprise data matching

Token Sort Ratio is particularly effective when two strings contain the same words but in different orders. However, it may be less suitable when word order carries important meaning or when the records contain additional words that should be treated differently.

Token Sort Ratio vs Token Set Ratio: What Happens with Extra Words?

Consider Global Technology Solutions and Global Technology Solutions Ltd. Token Sort Ratio generally gives a score below 100% because the extra token changes the sorted string. Token Set Ratio can return 100% in common implementations when one set of unique tokens is wholly contained in the other. This can be useful for additional descriptors, but it also increases the risk of false positives: an extra word may be important to identity.

Applications of Token Sort Ratio in Data Matching

1. Company Name Matching

Business databases frequently contain inconsistent naming conventions.

For example, “International Business Consulting” and “Consulting International Business” may represent the same organisation.

Token Sort Ratio can help recognise these similarities without requiring identical word ordering.

2. Customer Data Deduplication

Customer names can be entered in different sequences across CRM systems, marketing platforms and operational databases.

Token Sort Ratio can help identify potential duplicates where names contain the same components but appear in a different order.

Token Sort Ratio for data deduplication infographic showing how company names with different word orders are matched using fuzzy string matching, identified as potential duplicate records for review and master-record selection.
How Token Sort Ratio supports data deduplication by identifying company names containing the same words in different orders. The algorithm standardises word sequences, calculates similarity scores and helps identify potential duplicate records for grouping and consolidation.

3. Address Matching

Address components may appear in different sequences, particularly when data originates from multiple systems.

Token sorting can help identify similarities, although dedicated address standardisation and matching rules are generally preferable for complex address data.

4. Product Catalogue Matching

Product descriptions often contain identical keywords arranged differently.

For example:

  • Samsung Galaxy S25 256GB
  • 256GB Samsung Galaxy S25

Token Sort Ratio can recognise these as equivalent after normalisation and sorting.

5. Entity Resolution

Within entity resolution workflows, Token Sort Ratio can contribute to identifying records that refer to the same real-world entity.

However, a high token-sort similarity score alone does not prove that two records represent the same person, business or organisation. Additional attributes and matching evidence are often necessary.

Advantages and Limitations of Token Sort Ratio

AdvantagesLimitations
Handles differences in word orderMay ignore meaningful word sequence
Effective for multiword namesLess useful for single-word comparisons
Easy to understand and interpretCan produce false positives
Complements character-based algorithmsRequires careful normalisation
Useful in record deduplicationDoes not understand semantic meaning

Token Sort Ratio in WinPure AdaptiveMatch™

WinPure Clean & Match Enterprise v12 introduces AdaptiveMatch™, an intelligent data matching framework that enables organisations to apply different matching techniques to different types of data.

Rather than relying on a single similarity algorithm across an entire dataset, AdaptiveMatch™ provides greater flexibility in how individual data fields are compared.

Token Sort Ratio is one of the matching techniques available within this framework, making it particularly useful when comparing multiword text fields where inconsistent word ordering is common.

For example, an organisation matching customer and company records might use:

  • Token Sort Ratio for company names containing reordered words.
  • Jaro-Winkler for personal names.
  • Levenshtein for identifying typographical variations.
  • Exact Match for standardised identifiers.
  • WinPureFuzzy™ for broader fuzzy text comparisons.

By combining appropriate algorithms within a configurable matching strategy, organisations can build more sophisticated rules that reflect the characteristics of their data.

AdaptiveMatch™ also provides algorithm recommendations based on data types, helping users select suitable matching techniques without having to manually evaluate every available option.

Best Practices for Using Token Sort Ratio

For effective matching results, organisations should consider several important practices:

  1. Standardise data before matching. Consistent case, punctuation and whitespace handling improve comparisons.
  2. Apply appropriate similarity thresholds. A high similarity score does not necessarily mean two records represent the same entity.
  3. Combine algorithms where necessary. Token Sort Ratio can complement phonetic, character-based and exact matching methods.
  4. Consider the importance of word order. Sorting is not appropriate for every type of text.
  5. Validate matching results. Review potential false positives and false negatives against representative datasets.

Conclusion: Improving Data Matching with Token Sort Ratio

Token Sort Ratio helps identify potentially matching records when the same words appear in different orders. It is especially useful for company names, customer records and product descriptions, but should be combined with data standardisation, suitable thresholds and additional matching evidence when determining entity identity.

With WinPure AdaptiveMatch™ in Clean & Match Enterprise v12, organisations can combine Token Sort Ratio with fuzzy, phonetic and exact matching techniques to build flexible matching rules tailored to their data.

Discover Smarter Data Matching with WinPure

Explore AdaptiveMatch™ in WinPure Clean & Match Enterprise v12 and discover how intelligent fuzzy matching can help improve data quality, identify duplicates and resolve records.

Start Free Trial

Frequently Asked Questions

Written by

Team WinPure

The WinPure Team brings together over 100 years of combined expertise in data quality, data management, data matching, entity resolution and software innovation. Our growing team of experienced specialists combines deep industry knowledge with a passion for advancing data quality technology, helping organisations worldwide improve data accuracy, identify and resolve duplicate records, streamline operations and unlock the full potential of their data.

Have a Data Quality Problem to Solve?

Talk to our team about your data, your requirements, and how WinPure could support your project.

Talk to Our Team

Get practical data quality guidance in your inbox

Receive our latest articles on data cleansing, matching, deduplication, entity resolution, and golden records.

Keep Reading

Start Your 30-Day Trial!

Secure desktop tool. No credit card required.

  • Full-feature access for 30 days
  • Runs on your own machine, data stays local
  • No credit card required
  • Onboarding support from our data team