{"id":4948,"library":"fuzzysearch","title":"Fuzzysearch","description":"Fuzzysearch is a Python library for finding approximate subsequence matches within long texts or data. It uses Levenshtein distance with configurable parameters to efficiently locate patterns even with typos or minor variations. The library is highly optimized, offering C and Cython extensions for performance while providing pure-Python fallbacks. It is currently at version 0.8.1.","status":"active","version":"0.8.1","language":"en","source_language":"en","source_url":"https://github.com/taleinat/fuzzysearch","tags":["fuzzy search","string matching","levenshtein distance","text processing"],"install":[{"cmd":"pip install fuzzysearch","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for `Match` objects and other data structures.","package":"attrs","optional":false}],"imports":[{"note":"The primary function for in-memory fuzzy searching.","symbol":"find_near_matches","correct":"from fuzzysearch import find_near_matches"},{"note":"Used for searching within file-like objects (e.g., binary files).","symbol":"find_near_matches_in_file","correct":"from fuzzysearch import find_near_matches_in_file"}],"quickstart":{"code":"from fuzzysearch import find_near_matches\n\n# Search for 'PATTERN' with a maximum Levenshtein Distance of 1\nmatches = find_near_matches('PATTERN', '---PATERN---', max_l_dist=1)\n\nfor match in matches:\n    print(f\"Found match: '{match.matched}' at index {match.start}-{match.end} with distance {match.dist}\")","lang":"python","description":"This example demonstrates how to find approximate matches of a subsequence ('PATTERN') within a larger string, allowing for a maximum Levenshtein distance of 1."},"warnings":[{"fix":"Upgrade to a supported Python version (3.8+).","message":"Support for older Python versions has been dropped. As of version 0.8.1, fuzzysearch officially supports Python 3.8+ and PyPy 3.9 and 3.10. Older versions (e.g., Python 2.x, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7) are no longer supported.","severity":"breaking","affected_versions":"<=0.7.3"},{"fix":"Understand the library's primary use case. For string comparison, use dedicated fuzzy matching libraries.","message":"This library is designed for fuzzy *search* (finding approximate *subsequences* within longer texts/data) rather than fuzzy *comparison* of two strings. If you need to compare two strings for similarity (e.g., 'apple' vs 'aple'), consider libraries like FuzzyWuzzy or RapidFuzz.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure you are on version 0.7.3 or newer. Always provide appropriate string or bytes-like inputs as expected by the functions.","message":"Older versions (prior to 0.7.3) could experience segmentation faults or undefined behavior due to incorrect handling of bytes-like inputs in C extensions. While fixed, this highlights the importance of providing correct input types and updating.","severity":"gotcha","affected_versions":"<0.7.3"},{"fix":"Pre-process your input strings (e.g., remove unwanted characters, normalize case) or use more specific matching parameters (e.g., `max_substitutions`, `max_deletions`, `max_insertions`) to control the match criteria more tightly.","message":"The `find_near_matches` function is quite permissive by default, potentially matching unexpected characters (spaces, symbols, numbers) if not constrained. This can lead to false positives when searching for specific words or patterns.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}