{"id":16271309,"url":"https://github.com/ikergarcia1996/basic-cyk-parser","last_synced_at":"2025-10-05T03:30:54.233Z","repository":{"id":133847853,"uuid":"165301579","full_name":"ikergarcia1996/Basic-CYK-Parser","owner":"ikergarcia1996","description":"Basic CYK-Parser written in python 3","archived":false,"fork":false,"pushed_at":"2019-01-11T20:34:35.000Z","size":49,"stargazers_count":9,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-10T23:51:55.783Z","etag":null,"topics":["cyk","cyk-algorithm","cyk-parser","grammar","grammar-parser","natural-language-processing","nlp","parser","parsing","python-3"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/ikergarcia1996.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":"2019-01-11T19:56:57.000Z","updated_at":"2024-05-31T16:47:22.000Z","dependencies_parsed_at":"2023-09-01T00:25:03.853Z","dependency_job_id":null,"html_url":"https://github.com/ikergarcia1996/Basic-CYK-Parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikergarcia1996%2FBasic-CYK-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikergarcia1996%2FBasic-CYK-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikergarcia1996%2FBasic-CYK-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikergarcia1996%2FBasic-CYK-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikergarcia1996","download_url":"https://codeload.github.com/ikergarcia1996/Basic-CYK-Parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235351385,"owners_count":18976061,"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":["cyk","cyk-algorithm","cyk-parser","grammar","grammar-parser","natural-language-processing","nlp","parser","parsing","python-3"],"created_at":"2024-10-10T18:13:15.225Z","updated_at":"2025-10-05T03:30:53.237Z","avatar_url":"https://github.com/ikergarcia1996.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a basic CYK Parser implemented in Python 3. This parser has been implemented for the \"Computational Linguistics: Morphology and Syntax\" course of the Language Analysis and Processing Master (http://ixa.si.ehu.es/master/?lang=en).\n\n# Files in the repository\n\n1. CYK_Parser.ipyn: Parser in jupyter notebook format\n2. CYK_Parser.ipyn: Parser in .py format\n3. example.py: Some examples of use (usage: python3 example.py)\n4. example_output.txt: output of the example.py script in txt format\n5. example_grammar*.txt: Some example grammars\n\n\n# Author\n```\nIker García Ferrero - ikergarcia1996\n```\n# Example Of Use\n \n```\n# Initialize the grammar and read the rules from a file\ng = Grammar('example_grammar1.txt')\n\n# Parse a sentence\ng.parse('astronomers saw stars with ears')\n\n# Print the table used for parsing the sentence\ng.print_parse_table()\n\n# Get the list of trees generated for the sentence\ntrees = g.get_trees()\n\n# Get the result of the production rule, VP, S, NP... \np = trees[0].get_type\n\n# Get the left child of the production rule\nl = trees[0].get_left\n\n# Get the right child of the production rule\nd = trees[0].get_right\n```\n\n ## Expected output\n\n \n```\nGrammar file readed succesfully. Rules readed:\nS --\u003e NP VP\nPP --\u003e P NP\nVP --\u003e V NP\nVP --\u003e VP PP\nNP --\u003e NP PP\nNP --\u003e astronomers\nNP --\u003e ears\nNP --\u003e saw\nV --\u003e saw\nNP --\u003e telescope\nNP --\u003e stars\nP --\u003e with\n\nApplied Rule: VP[2,2] --\u003e V[1,2] NP[1,3]\nApplied Rule: PP[2,4] --\u003e P[1,4] NP[1,5]\nApplied Rule: S[3,1] --\u003e NP[1,1] VP[2,2]\nApplied Rule: NP[3,3] --\u003e NP[1,3] PP[2,4]\nApplied Rule: VP[4,2] --\u003e V[1,2] NP[3,3]\nApplied Rule: VP[4,2] --\u003e VP[2,2] PP[2,4]\nApplied Rule: S[5,1] --\u003e NP[1,1] VP[4,2]\nApplied Rule: S[5,1] --\u003e NP[1,1] VP[4,2]\n----------------------------------------\nThe sentence IS accepted in the language\nNumber of possible trees: 2\n----------------------------------------\n\n-----------  ------------  ------  ------  ------\n['S', 'S']\n[]           ['VP', 'VP']\n['S']        []            ['NP']\n[]           ['VP']        []      ['PP']\n['NP']       ['NP', 'V']   ['NP']  ['P']   ['NP']\nastronomers  saw           stars   with    ears\n-----------  ------------  ------  ------  ------\n```\n\n# Example of grammar file\nThe program assumes that the grammar is a valid context-free grammar in CNF form (https://www.tutorialspoint.com/automata_theory/chomsky_normal_form.htm). Rules must be separated by lines. \n```\nS -\u003e NP VP\nPP -\u003e P NP\nVP -\u003e V NP\nVP -\u003e VP PP\nNP-\u003e NP PP\nNP -\u003e astronomers\nNP -\u003e ears\nNP -\u003e saw\nNP-\u003e telescope\nNP -\u003e stars\nP -\u003e with\nV -\u003e saw\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikergarcia1996%2Fbasic-cyk-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikergarcia1996%2Fbasic-cyk-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikergarcia1996%2Fbasic-cyk-parser/lists"}