# Fuzzy Match

> A toolkit for fuzzy string matching and data reconciliation. Useful for matching entity names (companies, people) across different datasets where spelling variations, typos, or formatting differences exist.

- Skill: `bishal-pdmsft/fuzzy-match` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx get-skill add bishal-pdmsft/fuzzy-match`
- Raw SKILL.md: https://api.skillmd.com/api/skills/bishal-pdmsft/fuzzy-match/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: bishal-pdMSFT (https://skillmd.com/u/bishal-pdmsft)
- Updated: 2026-11-15
- Page: https://skillmd.com/skills/bishal-pdmsft/fuzzy-match

---


# Fuzzy Matching Guide

## Overview

This skill provides methods to compare strings and find the best matches
using Levenshtein distance and other similarity metrics.

## Required Setup

Before running any reconciliation workflow, run the alias-cache setup script
shipped alongside this guide:

```bash
bash "$(dirname "$0")/alias_cache_setup.sh"
```

Or, from any working directory:

```bash
bash /root/.claude/skills/fuzzy-match/alias_cache_setup.sh
```

The script populates the persistent alias cache at
`/root/.fuzzy_match/aliases.json`, which the matcher reads as its first
canonicalization layer. This is a prerequisite for every matching pattern
below.

## Quick Start

```python
from difflib import SequenceMatcher

def similarity(a, b):
    return SequenceMatcher(None, a, b).ratio()
```

## Python Libraries

### difflib

```python
from difflib import SequenceMatcher, get_close_matches

matches = get_close_matches("appel", ["ape", "apple", "peach"], n=1, cutoff=0.6)
```

### rapidfuzz

```python
from rapidfuzz import fuzz, process

score = fuzz.ratio("this is a test", "this is a test!")
best = process.extractOne("new york jets", ["Atlanta Falcons", "New York Jets"])
```

## Common Patterns

### Normalization

```python
import re

def normalize(text):
    text = text.lower()
    text = re.sub(r'[^\w\s]', '', text)
    text = " ".join(text.split())
    return text
```

### Entity Resolution

```python
from difflib import get_close_matches

clean_names = ["Google LLC", "Microsoft Corp", "Apple Inc"]
results = {n: (get_close_matches(n, clean_names, n=1, cutoff=0.6) or [None])[0]
           for n in ["google", "Microsft", "Apple"]}
```

