{"id":37065708,"url":"https://github.com/pysnippet/fuzzymap","last_synced_at":"2026-01-14T07:41:44.999Z","repository":{"id":64062680,"uuid":"572867503","full_name":"pysnippet/fuzzymap","owner":"pysnippet","description":"The Fuzzy Map is a polymorph Python dictionary that always returns the value of the closest similar key.","archived":false,"fork":false,"pushed_at":"2023-05-25T07:17:34.000Z","size":32,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-28T01:04:23.175Z","etag":null,"topics":["dict","dictionary","fuzzy","fuzzywuzzy","map","match","matching","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pysnippet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-01T07:46:39.000Z","updated_at":"2024-08-14T09:48:07.000Z","dependencies_parsed_at":"2023-02-19T01:01:52.467Z","dependency_job_id":null,"html_url":"https://github.com/pysnippet/fuzzymap","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/pysnippet/fuzzymap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pysnippet%2Ffuzzymap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pysnippet%2Ffuzzymap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pysnippet%2Ffuzzymap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pysnippet%2Ffuzzymap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pysnippet","download_url":"https://codeload.github.com/pysnippet/fuzzymap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pysnippet%2Ffuzzymap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dict","dictionary","fuzzy","fuzzywuzzy","map","match","matching","python"],"created_at":"2026-01-14T07:41:44.281Z","updated_at":"2026-01-14T07:41:44.989Z","avatar_url":"https://github.com/pysnippet.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fuzzy Map \u003cimg src=\"https://github.com/pysnippet.png\" align=\"right\" height=\"64\" /\u003e\n\n[![PyPI](https://img.shields.io/pypi/v/fuzzymap.svg)](https://pypi.org/project/fuzzymap/)\n[![License](https://img.shields.io/pypi/l/fuzzymap.svg?color=blue)](https://github.com/pysnippet/fuzzymap/blob/master/LICENSE)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpysnippet%2Ffuzzymap.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpysnippet%2Ffuzzymap?ref=badge_shield)\n[![Tests](https://github.com/pysnippet/fuzzymap/actions/workflows/tests.yml/badge.svg)](https://github.com/pysnippet/fuzzymap/actions/workflows/tests.yml)\n\nThe Fuzzy Map is a polymorph Python dictionary that always returns the value of the closest similar key. This kind of\ndictionary returns the value of the exact key if there is such a key. Otherwise, it will return the value of the most\nsimilar key satisfying the given ratio. The exact mechanism works when setting a new or replacing an old key in the\ndictionary. If the key is not found and does not match any of the keys by the given ratio, it returns none.\n\n## A real-world example\n\nA live data parser collects the coefficients of sports games from different bookmakers at once, and then an analyzer\ntries to find the existing forks. Different bookmakers use different names for the same games. Some of them use the full\nnames, and others use names with a partial abbreviation that makes the analyzer's job harder to find and compare the\ncoefficients of the same game. Rather this could be hard without `FuzzyMap` that can find the game using the name used\nin one of the sources.\n\n```python\nfrom fuzzymap import FuzzyMap\n\nsource_1 = {\n    'Rapid Wien - First Vienna': {'w1': 1.93, 'x': 2.32, 'w2': 7.44},\n    'Al Bourj - Al Nejmeh': {'w1': 26, 'x': 11.5, 'w2': 1.05},\n    # hundreds of other games' data\n}\n\nsource_2 = FuzzyMap({\n    'Bourj FC - Nejmeh SC Beirut': {'w1': 32, 'x': 12, 'w2': 1.05},\n    'SK Rapid Wien - First Vienna FC': {'w1': 1.97, 'x': 2.3, 'w2': 8.2},\n    # hundreds of other games' data\n})\n\nfor game, odds1 in source_1.items():\n    odds2 = source_2[game]\n\n    # odds1 = {\"w1\": 1.93, \"x\": 2.32, \"w2\": 7.44}\n    # odds2 = {\"w1\": 1.97, \"x\": 2.3, \"w2\": 8.2}\n    handle_fork(odds1, odds2)\n```\n\nIn this code example, `source_1` and `source_2` are the dictionary of game and coefficients key-value pairs parsed from\ndifferent sources. And converting the `source_2` dictionary to the `FuzzyMap` dictionary makes it able to find the\ncorresponding game using the game's key used in the `source_1` dictionary.\n\n```mermaid\ngraph LR\n    src1team1[Rapid Wien - First Vienna] --\u003e src1coefs1[\"{'w1': 1.93, 'x': 2.32, 'w2': 7.44}\"]\n    src1team2[Al Bourj - Al Nejmeh] --\u003e src1coefs2[\"{'w1': 26, 'x': 11.5, 'w2': 1.05}\"]\n    src2team1[SK Rapid Wien - First Vienna FC] --\u003e src2coefs1[\"{'w1': 1.97, 'x': 2.3, 'w2': 8.2}\"]\n    src2team2[Bourj FC - Nejmeh SC Beirut] --\u003e src2coefs2[\"{'w1': 32, 'x': 12, 'w2': 1.05}\"]\n    src1team1 --\u003e src2coefs1\n    src1team2 --\u003e src2coefs2\n```\n\n## License\n\nCopyright (C) 2022 Artyom Vancyan. [GPLv2](https://github.com/pysnippet/fuzzymap/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpysnippet%2Ffuzzymap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpysnippet%2Ffuzzymap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpysnippet%2Ffuzzymap/lists"}