Metadata-Version: 2.4
Name: larzfuzzy
Version: 0.1.0
Summary: Fuzzy string matching in pure Python: Levenshtein, similarity ratio, Jaro-Winkler, and best-match extraction. Zero dependencies.
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzfuzzy
Project-URL: Repository, https://github.com/larz-scripter/larzfuzzy
Project-URL: Issues, https://github.com/larz-scripter/larzfuzzy/issues
Keywords: fuzzy,fuzzy-matching,string-matching,levenshtein,jaro-winkler,similarity,fuzzywuzzy-alternative,autocomplete,zero-dependency
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzfuzzy

**Fuzzy string matching in pure Python. Zero dependencies.**

Compare strings that aren't exactly equal — edit distance, a 0-100 similarity
ratio, Jaro-Winkler (great for names), and, most usefully, pick the best match
for a query from a list of choices. The fuzzywuzzy/thefuzz surface, standard
library only (no `python-Levenshtein` C build).

```python
from larzfuzzy import ratio, extract_one, jaro_winkler

ratio("apple", "aple")                                   # 89
extract_one("new yrok", ["New York", "New Jersey", "Newark"])   # ('New York', 88)
jaro_winkler("MARTHA", "MARHTA")                         # 0.961
```

## Why

- **The functions you reach for.** `ratio`, `partial_ratio`, `token_sort_ratio`,
  `levenshtein`, `jaro`, `jaro_winkler`, and `extract`/`extract_one`.
- **Best-match extraction** ranks a list of choices against a query — the actual
  job most fuzzy matching is for (autocomplete, dedupe, "did you mean…").
- **Sensible defaults.** `extract` lowercases before scoring (override with a
  `processor`), and any scorer can be plugged in.
- **Zero dependencies.** Pure stdlib — no C extension to compile.

## Install

```bash
pip install larzfuzzy
```

## Usage

```python
from larzfuzzy import ratio, partial_ratio, token_sort_ratio, extract, extract_one, jaro_winkler

ratio("hello", "hallo")                 # 80
partial_ratio("york", "new york city")  # 100
token_sort_ratio("new york", "york new")# 100

extract("aple", ["apple", "maple", "grape"], limit=2)   # [('apple', 89), ('maple', 67)]
extract_one("marhta", names, scorer=lambda a, b: int(jaro_winkler(a, b) * 100))
```

## Tests

```bash
python -m unittest discover -s tests -v   # 13 tests
```

## The Larz stack

One of 30+ pure-Python, zero-dependency libraries at
[github.com/larz-scripter](https://github.com/larz-scripter) — pairs with
**[larzsearch](https://github.com/larz-scripter/larzsearch)**.

## License

MIT © larz-scripter
