{"id":6900,"library":"strsimpy","title":"String Similarity and Distance Measures","description":"Strsimpy is a Python library that provides implementations for various string similarity and distance measures, including popular algorithms like Levenshtein, Jaro-Winkler, N-Gram, Cosine Similarity, and Jaccard Index. It's designed to be straightforward to use for text analysis and data matching tasks. The current version is 0.2.1. Releases are infrequent, typically addressing bug fixes or adding new algorithms.","status":"active","version":"0.2.1","language":"en","source_language":"en","source_url":"https://github.com/luozhouyang/python-string-similarity","tags":["string-similarity","levenshtein","jaro-winkler","text-analysis","nlp","data-matching"],"install":[{"cmd":"pip install strsimpy","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"Levenshtein","correct":"from strsimpy.levenshtein import Levenshtein"},{"symbol":"JaroWinkler","correct":"from strsimpy.jaro_winkler import JaroWinkler"},{"symbol":"Ngram","correct":"from strsimpy.ngram import Ngram"},{"wrong":"from strsimpy.weighted_levenshtein import Levenshtein","symbol":"WeightedLevenshtein","correct":"from strsimpy.weighted_levenshtein import WeightedLevenshtein"}],"quickstart":{"code":"from strsimpy.levenshtein import Levenshtein\n\ns0 = \"안녕하세요\"\ns1 = \"안녕하세유\"\n\nlevenshtein = Levenshtein()\ndistance = levenshtein.distance(s0, s1)\nprint(f\"Levenshtein distance between '{s0}' and '{s1}': {distance}\")\n\ns2 = \"apple\"\ns3 = \"aple\"\ndistance2 = levenshtein.distance(s2, s3)\nprint(f\"Levenshtein distance between '{s2}' and '{s3}': {distance2}\")\n\nfrom strsimpy.jaro_winkler import JaroWinkler\n\njaro_winkler = JaroWinkler()\nsimilarity = jaro_winkler.similarity(s2, s3)\nprint(f\"Jaro-Winkler similarity between '{s2}' and '{s3}': {similarity}\")","lang":"python","description":"This quickstart demonstrates calculating Levenshtein distance and Jaro-Winkler similarity between strings. Most algorithms follow a pattern of instantiating a class and then calling a `distance()` or `similarity()` method."},"warnings":[{"fix":"Update all `import similarity...` statements to `import strsimpy...` and reinstall the package.","message":"The package name was changed from `similarity` to `strsimpy`. Old import paths will fail.","severity":"breaking","affected_versions":"<0.1.2"},{"fix":"Review the documentation for `WeightedLevenshtein` and update your weight calculation logic to use direct functions as arguments, rather than class instances.","message":"The `WeightedLevenshtein` algorithm's API changed significantly in v0.1.7. It now uses functions for weight calculation instead of expecting Class or Objects, simplifying its usage.","severity":"breaking","affected_versions":"<0.1.7"},{"fix":"If your project requires `numpy`, ensure it is explicitly listed in your project's dependencies.","message":"The `numpy` dependency was removed in v0.1.5 to lighten the package. If you were implicitly relying on `numpy` being installed alongside `strsimpy`, it might no longer be present.","severity":"gotcha","affected_versions":"<0.1.5"},{"fix":"Upgrade to version 0.1.2 or later to ensure correct calculations and avoid potential runtime errors with ShingleBased algorithms.","message":"A `ZeroDivisionError` was fixed in ShingleBased algorithms (e.g., Jaccard, Cosine Similarity) for certain edge cases.","severity":"gotcha","affected_versions":"<0.1.2"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}