{"id":18985025,"url":"https://github.com/dobraczka/eche","last_synced_at":"2025-04-19T20:26:17.810Z","repository":{"id":222849021,"uuid":"757510042","full_name":"dobraczka/eche","owner":"dobraczka","description":"🕸️ Little helper for handling entity clusters","archived":false,"fork":false,"pushed_at":"2024-03-22T14:22:52.000Z","size":98,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T21:16:16.394Z","etag":null,"topics":["clustering","connected-components","deduplication","entity-resolution","record-linkage","transitive-closure"],"latest_commit_sha":null,"homepage":"https://eche.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dobraczka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2024-02-14T16:34:22.000Z","updated_at":"2024-12-23T12:20:47.000Z","dependencies_parsed_at":"2024-11-08T16:26:51.475Z","dependency_job_id":"95b7ff39-215c-4f22-9677-bf25b1acabf2","html_url":"https://github.com/dobraczka/eche","commit_stats":null,"previous_names":["dobraczka/eche"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobraczka%2Feche","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobraczka%2Feche/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobraczka%2Feche/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobraczka%2Feche/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dobraczka","download_url":"https://codeload.github.com/dobraczka/eche/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249250812,"owners_count":21237961,"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":["clustering","connected-components","deduplication","entity-resolution","record-linkage","transitive-closure"],"created_at":"2024-11-08T16:24:08.243Z","updated_at":"2025-04-16T14:32:01.030Z","avatar_url":"https://github.com/dobraczka.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/dobraczka/eche/raw/main/docs/assets/logo.png\" alt=\"eche logo\", width=200/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/dobraczka/eche/actions/workflows/main.yml\"\u003e\u003cimg alt=\"Actions Status\" src=\"https://github.com/dobraczka/eche/actions/workflows/main.yml/badge.svg?branch=main\"\u003e\u003c/a\u003e\n\u003ca href='https://eche.readthedocs.io/en/latest/?badge=latest'\u003e\u003cimg src='https://readthedocs.org/projects/eche/badge/?version=latest' alt='Documentation Status' /\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/eche\"/\u003e\u003cimg alt=\"Stable python versions\" src=\"https://img.shields.io/pypi/pyversions/eche\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/astral-sh/ruff\"\u003e\u003cimg src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\" alt=\"Ruff\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nUsage\n=====\nEche provides a `ClusterHelper` class to conveniently handle entity clusters.\n\n```python\n  from eche import ClusterHelper\n  ch = ClusterHelper([{\"a1\", \"b1\"}, {\"a2\", \"b2\"}])\n  print(ch.clusters)\n  {0: {'a1', 'b1'}, 1: {'a2', 'b2'}}\n```\n\nAdd an element to a cluster\n\n```python\n  ch.add_to_cluster(0, \"c1\")\n  print(ch.clusters)\n  {0: {'a1', 'b1', 'c1'}, 1: {'a2', 'b2'}}\n```\n\nAdd a new cluster\n\n```python\n  ch.add({\"e2\", \"f1\", \"c3\"})\n  print(ch.clusters)\n  {0: {'a1', 'b1', 'c1'}, 1: {'a2', 'b2'}, 2: {'f1', 'e2', 'c3'}}\n```\n\nRemove an element from a cluster\n\n```python\n  ch.remove(\"b1\")\n  print(ch.clusters)\n  {0: {'a1', 'c1'}, 1: {'a2', 'b2'}, 2: {'f1', 'e2', 'c3'}}\n```\n\nThe ``__contains__`` function is smartly overloaded. You can check if an entity is in the `ClusterHelper`:\n\n```python\n  \"a1\" in ch\n  # True\n```\n\nIf a cluster is present\n\n```python\n  {\"c1\",\"a1\"} in ch\n  # True\n```\n\nAnd even if a link exists or not\n\n```python\n  (\"f1\",\"e2\") in ch\n  # True\n  (\"a1\",\"e2\") in ch\n  # False\n```\n\nTo know the cluster id of an entity you can look it up with\n\n```python\n  print(ch.elements[\"a1\"])\n  0\n```\n\nTo get members of a cluster either use\n\n```python\n  print(ch.members(0))\n  {'a1', 'b1', 'c1'}\n```\n\nor simply\n\n```python\n  print(ch[0])\n  {'a1', 'b1', 'c1'}\n```\n\nMore functions can be found in the [Documentation](https://eche.readthedocs.io).\n\nInstallation\n============\nSimply use `pip` for installation:\n```\npip install eche\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdobraczka%2Feche","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdobraczka%2Feche","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdobraczka%2Feche/lists"}