Skip to content
Coding Script or NotebookGoogle ColabFree

Fuzzy Matching for SEO in Python: Scorers, Redirects and Library Comparison

ForSite migrationsContent audits

By Lazarina Stoy· Updated 5 Dec 2026

Fuzzy matching scores how similar two strings are, which makes it the quiet workhorse behind redirect maps, duplicate checks and “have we already written this?” questions. This free Google Colab notebook recreates every tab of my free Fuzzy Matching for SEO Google Sheets template in Python, then goes further: it compares the main libraries and shows where character-level matching stops being the right tool.

Who it’s for

SEOs who have outgrown the Sheets version, and anyone who wants to understand what ratio, partial_ratio and token_set_ratio actually measure before trusting a score. You need basic comfort running cells in Colab. No API keys are needed. If you already use the Sheets template, this is the natural next step when your lists grow beyond what spreadsheet formulas handle comfortably, since RapidFuzz can compare whole lists of strings in one call.

How to use it

  1. Open the notebook in Colab and run all cells. Every section runs on built-in sample data first.
  2. Start with Scorers 101 to see how each scorer, raw Levenshtein distance and Jaro-Winkler treat the same pairs.
  3. Replace the lists marked # YOUR DATA with your own keywords, titles or URLs.
  4. Run the string assessment for duplicate checks and the redirect mapping section for old-to-new URLs.
  5. Add a Screaming Frog inlinks export to the internal linking section to see which suggested links already exist.
  6. Export the CSVs.

What you get

  • The nearest neighbour for every keyword or title in a list, for duplicate and keyword cannibalisation checks
  • A redirect map with direct, partial and no-match buckets
  • Internal linking candidates per page, checked against the links you already have
  • A side-by-side of RapidFuzz, TheFuzz (the renamed FuzzyWuzzy) and PolyFuzz, plus a pandas replacement for the unmaintained fuzzy-pandas
  • Phonetic matching with Metaphone and NYSIIS, and a worked example of why character similarity misfires for keyword clustering

Limits

Fuzzy matching compares characters, so “cheap flights” and “budget airfare” score low even though they mean the same thing. For meaning, the notebook includes an optional embeddings comparison through PolyFuzz. It is switched off by default and downloads a model when you turn it on. Library versions move quickly: the README lists exactly what was tested in October 2026, and which libraries are still maintained.

The full explanation is in What Fuzzy Matching Is, and Where It Fits in SEO. To learn fuzzy matching alongside clustering, classification and entity analysis, with guided practicals, see Introduction to Machine Learning for SEO.

What’s included

  • Every tab of the free Fuzzy Matching for SEO Sheets template, recreated in Python
  • Scorers explained side by side: ratio, partial, token sort, token set, WRatio, Levenshtein, Jaro-Winkler
  • Duplicate and cannibalisation checks, redirect mapping and internal link candidates
  • RapidFuzz vs TheFuzz vs PolyFuzz, plus phonetic matching with Metaphone and NYSIIS
  • Runs on built-in sample data with no API keys