# ChatGPT Translation of Program Code for Image Sketch Abstraction
## 4 Methodology of the M-to-PY Conversion  
### The M-to-PY Methodology  
The methodology for the M-to-PY conversion for a complex project, such as a One-step Skeletonization, is an iterative process, that can be reproduced step-by-step. The key steps are presented below:  
* Select LLM(s) to work with;
* Understand the original MATLAB code _with the help of LLM(s)_;
* Identify conversion challenges;
* Develop the M-to-PY converter prototype _with the help of LLM(s)_;
* Develop an associated App (optional);
* Test and refine the converter _using test cases generated by LLM(s)_;
* Evaluate and learn from the result;
* Compare the results with existing tools. Selecting Large Language Models (LLMs) is a critical step in this methodology. The researchers mainly worked with several versions of ChatGPT, Bard, and Bing chatbots and with the GitHub Copilot tool. Considering the expected rise of new LLMs, it is important to be aware of the latest developments in the field. The LLMs should be chosen based on their ability to understand the context and semantics of the code, a significant advancement over other known converters that focus solely on code syntax. Understanding the Original MATLAB Code is the foundational step where the team comprehensively understands the code they work with. This is crucial as it identifies the key components of the code that need to be translated and the potential challenges that might arise during the conversion process. It is suggested to either ask the LLM(s) of choice to explain the code, its functions, modules, and classes, or add comments to each line of code (what the researchers had to do manually) or chat with the bot, for example, with the one embedded in the GitHub Copilot. Identifying Conversion Challenges involves understanding the differences between MATLAB and Python syntax, identifying MATLAB-specific functions that might not have direct equivalents in Python, and considering the complexity of the mathematical concepts used in the code. This step is instrumental but equally important as it might require most human intervention. The development of the M-to-PY Converter prototype can be significantly sped up with the help of LLMs. The research team manually worked with the chatbots on the ideas and layout drafts, then developed a prototype converter using the OpenAI API. As previously mentioned, the DALL-E 2 text-to-image generation tool created the Skeleton app logo. Key points to consider are simplicity, accessibility, responsiveness, equitability, and inclusivity. Developing an associated app is optional as it depends on the team's goals. For the researchers, developing the Skeleton app in parallel with the development of the converter was natural because of their skilled web programming. The Skeleton app was created along the side of the converter to demonstrate the practical application of M-to-PY conversion in the field of image sketch abstraction for 3D motion detection. Testing and refining the converter and the app is one of the critical steps in the process. The researchers combined several LLMs to complete this step. First, [PERSON], [PERSON], and [PERSON] were instructed to generate high-view-point test cases. [PERSON] was chosen as the best creator of those test scenarios, and then [PERSON] produced the actual code to test. [PERSON] proposed the following test cases. Their complete AI-generated code can be found online [22]:  
1. Complex Data Structure--Linked List;
2. Complex Algorithm--Quick Sort;
3. Complex Library--NumPy;
4. Error-Prone Code--Recursion;(5) Multithreading;  
(6) Modular code. As mentioned above, diverse and comprehensive testing parameters were employed in this study. These parameters encompass a broad spectrum of coding complexities and challenges, including complex data structures, intricate algorithms, advanced libraries, recursion handling, multithreading capabilities, and modular code [22]. While it seems that [PERSON] was an outsider in this process, its ability to browse the internet was very important in this study.