--- id: textdistance version: "4.6.3" license: MIT license_treatment: permissive maintenance: aging --- # textdistance — Compute distance between the two texts. License: permissive · Maintenance: aging · Downloads: 2.6M/mo ## What it is and what it does TextDistance is a pure-Python library that implements a large collection of algorithms for measuring how different two or more text sequences are from each other. It provides both distance metrics (how far apart sequences are) and similarity metrics (how alike they are), with support for edit-based algorithms like Levenshtein and Damerau-Levenshtein, token-based methods like Jaccard and Cosine similarity, sequence-based approaches like longest common subsequence, compression-based distance, and phonetic matching. The library has zero runtime dependencies by default and offers optional numpy integration for speed on specific algorithms. You use it by instantiating an algorithm class or calling a function directly, then invoking methods like `.distance()`, `.similarity()`, or `.normalized_distance()` to compare sequences. It's designed for straightforward use cases where you need to measure text similarity—fuzzy matching, deduplication, spell-checking support, or record linkage—without needing to implement these algorithms yourself. Use it for: - Fuzzy string matching to find similar product names or user entries despite typos or variations - Deduplication of text records by computing similarity scores between candidates - Spell-checking or autocorrect by ranking candidate corrections by edit distance - Record linkage in data integration by comparing field values across datasets - Phonetic matching for names that sound similar but are spelled differently ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Computes distance and similarity between text sequences using 30+ algorithms including Levenshtein, Jaro-Winkler, Hamming, and compression-based methods. Yes. The package is stable, permissively licensed, has no dependencies, and provides a comprehensive toolkit for a common task. The aging maintenance status (last release 759 days ago) is a minor concern but not a blocker—the library solves a well-defined problem with established algorithms, and the repository remains active and not archived. Install it if you need string distance or similarity computation. ## Install pip install textdistance uv add textdistance poetry add textdistance ## Installing textdistance Before you install: Low friction installation with no runtime dependencies. Maintenance status is aging—last release was 2024-07-16, with 759 days since then—but the package remains in production/stable state with an active repository (3538 stars, not archived). License in practice: MIT license (permissive) means you can use this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install textdistance from textdistance import Levenshtein levenshtein = Levenshtein() distance = levenshtein.distance('kitten', 'sitting') print(distance) # 3 Verify before relying: - Whether optional numpy integration actually improves performance for the algorithms listed, and which ones benefit most - Current state of the 'work in progress' compression-based algorithms (BZ2NCD, LZMANCD, ZLIBNCD) and whether they are production-ready ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 2.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags string similarity distance, levenshtein distance python, text sequence comparison, jaro-winkler implementation, edit distance algorithms, fuzzy string matching, sequence alignment, string-similarity, sequence-alignment, fuzzy-matching [View on SkillFed](https://skillfed.io/packages/textdistance) · [View on PyPI](https://pypi.org/project/textdistance/)