{"id":18788023,"url":"https://github.com/lunchb0ne/neuralcodegenerator","last_synced_at":"2025-04-13T13:20:46.996Z","repository":{"id":48705681,"uuid":"365472846","full_name":"Lunchb0ne/NeuralCodeGenerator","owner":"Lunchb0ne","description":"Code for C code generator","archived":false,"fork":false,"pushed_at":"2022-11-10T20:35:51.000Z","size":602,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T04:22:25.896Z","etag":null,"topics":["compiler","lexer","nlp","parser","similarity","spacy-nlp"],"latest_commit_sha":null,"homepage":"https://smartccodegen.azurewebsites.net/","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/Lunchb0ne.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":"2021-05-08T09:27:17.000Z","updated_at":"2023-05-15T09:55:47.000Z","dependencies_parsed_at":"2022-09-05T20:41:25.178Z","dependency_job_id":null,"html_url":"https://github.com/Lunchb0ne/NeuralCodeGenerator","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/Lunchb0ne%2FNeuralCodeGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lunchb0ne%2FNeuralCodeGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lunchb0ne%2FNeuralCodeGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lunchb0ne%2FNeuralCodeGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lunchb0ne","download_url":"https://codeload.github.com/Lunchb0ne/NeuralCodeGenerator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248718046,"owners_count":21150497,"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":["compiler","lexer","nlp","parser","similarity","spacy-nlp"],"created_at":"2024-11-07T20:57:16.188Z","updated_at":"2025-04-13T13:20:46.975Z","avatar_url":"https://github.com/Lunchb0ne.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NeuralCodeGenerator\n\nThis is a small project that uses a opinionated pseudocode and auugments it with Natural Language Processing to allow users to use more keywords that are similar to the ones already in use.\n\n```py\nstart\nassign ( num int )\nassign ( c int )\nallot ( i int )\ndefine ( flag int )\nassign flag to 0\ndisplay \"Enter the value to be checked \"\nread (num int)\nfor i from 2 to num\nrepetition\nc = num%i\nif c==0\nthen\nassign flag to 1\nendif\nendfor\nif flag==1\nthen\nprint \"The value \"\nprint (num int)\nprint \" is not prime\"\nelse\nprint \"The value \"\nprint (num int)\nprint \" is prime\"\nendif\nend\n```\n\nIt produces the C code as the following\n\n```c\n#include\u003cstdio.h\u003e\n\nvoid main()\n{\n    int num;\n    int c;\n    int i;\n    int flag;\n    flag=0;\n    printf(\"Enter the value to be checked \");\n    scanf(\"%d\",\u0026num);\n    for(i = 2 ; i \u003c= num ; i++)\n    {\n        c = num%i;\n        if(c == 0)\n        {\n            flag=1;\n        }\n    }\n    if(flag == 1)\n    {\n        printf(\"The value \");\n        printf(\"%d\",num);\n        printf(\" is not prime\");\n    }\n    else\n    {\n        printf(\"The value \");\n        printf(\"%d\",num);\n        printf(\" is prime\");\n    }\n}\n```\n\n## NLP Techniques Used \n\nPseudocode can vary between users, and to incorporate Natural Language and make translation easier, we make use of Similarity metrics. We use the Spacy module to check Similarity.\nOur model uses a very limited set of keywords to demonstrate the basic functionality.\nA user is free to use other words that correspond to a similar meaning to a word present in the dictionary, and it is then automatically mapped to perform the same functionality as illustrated below:\n\n![Similarity with existing keywords](./doc/sim.png)\n\nFor example, user may use the word \"whenever\" instead of \"if\" and \"during\" instead of \"while\", etc.\nThis increases the usability as it is able to use NLP techniques to extract the meaning behind the word.\n\n# Installation\n\nSimply execute the following after cloning the git repository to a suitable directory.\n\n```sh\npip install -r requirements.txt\n```\n\nThe script tries to download the `en_web_core_lg` model for spacy, this model uses ~800MB of memory, so please make sure that you have enough beforehand.\n\nNow you can finally use opyrator environment to test out the converter.\n\n# Running the project\n\nAfter all the install steps, you should launch the UI using\n\n```sh\nopyrator launch-ui converterfunc:C_Code_Generator\n```\n\nDoing so would prompt you to launch a beautiful UI allowing you to interactively test the converter.\n![ui](./doc/ui.png)\n\nYou can provide it some input in the message box.\n![message](./doc/input.png)\n\nThen you execute it, be wary that the execution times will depend on the length of the code and the performace of the host computer as it heavily relies on finding vector similarity.\n![output](./doc/c_code.png)\n\nPlease note that the project uses a compiled binary from the [Astyle Project](http://astyle.sourceforge.net/), and hence it's included in the source.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flunchb0ne%2Fneuralcodegenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flunchb0ne%2Fneuralcodegenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flunchb0ne%2Fneuralcodegenerator/lists"}