{"id":18913564,"url":"https://github.com/eerimoq/textparser","last_synced_at":"2025-07-05T17:36:32.639Z","repository":{"id":57467729,"uuid":"141811843","full_name":"eerimoq/textparser","owner":"eerimoq","description":"A text parser.","archived":false,"fork":false,"pushed_at":"2022-04-16T09:02:09.000Z","size":193,"stargazers_count":30,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T18:50:40.150Z","etag":null,"topics":["parsing","text-parsing"],"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/eerimoq.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"eerimoq"}},"created_at":"2018-07-21T12:49:27.000Z","updated_at":"2025-01-03T01:34:13.000Z","dependencies_parsed_at":"2022-09-19T09:01:24.085Z","dependency_job_id":null,"html_url":"https://github.com/eerimoq/textparser","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eerimoq%2Ftextparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eerimoq%2Ftextparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eerimoq%2Ftextparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eerimoq%2Ftextparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eerimoq","download_url":"https://codeload.github.com/eerimoq/textparser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249035297,"owners_count":21202052,"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":["parsing","text-parsing"],"created_at":"2024-11-08T10:08:15.095Z","updated_at":"2025-04-15T08:30:51.600Z","avatar_url":"https://github.com/eerimoq.png","language":"Python","funding_links":["https://github.com/sponsors/eerimoq"],"categories":[],"sub_categories":[],"readme":"About\n=====\n\nA text parser written in the Python language.\n\nThe project has one goal, speed! See the benchmark below more details.\n\nProject homepage: https://github.com/eerimoq/textparser\n\nDocumentation: http://textparser.readthedocs.org/en/latest\n\nCredits\n=======\n\n- Thanks `PyParsing`_ for a user friendly interface. Many of\n  ``textparser``'s class names are taken from this project.\n\nInstallation\n============\n\n.. code-block:: python\n\n    pip install textparser\n\nExample usage\n=============\n\nThe `Hello World`_ example parses the string ``Hello, World!`` and\noutputs its parse tree ``['Hello', ',', 'World', '!']``.\n\nThe script:\n\n.. code-block:: python\n\n   import textparser\n   from textparser import Sequence\n\n\n   class Parser(textparser.Parser):\n\n       def token_specs(self):\n           return [\n               ('SKIP',          r'[ \\r\\n\\t]+'),\n               ('WORD',          r'\\w+'),\n               ('EMARK',    '!', r'!'),\n               ('COMMA',    ',', r','),\n               ('MISMATCH',      r'.')\n           ]\n\n       def grammar(self):\n           return Sequence('WORD', ',', 'WORD', '!')\n\n\n   tree = Parser().parse('Hello, World!')\n\n   print('Tree:', tree)\n\nScript execution:\n\n.. code-block:: text\n\n   $ env PYTHONPATH=. python3 examples/hello_world.py\n   Tree: ['Hello', ',', 'World', '!']\n\nBenchmark\n=========\n\nA `benchmark`_ comparing the speed of 10 JSON parsers, parsing a `276\nkb file`_.\n\n.. code-block:: text\n\n   $ env PYTHONPATH=. python3 examples/benchmarks/json/speed.py\n\n   Parsed 'examples/benchmarks/json/data.json' 1 time(s) in:\n\n   PACKAGE         SECONDS   RATIO  VERSION\n   textparser         0.10    100%  0.21.1\n   parsimonious       0.17    169%  unknown\n   lark (LALR)        0.27    267%  0.7.0\n   funcparserlib      0.34    340%  unknown\n   textx              0.54    546%  1.8.0\n   pyparsing          0.68    684%  2.4.0\n   pyleri             0.88    886%  1.2.2\n   parsy              0.92    925%  1.2.0\n   parsita            2.28   2286%  unknown\n   lark (Earley)      2.34   2348%  0.7.0\n\n*NOTE 1: The parsers are not necessarily optimized for\nspeed. Optimizing them will likely affect the measurements.*\n\n*NOTE 2: The structure of the resulting parse trees varies and\nadditional processing may be required to make them fit the user\napplication.*\n\n*NOTE 3: Only JSON parsers are compared. Parsing other languages may\ngive vastly different results.*\n\nContributing\n============\n\n#. Fork the repository.\n\n#. Implement the new feature or bug fix.\n\n#. Implement test case(s) to ensure that future changes do not break\n   legacy.\n\n#. Run the tests.\n\n   .. code-block:: text\n\n      python3 -m unittest\n\n#. Create a pull request.\n\n.. _PyParsing: https://github.com/pyparsing/pyparsing\n.. _Hello World: https://github.com/eerimoq/textparser/blob/master/examples/hello_world.py\n.. _benchmark: https://github.com/eerimoq/textparser/blob/master/examples/benchmarks/json/speed.py\n.. _276 kb file: https://github.com/eerimoq/textparser/blob/master/examples/benchmarks/json/data.json\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feerimoq%2Ftextparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feerimoq%2Ftextparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feerimoq%2Ftextparser/lists"}