{"id":26159954,"url":"https://github.com/capjamesg/pattern-matching","last_synced_at":"2025-08-21T01:06:40.052Z","repository":{"id":259752147,"uuid":"879346518","full_name":"capjamesg/pattern-matching","owner":"capjamesg","description":"Find patterns in strings.","archived":false,"fork":false,"pushed_at":"2024-11-02T12:22:35.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-19T15:59:06.431Z","etag":null,"topics":["pattern-finding","python","string-pattern-identification"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/capjamesg.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-27T17:03:46.000Z","updated_at":"2024-11-02T12:22:38.000Z","dependencies_parsed_at":"2024-10-27T20:22:55.045Z","dependency_job_id":"95cc1067-e518-4458-8d50-8c1de7b4e8ae","html_url":"https://github.com/capjamesg/pattern-matching","commit_stats":null,"previous_names":["capjamesg/pattern-matching"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/capjamesg/pattern-matching","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capjamesg%2Fpattern-matching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capjamesg%2Fpattern-matching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capjamesg%2Fpattern-matching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capjamesg%2Fpattern-matching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capjamesg","download_url":"https://codeload.github.com/capjamesg/pattern-matching/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capjamesg%2Fpattern-matching/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271410635,"owners_count":24754757,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["pattern-finding","python","string-pattern-identification"],"created_at":"2025-03-11T11:55:18.018Z","updated_at":"2025-08-21T01:06:40.021Z","avatar_url":"https://github.com/capjamesg.png","language":"HTML","readme":"# Pattern Matching\n\nFind a pattern that matches a string.\n\nThis project can take a list of strings and find common patterns of words. For example, given the titles:\n\n```\nThis is a test\nThis is a coffee\nThis is a tea\n```\n\nThis project would return:\n\n```\nThis is a *\n```\n\nWhere `*` denotes the presence of any word.\n\nOr, given:\n\n```\nThis is a test\nThis isn't a test\nThis is of course a test\n```\n\nThe script will return:\n\n```\nThis * a test\n```\n\nThis project was designed to find patterns in URL slugs.\n\n## How to Use\n\nTo use this project, first clone this repository. Then, create a new Python file and add the code below:\n\n```python\nfrom .patterns import get_patterns, calculate_matches_from_examples\n\nurls = []\ntop_candidate = max(get_patterns(delimiter = \"-\").values(), key=len)\nmatches, _ = calculate_matches_from_examples(top_candidate, urls, delimiter = \"-\")\n\nprint(\"# of examples: \", len(examples))\nprint(f\"Pattern: {top_candidate}\")\nprint(f\"Match rate: {(matches / len(examples)) * 100:.2f}%\")\n\n# # of examples:  50\n# Pattern: ['*', 'and', '*']\n# Match rate: 74.00%\n```\n\nAdd a value for `urls`, then run the code. You can use any sequence of strings where there is a delimiter. If you use plain text, the delimiter should be a space.\n\n## License\n\nThis project is licensed under an [MIT license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapjamesg%2Fpattern-matching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapjamesg%2Fpattern-matching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapjamesg%2Fpattern-matching/lists"}