{"id":16603368,"url":"https://github.com/dbrgn/ndfa","last_synced_at":"2025-09-04T16:41:41.775Z","repository":{"id":4105517,"uuid":"5214800","full_name":"dbrgn/ndfa","owner":"dbrgn","description":"Nondeterministic and deterministic finite automata","archived":false,"fork":false,"pushed_at":"2012-07-28T14:15:14.000Z","size":108,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-01T15:52:05.010Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbrgn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-28T14:08:05.000Z","updated_at":"2021-12-17T12:59:33.000Z","dependencies_parsed_at":"2022-09-17T16:21:49.882Z","dependency_job_id":null,"html_url":"https://github.com/dbrgn/ndfa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dbrgn/ndfa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fndfa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fndfa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fndfa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fndfa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbrgn","download_url":"https://codeload.github.com/dbrgn/ndfa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fndfa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273640968,"owners_count":25142239,"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-09-04T02:00:08.968Z","response_time":61,"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":[],"created_at":"2024-10-12T00:49:46.780Z","updated_at":"2025-09-04T16:41:40.820Z","avatar_url":"https://github.com/dbrgn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"ndfa - nondeterministic and deterministic finite automata\n=========================================================\n\nFinit state machine implementations.\n\n`ndfa.py` currently contains only a DFA class. NFA will follow later.\n\n\nUsage\n-----\n\nHere is an example of a DFA that accepts strings with an even number of 'a's.\n\n    from ndfa import DFA\n\n    states = list('01')\n    alphabet = list('ab')\n    transitions = {\n        ('0', 'a'): '1',\n        ('0', 'b'): '0',\n        ('1', 'a'): '0',\n        ('1', 'b'): '1',\n    }\n    start = '0'\n    accepts = list('0')\n\n    dfa = DFA(states, alphabet, transitions, start, accepts)\n\nTo test some words with this dfa:\n\n    \u003e\u003e\u003e dfa.test('')\n    True\n    \u003e\u003e\u003e dfa.test('aababa')\n    True\n    \u003e\u003e\u003e dfa.test('baaa')\n    False\n    \u003e\u003e\u003e dfa.test('foo')\n    Traceback (most recent call last):\n      File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n      File \"ndfa.py\", line 24, in test\n        'Symbol \"%s\" must be in alphabet.' % symbol\n    AssertionError: Symbol \"f\" must be in alphabet.\n\n\nOutput\n------\n\nThe DFA class uses the python logging module. To see basic output, set log\nlevel to INFO:\n\n    \u003e\u003e\u003e import logging\n    \u003e\u003e\u003e logging.basicConfig(level=logging.INFO, format='%(message)s')\n    \u003e\u003e\u003e dfa.test('aba')\n    Testing word \"aba\"...\n    Accepted: True\n\n...or to DEBUG for more verbose output:\n\n    \u003e\u003e\u003e import logging\n    \u003e\u003e\u003e logging.basicConfig(level=logging.DEBUG, format='%(message)s')\n    \u003e\u003e\u003e dfa.test('aba')\n    Testing word \"aba\"...\n    Initial state: 0\n    Current symbol: a\n    New state: 1\n    Current symbol: b\n    New state: 1\n    Current symbol: a\n    New state: 0\n    Final state: 0\n    Accepted: True\n\n\nLicense\n-------\n\nGPLv3, see LICENSE.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrgn%2Fndfa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbrgn%2Fndfa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrgn%2Fndfa/lists"}