{"id":21685881,"url":"https://github.com/sodascience/regexmodel","last_synced_at":"2025-04-12T08:13:40.658Z","repository":{"id":191731952,"uuid":"681543635","full_name":"sodascience/regexmodel","owner":"sodascience","description":"Using regex to learn the structure of strings","archived":false,"fork":false,"pushed_at":"2024-09-17T08:36:43.000Z","size":1440,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-12T08:13:32.154Z","etag":null,"topics":["graph-model","python","regex","strings"],"latest_commit_sha":null,"homepage":"","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/sodascience.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":"2023-08-22T08:38:48.000Z","updated_at":"2024-12-19T13:01:52.000Z","dependencies_parsed_at":"2024-01-29T14:52:52.825Z","dependency_job_id":"1ea452d2-e1b4-4c81-8284-79c5dd3072a0","html_url":"https://github.com/sodascience/regexmodel","commit_stats":null,"previous_names":["sodascience/regexmodel"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sodascience%2Fregexmodel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sodascience%2Fregexmodel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sodascience%2Fregexmodel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sodascience%2Fregexmodel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sodascience","download_url":"https://codeload.github.com/sodascience/regexmodel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537144,"owners_count":21120711,"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":["graph-model","python","regex","strings"],"created_at":"2024-11-25T16:23:31.449Z","updated_at":"2025-04-12T08:13:40.637Z","avatar_url":"https://github.com/sodascience.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# regexmodel\n\nRegexmodel is a python package that uses a graph model to fit and synthesize structured strings.\nStructured strings are strings such as license plates, credit card numbers ip-addresses, and phone numbers. Regexmodel can infer a regex-like structure from a series of positive examples and create new samples\n(such as phone numbers etc.).\n\nFeatures:\n\n- Draw new synthetic values\n- Only on the numpy and polar libraries (faker for benchmarks).\n- Fast (on average \u003c 1 second for about 500 positive examples).\n- Can provide statistics on how good the regexmodel has fit your values using log likelihood.\n- Can be serialized and can be modified by hand.\n\n## Installation\n\nYou can install regexmodel using pip:\n\n```bash\npip install regexmodel\n```\n\nIf you want the latest version of git, use:\n\n```bash\npip install git+https://github.com/sodascience/regexmodel.git\n```\n\nIf you want to run the benchmarks, you should also install the faker package:\n\n```bash\npip install faker\n```\n\n## Using regexmodel\n\nFitting the regexmodel is as simple as:\n\n```python\nfrom regexmodel import RegexModel\n\nmodel = RegexModel.fit(your_values_to_fit, count_thres=10, method=\"accurate\")\n```\n\nThe `count_thres` parameter changes how detailed and time consuming the fit is. A higher threshold means\na shorter time to fit, but also a worse fit.\n\nThe `method` parameter determines the performance/how fast the model is trained. For better looking results,\nthe \"accurate\" method is advised. If the quickness of the fit is more important, then you can use the \"fast\" method. The \"accurate\" method is generally slow with very long/branching/unstructured strings.\n\nThen synthesizing a new value is done with:\n\n```python\nmodel.draw()\n```\n\n## Serialization\n\nThe regex model can be serialized so that it can be stored in for example a JSON file:\n\n```python\nimport json\nwith open(some_file, \"w\") as handle:\n    json.dump(model.serialize(), handle)\n```\n\nAnd deserialized:\n\n```python\nwith open(some_file, \"r\") as handle:\n    model = RegexModel(json.load(handle))\n```\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\nYou can contribute to the regexmodel package by giving feedback in the \"Issues\" tab, or by creating a pull request.\n\nTo create a pull request:\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\n\u003c!-- CONTACT --\u003e\n## Contact\n**Regexmodel** is a project by the [ODISSEI Social Data Science (SoDa)](https://odissei-data.nl/nl/soda/) team.\nDo you have questions, suggestions, or remarks on the technical implementation? File an issue in the issue tracker or feel free to contact [Raoul Schram](https://github.com/qubixes).\n\n\u003cimg src=\"soda.png\" alt=\"SoDa logo\" width=\"250px\"/\u003e \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsodascience%2Fregexmodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsodascience%2Fregexmodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsodascience%2Fregexmodel/lists"}