strsimpy
A library implementing different string similarity and distance measures
What it is and what it does
strsimpy is a Python port of a Java string-similarity library that provides implementations of multiple string comparison algorithms. It lets you measure how similar or different two strings are using different mathematical approaches—some compute edit distance (how many character changes are needed), others use n-gram profiles or set-based metrics. Each algorithm has different trade-offs: some are normalized to 0–1 ranges, some satisfy the triangle inequality property useful for indexing, and some are optimized for specific tasks like typo correction or diff utilities.
You import an algorithm class, instantiate it, and call its similarity() or distance() method on two strings. The library includes Levenshtein variants (standard, normalized, weighted, Damerau), Jaro-Winkler, Longest Common Subsequence, n-gram based methods (Q-Gram, cosine, Jaccard, Sorensen-Dice, overlap), and experimental SIFT4. It has no external dependencies and installs as a pure Python wheel.
Use it for:
- Detect typos and suggest corrections by finding the most similar string from a dictionary using Jaro-Winkler
- Implement a fuzzy search feature that matches user input against product names or database records despite spelling variations
- Compare file contents or code diffs by computing Longest Common Subsequence distance
- Build a deduplication system that identifies near-duplicate records in a dataset using normalized Levenshtein
- Analyze OCR output by using weighted Levenshtein to account for character-specific error costs
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Implements a dozen string similarity and distance algorithms including Levenshtein, Jaro-Winkler, Longest Common Subsequence, and cosine similarity for comparing text strings.
Yes, if you need string similarity algorithms and can accept an abandoned package. The library is stable, has no known vulnerabilities, low install friction, and covers a comprehensive range of algorithms. However, do not install if you require active maintenance, bug fixes, or support for Python versions beyond 3.9—the last release was 2021-09-10 with no commits since November 2022.
Install
strsimpy on PyPI
pip
pip install strsimpyuv
uv add strsimpypoetry
poetry add strsimpyInstalling strsimpy
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned—last release was 2021-09-10 and last commit 2022-11-12—so no active maintenance or bug fixes should be expected.
License in practice
MIT License permits commercial and private use with minimal restrictions, requiring only license and copyright notice retention.
Quickstart
pip install strsimpy
from strsimpy.jaro_winkler import JaroWinkler
jw = JaroWinkler()
similarity = jw.similarity('string1', 'string2')
Verify before relying
- Whether the package works reliably with Python versions beyond 3.9 despite classifiers only listing up to 3.9
- Performance characteristics on very long strings or large-scale batch comparisons
- Whether all dozen algorithms mentioned in the description are fully implemented and documented
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,799 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 513,251/month — #6,248 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: strsimpy-0.2.1-py3-none-any.whl
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
pylcsComputes longest common subsequence, longest…
permissive · top 15,000 on PyPI
stringzillaStringZilla provides SIMD and SWAR-accelerated…
permissive · top 5,000 on PyPI
suffix-treesImplements suffix trees and generalized suffix…
permissive · top 15,000 on PyPI
textdistanceComputes distance and similarity between text…
permissive · top 5,000 on PyPI
fuzzysearchFinds approximate substring matches in text or…
permissive · top 15,000 on PyPI
DistanceComputes distance metrics (Levenshtein,…
copyleft · top 15,000 on PyPI
editdistpyComputes Levenshtein and Damerau-Levenshtein…
permissive · top 15,000 on PyPI
jaro-winklerComputes Jaro and Jaro-Winkler string…
copyleft · top 5,000 on PyPI
zssComputes the edit distance between two tree…
unclear · top 15,000 on PyPI
ngramExtends Python's set class to perform fuzzy…
copyleft · top 15,000 on PyPI