{"id":13473238,"url":"https://github.com/seatgeek/thefuzz","last_synced_at":"2025-05-13T20:04:14.247Z","repository":{"id":37818348,"uuid":"344908284","full_name":"seatgeek/thefuzz","owner":"seatgeek","description":"Fuzzy String Matching in Python","archived":false,"fork":false,"pushed_at":"2025-03-03T17:02:53.000Z","size":127,"stargazers_count":3198,"open_issues_count":42,"forks_count":147,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-05-06T18:40:54.494Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seatgeek.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-05T19:07:19.000Z","updated_at":"2025-05-05T19:58:40.000Z","dependencies_parsed_at":"2025-03-18T21:00:36.163Z","dependency_job_id":"77ec56df-3f8c-4453-b25b-5c841ba115dd","html_url":"https://github.com/seatgeek/thefuzz","commit_stats":{"total_commits":22,"total_committers":10,"mean_commits":2.2,"dds":0.5454545454545454,"last_synced_commit":"04deff5cc280e034d0344dc9f8731399ecd207cd"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seatgeek%2Fthefuzz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seatgeek%2Fthefuzz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seatgeek%2Fthefuzz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seatgeek%2Fthefuzz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seatgeek","download_url":"https://codeload.github.com/seatgeek/thefuzz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253592891,"owners_count":21932900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T16:01:02.003Z","updated_at":"2025-05-13T20:04:14.224Z","avatar_url":"https://github.com/seatgeek.png","language":"Python","funding_links":[],"categories":["Python","资源列表","🐍 Python"],"sub_categories":["文本处理","Useful Python Tools for Data Analysis"],"readme":".. image:: https://github.com/seatgeek/thefuzz/actions/workflows/ci.yml/badge.svg\n    :target: https://github.com/seatgeek/thefuzz\n\nTheFuzz\n=======\n\nFuzzy string matching like a boss. It uses `Levenshtein Distance \u003chttps://en.wikipedia.org/wiki/Levenshtein_distance\u003e`_ to calculate the differences between sequences in a simple-to-use package.\n\nRequirements\n============\n\n-  Python 3.8 or higher\n-  `rapidfuzz \u003chttps://github.com/maxbachmann/RapidFuzz/\u003e`_\n\nFor testing\n~~~~~~~~~~~\n-  pycodestyle\n-  hypothesis\n-  pytest\n\nInstallation\n============\n\nUsing pip via PyPI\n\n.. code:: bash\n\n    pip install thefuzz\n\n\nUsing pip via GitHub\n\n.. code:: bash\n\n    pip install git+git://github.com/seatgeek/thefuzz.git@0.19.0#egg=thefuzz\n\nAdding to your ``requirements.txt`` file (run ``pip install -r requirements.txt`` afterwards)\n\n.. code:: bash\n\n    git+ssh://git@github.com/seatgeek/thefuzz.git@0.19.0#egg=thefuzz\n\nManually via GIT\n\n.. code:: bash\n\n    git clone git://github.com/seatgeek/thefuzz.git thefuzz\n    cd thefuzz\n    python setup.py install\n\n\nUsage\n=====\n\n.. code:: python\n\n    \u003e\u003e\u003e from thefuzz import fuzz\n    \u003e\u003e\u003e from thefuzz import process\n\nSimple Ratio\n~~~~~~~~~~~~\n\n.. code:: python\n\n    \u003e\u003e\u003e fuzz.ratio(\"this is a test\", \"this is a test!\")\n        97\n\nPartial Ratio\n~~~~~~~~~~~~~\n\n.. code:: python\n\n    \u003e\u003e\u003e fuzz.partial_ratio(\"this is a test\", \"this is a test!\")\n        100\n\nToken Sort Ratio\n~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    \u003e\u003e\u003e fuzz.ratio(\"fuzzy wuzzy was a bear\", \"wuzzy fuzzy was a bear\")\n        91\n    \u003e\u003e\u003e fuzz.token_sort_ratio(\"fuzzy wuzzy was a bear\", \"wuzzy fuzzy was a bear\")\n        100\n\nToken Set Ratio\n~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    \u003e\u003e\u003e fuzz.token_sort_ratio(\"fuzzy was a bear\", \"fuzzy fuzzy was a bear\")\n        84\n    \u003e\u003e\u003e fuzz.token_set_ratio(\"fuzzy was a bear\", \"fuzzy fuzzy was a bear\")\n        100\n\nPartial Token Sort Ratio\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    \u003e\u003e\u003e fuzz.token_sort_ratio(\"fuzzy was a bear\", \"wuzzy fuzzy was a bear\")\n        84\n    \u003e\u003e\u003e fuzz.partial_token_sort_ratio(\"fuzzy was a bear\", \"wuzzy fuzzy was a bear\")\n        100\n\nProcess\n~~~~~~~\n\n.. code:: python\n\n    \u003e\u003e\u003e choices = [\"Atlanta Falcons\", \"New York Jets\", \"New York Giants\", \"Dallas Cowboys\"]\n    \u003e\u003e\u003e process.extract(\"new york jets\", choices, limit=2)\n        [('New York Jets', 100), ('New York Giants', 78)]\n    \u003e\u003e\u003e process.extractOne(\"cowboys\", choices)\n        (\"Dallas Cowboys\", 90)\n\nYou can also pass additional parameters to ``extractOne`` method to make it use a specific scorer. A typical use case is to match file paths:\n\n.. code:: python\n\n    \u003e\u003e\u003e process.extractOne(\"System of a down - Hypnotize - Heroin\", songs)\n        ('/music/library/good/System of a Down/2005 - Hypnotize/01 - Attack.mp3', 86)\n    \u003e\u003e\u003e process.extractOne(\"System of a down - Hypnotize - Heroin\", songs, scorer=fuzz.token_sort_ratio)\n        (\"/music/library/good/System of a Down/2005 - Hypnotize/10 - She's Like Heroin.mp3\", 61)\n\n.. |Build Status| image:: https://github.com/seatgeek/thefuzz/actions/workflows/ci.yml/badge.svg\n   :target: https://github.com/seatgeek/thefuzz\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseatgeek%2Fthefuzz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseatgeek%2Fthefuzz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseatgeek%2Fthefuzz/lists"}