System
A system that automatically analyzes and comments code addresses the challenge of understanding poorly documented code, improving development efficiency by providing real-time, granular feedback.
Patent Information
- Application Number
- JP2024124003
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2026-02-12
AI Technical Summary
Engineers and programmers face challenges in understanding and deciphering poorly commented code, leading to delays and misunderstandings in the development process, as they need to learn new frameworks, libraries, and algorithms, and manually adding comments is time-consuming and difficult.
A system that reads and analyzes other people's program code, automatically adds appropriate comments based on the analysis results, and provides real-time feedback, allowing users to adjust the granularity of comments according to their needs.
Significantly reduces the time required to understand and maintain code by providing rapid, accurate analysis and comment generation, enhancing code comprehension and efficiency in software development.
Smart Images

Figure 2026022486000001_ABST
Abstract
Description
[Technical Field]
[0001] The technology of the present disclosure relates to a system. [Background technology]
[0002] Patent document 1 discloses a persona chatbot control method performed by at least one processor, the method including the steps of receiving a user utterance, adding the user utterance to a prompt including an instruction sentence related to a description of the chatbot character, encoding the prompt, and inputting the encoded prompt into a language model to generate a chatbot utterance in response to the user utterance. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Publication No. 2022-180282 Summary of the Invention [Problem to be solved by the invention]
[0004] Currently, many engineers and programmers need to learn new frameworks, libraries, and algorithms, but deciphering them requires a significant amount of time. Deciphering poorly commented code is particularly difficult, leading to delays and misunderstandings in the development process. Understanding other people's code, both in new and existing projects, also requires a significant amount of effort. The present invention aims to solve these problems and provide a system that efficiently aids in code understanding. [Means for solving the problem]
[0005] The present invention is a system that includes a means for reading other people's program code and analyzing its structure and function, a means for automatically adding appropriate comments to the program code based on the analysis results, and a means for providing the analyzed code to the user. In particular, by including a means for allowing the user to adjust the granularity of the comments in the analysis results, detailed explanations can be provided according to the user's needs. Furthermore, by supporting code analysis based on directory structure, it is possible to analyze the entire project, and by adding a means for providing analysis results in real time, rapid feedback is achieved. This allows users to quickly and reliably understand other people's code, significantly reducing the time required for learning and deciphering.
[0006] "Program code" refers to a set of instructions written to carry out a computer program.
[0007] "Analysis" is the process of examining and understanding the content, structure, and function of the target program code in detail.
[0008] A "comment" is a non-executable string inserted into program code that explains the intent or behavior of the code.
[0009] "User" refers to the engineers, programmers, and other users of this system.
[0010] A "system" is a set of devices or software that operate in an integrated manner with multiple elements and functions.
[0011] "Real-time" means that processing is performed immediately and the results are provided without delay.
[0012] A "directory structure" is a hierarchical organization of files and folders, and represents the overall structure of a project.
[0013] "Granularity" is a measure of how detailed or specific a comment is, and can be adjusted according to the user's needs.
[0014] "Feedback" refers to returning the results of the analysis to the user so that the user can use that information to take further action or make a decision.
[0015] A "framework" is a template or structure that provides basic functionality and structure in software development. [Brief explanation of the drawings]
[0016] [Figure 1] 1 is a conceptual diagram showing an example of the configuration of a data processing system according to a first embodiment. [Figure 2] 1 is a conceptual diagram showing an example of main functions of a data processing device and a smart device according to a first embodiment. [Figure 3] FIG. 10 is a conceptual diagram showing an example of the configuration of a data processing system according to a second embodiment. [Figure 4] FIG. 10 is a conceptual diagram showing an example of main functions of a data processing device and smart glasses according to a second embodiment. [Figure 5] FIG. 10 is a conceptual diagram showing an example of the configuration of a data processing system according to a third embodiment. [Figure 6] FIG. 11 is a conceptual diagram showing an example of main functions of a data processing device and a headset-type terminal according to a third embodiment. [Figure 7] FIG. 10 is a conceptual diagram showing an example of the configuration of a data processing system according to a fourth embodiment. [Figure 8] FIG. 10 is a conceptual diagram showing an example of main functions of a data processing device and a robot according to a fourth embodiment. [Figure 9] 1 shows an emotion map onto which multiple emotions are mapped. [Figure 10] 1 shows an emotion map onto which multiple emotions are mapped. [Figure 11] FIG. 3 is a sequence diagram showing a processing flow of the data processing system according to the first embodiment. [Figure 12] FIG. 10 is a sequence diagram showing the flow of processing in the data processing system in Application Example 1. [Figure 13] FIG. 10 is a sequence diagram showing the flow of processing in the data processing system according to the second embodiment when an emotion engine is combined. [Figure 14] FIG. 10 is a sequence diagram showing the flow of processing in the data processing system in Application Example 2 when an emotion engine is combined. DETAILED DESCRIPTION OF THE INVENTION
[0017] An example of an embodiment of a system according to the technology of the present disclosure will be described below with reference to the accompanying drawings.
[0018] First, the terms used in the following description will be explained.
[0019] In the following embodiments, a coded processor (hereinafter simply referred to as a "processor") may be a single arithmetic device or a combination of multiple arithmetic devices. Furthermore, a processor may be a single type of arithmetic device or a combination of multiple types of arithmetic devices. Examples of arithmetic devices include a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), a GPGPU (General-Purpose computing on Graphics Processing Units), and an APU (Accelerated Processing Unit).
[0020] In the following embodiments, a coded RAM (Random Access Memory) is a memory in which information is temporarily stored and is used as a working memory by a processor.
[0021] In the following embodiments, the coded storage is one or more non-volatile storage devices that store various programs, various parameters, etc. Examples of non-volatile storage devices include flash memory (SSD (Solid State Drive)), magnetic disks (e.g., hard disks), and magnetic tapes.
[0022] In the following embodiments, a communication I / F (Interface) with a symbol is an interface including a communication processor, an antenna, etc. The communication I / F controls communication between multiple computers. Examples of communication standards applied to the communication I / F include wireless communication standards including 5G (5th Generation Mobile Communication System), Wi-Fi (registered trademark), Bluetooth (registered trademark), etc.
[0023] In the following embodiments, "A and / or B" is synonymous with "at least one of A and B." In other words, "A and / or B" means that it may be only A, only B, or a combination of A and B. Furthermore, in this specification, the same concept as "A and / or B" is also applied when three or more things are expressed connected by "and / or."
[0024] [First embodiment]
[0025] FIG. 1 shows an example of the configuration of a data processing system 10 according to the first embodiment.
[0026] 1, a data processing system 10 includes a data processing device 12 and a smart device 14. An example of the data processing device 12 is a server.
[0027] The data processing device 12 includes a computer 22, a database 24, and a communication I / F 26. The computer 22 is an example of a "computer" according to the technology of the present disclosure. The computer 22 includes a processor 28, a RAM 30, and a storage 32. The processor 28, the RAM 30, and the storage 32 are connected to a bus 34. The database 24 and the communication I / F 26 are also connected to the bus 34. The communication I / F 26 is connected to a network 54. Examples of the network 54 include a WAN (Wide Area Network) and / or a LAN (Local Area Network).
[0028] The smart device 14 includes a computer 36, a reception device 38, an output device 40, a camera 42, and a communication I / F 44. The computer 36 includes a processor 46, a RAM 48, and a storage 50. The processor 46, the RAM 48, and the storage 50 are connected to a bus 52. The reception device 38, the output device 40, and the camera 42 are also connected to the bus 52.
[0029] The reception device 38 includes a touch panel 38A, a microphone 38B, and the like, and receives user input. The touch panel 38A detects contact with an indicator (for example, a pen or a finger) to receive user input by the touch of the indicator. The microphone 38B detects the user's voice to receive user input by voice. The control unit 46A transmits data indicating the user input received by the touch panel 38A and the microphone 38B to the data processing device 12. In the data processing device 12, the specific processing unit 290 acquires the data indicating the user input.
[0030] The output device 40 includes a display 40A and a speaker 40B, and presents data to the user 20 by outputting the data in a form of expression that the user 20 can perceive (for example, audio and / or text). The display 40A displays visible information such as text and images in accordance with instructions from the processor 46. The speaker 40B outputs audio in accordance with instructions from the processor 46. The camera 42 is a compact digital camera equipped with an optical system including a lens, aperture, and shutter, and an imaging element such as a CMOS (Complementary Metal-Oxide-Semiconductor) image sensor or a CCD (Charge Coupled Device) image sensor.
[0031] The communication I / F 44 is connected to a network 54. The communication I / Fs 44 and 26 control the exchange of various information between the processor 46 and the processor 28 via the network 54.
[0032] FIG. 2 shows an example of the main functions of the data processing device 12 and the smart device 14.
[0033] 2, in the data processing device 12, a specific process is performed by the processor 28. A specific processing program 56 is stored in the storage 32. The specific processing program 56 is an example of a "program" according to the technology of the present disclosure. The processor 28 reads the specific processing program 56 from the storage 32 and executes the read specific processing program 56 on the RAM 30. The specific process is realized by the processor 28 operating as a specific processing unit 290 in accordance with the specific processing program 56 executed on the RAM 30.
[0034] The storage 32 stores a data generation model 58 and an emotion identification model 59. The data generation model 58 and the emotion identification model 59 are used by the identification processing unit 290.
[0035] In the smart device 14, the processor 46 performs the reception output process. The storage 50 stores a reception output program 60. The reception output program 60 is used in conjunction with the specific processing program 56 by the data processing system 10. The processor 46 reads the reception output program 60 from the storage 50 and executes the read reception output program 60 on the RAM 48. The reception output process is realized by the processor 46 operating as the control unit 46A in accordance with the reception output program 60 executed on the RAM 48.
[0036] Next, a description will be given of the specific processing performed by the specific processing unit 290 of the data processing device 12. In the following description, the data processing device 12 will be referred to as a "server" and the smart device 14 will be referred to as a "terminal."
[0037] The present invention relates to a system that reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. This system is particularly advantageous in that it provides the user with analysis results in real time, enabling quick code understanding. Specific embodiments for carrying out the present invention are described below.
[0038] 1. Overall structure
[0039] This system consists of the following main elements:
[0040] Server: Responsible for analyzing program code and generating comments.
[0041] User terminal: Provides an interface for users to upload code and receive analysis results.
[0042] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0043] 2. Receiving the program code
[0044] A user selects a program code file from their device and uploads it to the server, which receives the HTTP POST request and stores the uploaded file on the server.
[0045] 3. Analysis of the program code
[0046] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of this code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[0047] 4. Automatic comment generation
[0048] The server receives the analysis results returned by the analysis engine and adds comments to the program code, so that the original code is provided to the user with appropriate comments inserted. The content of these comments can be adjusted to the required granularity, allowing for detailed explanations.
[0049] 5. Providing analysis results
[0050] The server then sends the analyzed program code, complete with added comments, back to the user, who can then review the analyzed code on their own device and deepen their understanding. The analysis results are provided in real time, so users can immediately check the content.
[0051] Specific examples
[0052] User-uploaded code example
[0053] Below is an example of the code that a user uploads when requesting analysis.
[0054] python
[0055] def multiply(a, b):
[0056] return ab
[0057] Example of analyzed code
[0058] After the server completes the analysis, the code returned to the user will have the following comment added:
[0059] python
[0060] The function multiply takes two arguments a and b and returns their product.
[0061] def multiply(a, b):
[0062] return ab
[0063] Description of the Examples
[0064] 1. The user selects the file containing the above code on their device and uploads it to the server.
[0065] 2. The server receives the contents of the uploaded file and sends it in text format to the analysis engine.
[0066] 3. The analysis engine analyzes the program code, understands its structure and function, and generates appropriate comments.
[0067] 4. The server generates code with added comments based on the analysis results obtained from the analysis engine.
[0068] 5. The server returns the parsed code with comments to the user in real time.
[0069] 6. Users receive analyzed code, allowing them to quickly understand the code.
[0070] In this way, the present invention significantly assists users in understanding the code by quickly and accurately analyzing other people's program code and adding appropriate comments.
[0071] The processing flow will be explained below.
[0072] Step 1:
[0073] The user prepares the program code they wish to analyze on their device, opens a browser on their device, and accesses the code analysis service's web application.
[0074] Step 2:
[0075] The user selects a program code file from the form in the web application and clicks the "Upload" button, which sends the program code file to the server.
[0076] Step 3:
[0077] The server receives an HTTP POST request. The server checks whether the file exists and returns an error response if the file does not exist. If the file exists, it reads the contents of the file in byte format, converts it to UTF-8 encoding, and retrieves it as a string.
[0078] Step 4:
[0079] The server sends a program code string to the analysis engine. At this time, the server generates an analysis request to the analysis engine to explain the structure and function of the code. Specifically, the server creates a prompt containing the content of the code and sends it to the analysis engine.
[0080] Step 5:
[0081] The analysis engine analyzes the program code. The analysis engine analyzes the received code, understands its structure and function, and generates appropriate comments. This analysis includes checking the code's syntax and analyzing its functions.
[0082] Step 6:
[0083] The analysis engine sends the results of the analysis back to the server, which receives the program code with the added comments and processes it as analyzed code.
[0084] Step 7:
[0085] The server returns the analysis results to the user. Specifically, it generates the analyzed code as a response in JSON format and returns it to the user's browser.
[0086] Step 8:
[0087] The user receives the analysis results and checks the analyzed code in the browser. The user can refer to the added comments to deepen their understanding of the code. Based on the analysis results, it becomes possible to quickly and accurately understand other people's code.
[0088] Example 1
[0089] Next, a description will be given of Example 1. In the following description, the data processing device 12 will be referred to as a "server" and the smart device 14 will be referred to as a "terminal."
[0090] Analyzing program code and adding appropriate comments is an important task in software development. However, doing it manually can be very time-consuming, and it can be difficult to understand the structure and function of code, especially when the code was written by someone else. The purpose of this invention is to solve these problems and perform real-time code analysis and comment generation, allowing users to quickly and accurately understand the code.
[0091] The specific processing by the specific processing unit 290 of the data processing device 12 in the first embodiment is realized by the following means.
[0092] In this invention, the server includes means for reading program code of others and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to a user, means for using natural language processing technology to analyze the program code, means for a user to upload a program code file, means for receiving an HTTP request and saving the program code file, means for sending the program code to an analysis engine and receiving the analysis results, means for inserting comments into the program code and generating analyzed code, and means for returning the analyzed code to the user. This makes it possible to automatically analyze the structure and function of program code and insert appropriate comments in real time.
[0093] "Someone else's program code" means that the program in question was created by another developer or group, not by you.
[0094] "Analysis methods" refers to a set of processes and techniques for reading program code and identifying and extracting its structure and functionality.
[0095] "Method for automatically adding comments" refers to a technology or process that automatically inserts appropriate comments into program code based on analysis results.
[0096] "User provision means" refers to the technology or process for returning and providing the analyzed program code to the user in an appropriate format.
[0097] "Natural language processing technology" is an artificial intelligence technology for understanding and processing human language, and is used here to analyze program code and generate comments.
[0098] "Uploading method" refers to the technology or process by which a user sends a file from their device to a server.
[0099] "HTTP request receiving means" refers to the technology or process by which a server receives an HTTP request sent from a user's terminal.
[0100] "File storage means" refers to the technology or process for temporarily storing received program code files on the server side.
[0101] "Analysis engine transmission means" refers to the technology or process by which the server sends program code to the analysis engine and receives the analysis results.
[0102] "Comment insertion means" refers to a technique or process for appropriately inserting comments returned from the analysis engine into the original program code.
[0103] "Analyzed code generator" refers to a technique or process for generating commented program code.
[0104] "Real-time delivery means" refers to the technology or process for instantly returning and delivering the generated analyzed code to the user.
[0105] 1. System Configuration
[0106] The system of this invention is designed to read someone else's program code, analyze its structure and function, and automatically add appropriate comments. The system consists of the following main components:
[0107] Server: Responsible for analyzing program code and generating comments.
[0108] User terminal: Provides an interface for users to upload code and receive analysis results.
[0109] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0110] 2. Upload the program code
[0111] The user selects a program code file on their device and uploads it to the server using the browser's file selection interface. This requires a standard web browser and an internet connection. When the user presses the upload button, the device sends the selected file data to the server in the body of an HTTP POST request.
[0112] 3. Receiving and storing on the server
[0113] The server parses the received HTTP POST request, extracts the file data from the body, and stores the extracted data in temporary storage on the server, which is typically a specific directory on a disk.
[0114] 4. Analysis of the program code
[0115] The server retrieves the saved file path and reads the file in text format. This text data is passed to an analysis engine. The analysis engine uses static analysis techniques and natural language processing (NLP) to analyze the code structure and functionality. NLP techniques include, for example, analysis algorithms written in Python.
[0116] 5. Comment Generation
[0117] The analysis engine generates explanatory comments for each part of the program code based on the results of static analysis. It uses natural language generation (NLG) technology to output comments in a format that is easy for humans to understand, explaining what each line of the program does.
[0118] 6. Inserting Comments
[0119] The server then inserts the comments returned by the parsing engine into the original program code appropriately, taking care not to alter the original code. For example, comments are added just before function definitions or at the beginning of loops. Comments are also inserted at the correct indentation level to maintain code readability.
[0120] 7. Return of analysis results
[0121] The server generates the program code with the comments inserted as a text file and returns it to the user's device in the form of an HTTP response, with an HTTP status code of 200 indicating that the request was processed successfully.
[0122] 8. Displaying the results
[0123] The user receives the HTTP response sent back from the server on their device. The response is displayed in the device's browser or text editor. The user can view the program code with properly added comments, allowing them to quickly understand the code.
[0124] Specific examples
[0125] Target program code
[0126] Below is an example of the code that a user uploads when requesting analysis.
[0127] def multiply(a, b):
[0128] return ab
[0129] Analyzed Code
[0130] After the server completes the analysis, the code returned to the user will have the following comment added:
[0131] The function multiply takes two arguments a and b and returns their product.
[0132] def multiply(a, b):
[0133] return ab
[0134] Prompt Sentence Examples
[0135] "Please analyze the following program code and add comments that explain its functionality:
[0136] def multiply(a, b):
[0137] return ab"
[0138] In this way, users can quickly and accurately understand other people's program code. This system significantly supports the understanding and maintenance of program code, especially in software development.
[0139] The flow of the identification process in the first embodiment will be described with reference to FIG.
[0140] Step 1:
[0141] A user selects a program code file on his / her device and uploads it to the server through the file selection interface of the web browser. As input, there is the program code file selected by the user. The user selects the program code file in the browser's file selection dialog and clicks the upload button. As output, the uploaded file data is sent to the server in the form of an HTTP POST request.
[0142] Step 2:
[0143] The server parses the received HTTP POST request and extracts the program code file data from its body. The input is the HTTP POST request sent to the server. To extract the data, the server parses the received request and retrieves the file data from the body. This data is saved in temporary storage and the directory path to the save location is output.
[0144] Step 3:
[0145] The server obtains the path of the saved program code file and reads the file in text format. The input is the directory path of the saved file. Using file system operations, it reads the text data from the specified file directory. This text data is output and sent to the analysis engine.
[0146] Step 4:
[0147] The analysis engine analyzes the text data of the received program code. The input is the text data of the program code. The analysis engine uses natural language processing and static analysis techniques to analyze the structure and function of the code. The data is processed to understand the meaning and function of each code block. The output is the analysis results.
[0148] Step 5:
[0149] The analysis engine generates appropriate comments for the program code based on the analysis results. The input is the structure and function information of the analyzed code. Natural language generation technology is used to create comments that are easy for humans to understand. The generated comments are obtained as the output.
[0150] Step 6:
[0151] The server inserts the comments returned by the analysis engine into the original program code appropriately. As input, it has the generated comments and the original program code. It adds the comments to the program code at the appropriate positions, adjusting the indentation level while preserving the code structure. As output, it generates the parsed code with the added comments.
[0152] Step 7:
[0153] The server returns the parsed code with the comments inserted to the user as an HTTP response. As input, it has the parsed code with the comments added. It generates an HTTP response and sends the parsed code with HTTP status code 200 to the user's device. As output, the parsed code is displayed in the browser.
[0154] Step 8:
[0155] The user receives the HTTP response returned from the server on their device and checks the parsed code in a browser or text editor. The input is the parsed code HTTP response. The user displays the returned code and checks the code with added comments to deepen their understanding. The output is the parsed code that has been understood.
[0156] In this way, by going through each step, the user can quickly and accurately understand program code created by others.
[0157] (Application example 1)
[0158] Next, a description will be given of Application Example 1. In the following description, the data processing device 12 will be referred to as a "server" and the smart device 14 will be referred to as a "terminal."
[0159] The program code for robots used in factories is complex, and maintaining and debugging it requires a great deal of time and effort. This requires a method to quickly understand the code. Another issue is that if the content and detail of comments are inappropriate, the efficiency of engineers' work will decrease.
[0160] The specific processing by the specific processing unit 290 of the data processing device 12 in the application example 1 is realized by the following means.
[0161] In this invention, the server includes means for reading other people's program code and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, and means for analyzing the robot's program code and automatically adding comments. This not only enables the robot's program code to be understood quickly, but also makes maintenance and debugging more efficient since appropriate comments are automatically added.
[0162] "Other person's program code" refers to program code that is not created by the user himself / herself but is created by a third party.
[0163] "Structure" refers to the physical arrangement and organization of a program, such as the layout of program code, function hierarchy, and flow control.
[0164] "Function" refers to the specific task or action that program code performs, and indicates the role of each code block.
[0165] "Analyzing" refers to the process of examining the structure and function of program code in detail to understand its properties and workings.
[0166] "Comments" refer to text information that describes the meaning of a specific part of program code, an overview of processing, details of operation, etc.
[0167] "Add automatically" means that the system automatically adds the necessary comments to the program code without the user having to manually enter them.
[0168] "Analyzed code" refers to program code that has been subjected to analytical means to understand its structure and function and to have appropriate comments added.
[0169] "Providing to the user" means displaying the analyzed code on the user's terminal or making it available for download.
[0170] "Robot program code" refers to program code written to control robots used in factories, etc.
[0171] The term "means" refers to a method or system component for realizing a specific function or process in the present invention.
[0172] The system for realizing this invention reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. It can be used particularly to streamline maintenance and debugging of program code for robots operating in factories.
[0173] The system consists of the following main components:
[0174] 1. Server:
[0175] The server is a node that is responsible for the main processing of program code analysis and comment generation. The server includes the following hardware and software:
[0176] Hardware: A computer with a high-performance CPU, memory, and storage
[0177] Software: Operating system (e.g., Ubuntu), code analysis engine (e.g., AST analysis tool), generative AI model (e.g., GPT-4 using the transformers library)
[0178] 2. User Device:
[0179] The user terminal provides an interface for users to upload program code and receive analysis results. It includes the following hardware and software:
[0180] Hardware: Personal computers, tablet devices
[0181] Software: Web browser (e.g. Google Chrome)
[0182] 3. Design:
[0183] The system is designed according to the following steps:
[0184] Receiving program code: The user selects a program code file from their device and uploads it to the server. The server receives the HTTP POST request and stores the uploaded file on the server.
[0185] Analysis of program code: The server reads the received program code in text format and sends it to the analysis engine, which analyzes the structure and function of the code to understand what processing is taking place at each step.
[0186] Automatic comment generation: The server receives the analysis results returned by the analysis engine and adds comments to the program code. It uses a generative AI model (e.g., GPT-4) to generate appropriate comments for the code.
[0187] Providing analysis results: The server returns the analyzed program code with added comments to the user, allowing the user to review the analyzed code on their own device and deepen their understanding.
[0188] 4. Example:
[0189] Example code:
[0190] Below is an example of the code that a user uploads when requesting analysis.
[0191] python
[0192] def move_forward(steps):
[0193] for _ in range(steps):
[0194] execute_step()
[0195] def turn(direction):
[0196] if direction == "left":
[0197] turn_left()
[0198] elif direction == "right":
[0199] turn_right()
[0200] After the server completes the analysis, the code returned to the user will have the following comment added:
[0201] python
[0202] The move_forward function performs a forward movement for a given number of steps.
[0203] def move_forward(steps):
[0204] for _ in range(steps):
[0205] execute_step()
[0206] The turn function performs a left or right turn depending on the direction.
[0207] def turn(direction):
[0208] if direction == "left":
[0209] turn_left()
[0210] elif direction == "right":
[0211] turn_right()
[0212] Example prompt sentence:
[0213] Use the following prompt for the generative AI model:
[0214] Analyze the program code and add appropriate comments for each function and process.
[0215] code:
[0216] def move_forward(steps):
[0217] for _ in range(steps):
[0218] execute_step()
[0219] def turn(direction):
[0220] if direction == "left":
[0221] turn_left()
[0222] elif direction == "right":
[0223] turn_right()
[0224] This system automates the analysis and commenting of robot program code, allowing engineers to quickly understand the code, thereby making maintenance and debugging more efficient.
[0225] The flow of the specific processing in the application example 1 will be described with reference to FIG.
[0226] Step 1:
[0227] The user uses the terminal to select their program code file (e.g., robot_control.py) and upload it to the server. Specifically, the user selects the file from their local disk and sends an HTTP POST request to the server through the web interface. The input is the program code file, and the output is the file submission.
[0228] Step 2:
[0229] The server saves the received program code in text format and sends it to the analysis engine. The server receives the file data from the HTTP request and stores it temporarily. At this point, the file is saved in a temporary directory on the server. The input is the uploaded file to the server, and the output is transferred to the analysis engine.
[0230] Step 3:
[0231] The analysis engine analyzes the structure and function of the received program code. Specifically, it uses an AST (Abstract Syntax Tree) analysis tool to analyze the code structure and understand the role of each function and processing block. As a result of the analysis, comment candidates are generated for each processing part. The input is the program code in text format, and the output is structural information and comment candidates as the analysis results.
[0232] Step 4:
[0233] The server receives the structural information and comment candidates returned by the analysis engine and adds comments to the program code. Using a generative AI model (e.g., GPT-4), it generates detailed comments for each part of the code and inserts them into the original program code. This turns the program code into analyzed code with comments. The input is the analysis result of the analysis engine, and the output is the program code with the added comments.
[0234] Step 5:
[0235] The server returns the analyzed program code with comments to the user. Specifically, the server generates an analyzed code file and provides it to the user's device as a download link. The user can obtain and review the analyzed code through the link. The input is the program code file with comments added, and the output is the file provided to the user.
[0236] The above steps allow the robot program code to be analyzed and commented efficiently and automatically, greatly improving the efficiency of the engineering process.
[0237] Furthermore, an emotion engine that estimates the user's emotion may be combined. That is, the identification processing unit 290 may estimate the user's emotion using the emotion identification model 59 and perform identification processing using the user's emotion.
[0238] The present invention combines an emotion engine with a system that reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. This system is particularly advantageous in that it provides the user with the analysis results in real time and adjusts the content and timing of the comments according to the user's emotions. Specific embodiments for implementing the present invention are described below.
[0239] 1. Overall structure
[0240] This system consists of the following main elements:
[0241] Server: Responsible for analyzing program code and generating comments.
[0242] User terminal: Provides an interface for users to upload code and receive analysis results.
[0243] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0244] Emotion engine: An engine that recognizes user emotions and reflects them in analysis results and comment content.
[0245] 2. Receiving the program code
[0246] A user selects a program code file from their device and uploads it to the server, which receives the HTTP POST request and stores the uploaded file on the server.
[0247] 3. Analysis of the program code
[0248] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of the code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[0249] 4. User Emotion Recognition
[0250] When a user uses the system, the emotion engine acquires emotion data from the user's facial expressions, voice tone, etc. The emotion engine analyzes the acquired emotion data and determines the user's current emotional state.
[0251] 5. Automatic comment generation and moderation
[0252] The server receives the analysis results from the analysis engine and adds comments to the program code. At this time, it adjusts the content and expression of the comments based on the emotional information obtained from the emotion engine. For example, if the user is feeling stressed, the comments can be made more polite and kind.
[0253] 6. Provision of analysis results
[0254] The server then returns the analyzed program code with the added comments to the user. This process also utilizes information from the emotion engine to provide feedback at a time appropriate to the user's emotional state, increasing the user's receptivity to the analysis results.
[0255] Specific examples
[0256] User-uploaded code example
[0257] Below is an example of the code that a user uploads when requesting analysis.
[0258] python
[0259] def multiply(a, b):
[0260] return ab
[0261] Example of analyzed code
[0262] After the server completes the analysis, the code returned to the user will have the following comment added:
[0263] python
[0264] The function multiply takes two arguments a and b and returns their product.
[0265] def multiply(a, b):
[0266] return ab
[0267] Description of the Examples
[0268] 1. The user selects the file containing the above code on their device and uploads it to the server.
[0269] 2. The server receives the contents of the uploaded file and sends it in text format to the analysis engine.
[0270] 3. The analysis engine analyzes the program code, understands its structure and function, and generates appropriate comments.
[0271] 4. The emotion engine recognizes the user's emotions and adjusts the content of the analysis results and the timing of feedback based on that information.
[0272] 5. The server uses the information from the emotion engine to generate parsed code with added comments.
[0273] 6. The server returns the parsed code with comments added to it to the user in real time.
[0274] 7. The user receives the analysis results, checks the analyzed code in the browser, and deepens their understanding.
[0275] In this way, the present invention significantly supports users' understanding of the code by quickly and accurately analyzing other people's program code and adding appropriate comments. Furthermore, by adjusting the content and timing of comments based on the user's emotional information, the user experience can be improved.
[0276] The processing flow will be explained below.
[0277] Step 1:
[0278] The user prepares the program code they wish to analyze on their device, and then accesses the code analysis service's web application from their device.
[0279] Step 2:
[0280] A user selects a program code file from a form in a web application and clicks the "Upload" button, which sends the program code file to the server.
[0281] Step 3:
[0282] The server receives an HTTP POST request. The server checks whether the file exists and returns an error response if the file does not exist. If the file exists, it reads the contents of the file in byte format, converts it to UTF-8 encoding, and retrieves it as a string.
[0283] Step 4:
[0284] The server sends a program code string to the analysis engine. At this time, the server generates an analysis request to the analysis engine to explain the structure and function of the code. Specifically, the server creates a prompt containing the content of the code and sends it to the analysis engine.
[0285] Step 5:
[0286] The analysis engine analyzes the program code. The analysis engine analyzes the received code, understands its structure and function, and generates appropriate comments. This analysis includes checking the code's syntax and analyzing its functions.
[0287] Step 6:
[0288] The emotion engine recognizes the user's emotions. When a user uses the system, the emotion engine acquires emotional data from the user's facial expressions and tone of voice, and analyzes and judges their emotional state.
[0289] Step 7:
[0290] The server receives the analysis results returned by the analysis engine and adds comments to the program code. At this time, the server adjusts the content and expression of the comment based on the information from the emotion engine. For example, if the user is feeling stressed, the comment will be made more polite and kind.
[0291] Step 8:
[0292] The server returns the analyzed program code with added comments to the user. Utilizing information from the emotion engine, feedback is provided at a time appropriate to the user's emotional state. This increases the user's receptivity to the analysis results.
[0293] Step 9:
[0294] The user receives the analysis results and checks the analyzed code in the browser. The user can refer to the added comments to deepen their understanding of the code. Based on the analysis results, it becomes possible to quickly and accurately understand other people's code.
[0295] Example 2
[0296] Next, a description will be given of Example 2. In the following description, the data processing device 12 will be referred to as a "server" and the smart device 14 will be referred to as a "terminal."
[0297] While conventional program code analysis systems have the ability to analyze code structure and function and automatically add comments, they have the problem of being unable to adjust the content of comments or the timing of feedback depending on the user's emotions and situation. This results in a suboptimal user experience, making it difficult to provide appropriate support to help users understand the code, especially in stressful situations.
[0298] The identification process by the identification processing unit 290 of the data processing device 12 in the second embodiment is realized by the following means. In this invention, the server includes means for reading program code of others and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, and means for recognizing the user's emotions and adjusting the content and timing of the comments. This makes it possible to add optimal comments and feedback according to the user's emotions, and is expected to improve the user experience.
[0299] "Third party program code" refers to the source code of a program created by a third party other than the code creator.
[0300] "Structure" refers to the components of program code, their arrangement, and their relationships.
[0301] "Function" refers to the specific operations and processing content of the program code.
[0302] "Means of analysis" refers to techniques and tools for understanding the structure and function of program code.
[0303] "Appropriate comments" refers to information such as explanatory text inserted to help understand program code.
[0304] "Automatic addition" refers to a method in which comments are generated and inserted automatically by the system rather than manually.
[0305] "Analyzed code" means program code whose structure and function have been analyzed using analytical tools and whose appropriate comments have been added.
[0306] "Means for providing to the user" refers to methods and tools for transmitting or displaying the analyzed code to the user.
[0307] "Means for recognizing a user's emotions and adjusting the content and timing of comments" refers to methods and tools that analyze a user's current emotional state and change the tone and timing of comments based on that.
[0308] 1. Overall structure
[0309] The system of the present invention comprises the following main elements: This system provides a function to analyze other people's program code and automatically add appropriate comments based on the user's sentiment.
[0310] Server: Responsible for analyzing program code and generating comments.
[0311] User terminal: Provides an interface for users to upload code and receive analysis results.
[0312] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0313] Emotion engine: An engine that recognizes user emotions and reflects them in analysis results and comment content.
[0314] 2. Receiving the program code
[0315] The user selects a program code file from their device and uploads it to the server using an HTTP POST request. The server then stores the uploaded file in its internal storage.
[0316] 3. Analysis of the program code
[0317] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of the code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[0318] 4. User Emotion Recognition
[0319] When a user uses the system, the emotion engine acquires emotion data from the user's facial expressions, voice tone, etc. The emotion engine analyzes the acquired emotion data and determines the user's current emotional state.
[0320] 5. Automatic comment generation and moderation
[0321] The server receives the analysis results from the analysis engine and adds comments to the program code. At the same time, it adjusts the content and expression of the comments based on the emotional information obtained from the emotion engine. For example, if the user is feeling stressed, the comments can be made more polite and kind.
[0322] 6. Provision of analysis results
[0323] The server then returns the analyzed program code with the added comments to the user. This process also utilizes information from the emotion engine to provide feedback at a time appropriate to the user's emotional state, increasing the user's receptivity to the analysis results.
[0324] Specific examples
[0325] User-uploaded code example
[0326] Below is an example of the code that a user uploads when requesting analysis.
[0327] python
[0328] def multiply(a, b):
[0329] return ab
[0330] Example of analyzed code
[0331] After the server completes the analysis, the code returned to the user will have the following comment added:
[0332] python
[0333] The function multiply takes two arguments a and b and returns their product.
[0334] def multiply(a, b):
[0335] return ab
[0336] Prompt Sentence Examples
[0337] An example of a prompt sentence that the user enters into the system is as follows:
[0338] "Please analyze this code and add appropriate comments."
[0339] In this way, the present invention significantly supports users' understanding of the code by quickly and accurately analyzing other people's program code and adding appropriate comments. Furthermore, by adjusting the content and timing of comments based on the user's emotional information, the user experience can be improved.
[0340] The flow of the identification process in the second embodiment will be described with reference to FIG.
[0341] Step 1:
[0342] The user selects a program code file on their device that they wish to analyze. The selected file contains code data in text format. The user then uploads the file to the server using an HTTP POST request via a browser interface.
[0343] Input: User selected program code file
[0344] Output: Code data sent to the server via an HTTP POST request
[0345] Specific working example:
[0346] The user clicks the "Choose File" button in their browser.
[0347] The user selects a code file to analyze from their computer (e.g., multiply.py).
[0348] When the user clicks the "Upload" button, an HTTP POST request is sent to the server.
[0349] Step 2:
[0350] The server analyzes the HTTP POST request received from the user, extracts the contents of the code file, and saves the contents in the server's storage.
[0351] Input: HTTP POST request from user (program code file)
[0352] Output: Code file saved in server storage
[0353] Specific working example:
[0354] The server receives an HTTP POST request.
[0355] The server extracts the code from the request body and saves it in the specified directory in storage (e.g. / uploads / multiply.py).
[0356] Step 3:
[0357] The server reads the stored program code in text format and sends the text data to the analysis engine for syntax analysis. The analysis engine performs static and syntax analysis to understand the structure and function of the code.
[0358] Input: Code file stored in the server storage
[0359] Output: Text data passed to the analysis engine
[0360] Specific working example:
[0361] The server reads the saved code file.
[0362] The read text data is sent to the analysis engine.
[0363] The analysis engine analyzes the code's functions, variables, and logic flow.
[0364] Step 4:
[0365] As users interact with the system, the emotion engine captures their facial expressions and vocal tone in real time and analyzes the data to determine their emotional state, such as relaxed, stressed, or confused.
[0366] Input: User's facial expression, voice tone data
[0367] Output: Parsed user's emotional state
[0368] Specific working example:
[0369] The emotion engine collects data using the camera and microphone on the user's device.
[0370] The emotion engine analyzes the collected data in real time and classifies the user's emotions (e.g., stress state).
[0371] Step 5:
[0372] The server receives the analysis results from the analysis engine and adds appropriate comments to the program code, adjusting the content and expression of the comments based on the user's emotional state obtained from the emotion engine.
[0373] Input: Code analysis results from the analysis engine, user emotional state from the emotion engine
[0374] Output: Parsed code with comments added
[0375] Specific working example:
[0376] The server receives the results from the analysis engine, including the analysis information and generated comments for each code block.
[0377] The server receives the user's emotional state data from the emotion engine and makes adjustments, such as when to use a gentler tone or polite expressions.
[0378] The server adds comments to the code and generates the final parsed code.
[0379] Step 6:
[0380] The server then returns the analyzed program code with the added comments to the user, utilizing information from the emotion engine to provide optimal feedback based on the user's emotional state.
[0381] Input: Commented and parsed program code
[0382] Output: Parsed code that is sent back to the user
[0383] Specific working example:
[0384] The server generates the parsed code and sends it to the user as an HTTP response.
[0385] Based on the information from the emotion engine, the server determines the timing when the user is most receptive and returns the analysis results.
[0386] This series of steps allows users to quickly and accurately analyze and comment on other people's program code, making the most of that information to deepen their understanding.
[0387] (Application example 2)
[0388] Next, a description will be given of Application Example 2. In the following description, the data processing device 12 will be referred to as a "server" and the smart device 14 will be referred to as a "terminal."
[0389] While conventional program code analysis systems have the ability to automatically add appropriate comments to code, they do not provide feedback or adjust comments based on the user's emotional state. This has resulted in a lack of methods to reduce the stress and burden users feel when understanding code analysis results. This has been a particular issue for factory maintenance engineers, as the stress of analyzing robot operation code negatively impacts their productivity.
[0390] The specific processing by the specific processing unit 290 of the data processing device 12 in the application example 2 is realized by the following means.
[0391] In this invention, the server includes means for reading other people's program code and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, means for recognizing the user's emotions in real time and adjusting the analysis results and the comments, and means for displaying feedback based on the analyzed code and emotions on the user's device. This makes it possible to provide appropriate feedback according to the user's emotional state, reduce the stress of code analysis work, and improve the user experience.
[0392] "Third-party program code" is software code created by a person or organization other than the user.
[0393] "Structure" is a concept that refers to the layout of program code, the arrangement of modules and functions, and the relationships between them.
[0394] "Function" refers to the characteristics of what operations or processes each part of program code performs.
[0395] "Analysis" is the process of examining and understanding each part of a program code in order to understand its structure and function.
[0396] "Comments" are explanatory text or annotations added to program code to aid in understanding the code.
[0397] A "server" is a computer system for analyzing program code and generating comments.
[0398] A "user" is a person or organization that uses the system to upload program code and receive analyzed code.
[0399] An "emotion engine" is a technology that recognizes a user's emotional state and reflects that information in analysis and comment generation.
[0400] "Feedback" refers to the communication of information when the analyzed program code and comments are provided to the user.
[0401] The system for implementing the present invention is designed specifically for factory maintenance engineers, and provides the functionality to analyze robot operation codes, automatically add appropriate comments, and is superior in that it recognizes the user's emotions in real time and adjusts the content of the feedback accordingly.
[0402] System Configuration
[0403] The system includes the following major hardware and software:
[0404] 1. User Device
[0405] Hardware: Smart glasses (e.g., Google Glass, Microsoft HoloLens)
[0406] Software: OCR libraries (e.g., Tesseract OCR), emotion recognition libraries (e.g., OpenCV, Google's Mediapipe)
[0407] The smart glasses capture the robot's operational code read by the user with a camera and convert it into text using OCR. They also identify the user's facial expressions and tone of voice and obtain emotional data using an emotion recognition library.
[0408] 2. Server
[0409] Hardware: Cloud computing platforms (e.g., AWS EC2, Google Cloud)
[0410] Software: Code analysis engine (built in Python), emotion engine
[0411] The server analyzes the program code sent from the user's device. The analysis engine understands the structure and function of the program code and generates appropriate comments. The emotion engine also analyzes the user's emotions in real time and adjusts the content and timing of the comments accordingly.
[0412] Specific examples of processing
[0413] 1. Capture and send the code
[0414] The user uses smart glasses to capture the robot's operating code, which is then converted into text using OCR technology and sent to the server.
[0415] 2. Analysis of the program code
[0416] The server receives the submitted code and passes it to a code analysis engine, which analyzes each part of the code to understand its function and structure, and automatically generates comments based on the analysis results.
[0417] 3. Emotion recognition and feedback regulation
[0418] The smart glasses' camera and microphone capture the user's facial expressions and vocal tone. An emotion recognition library analyzes this data to determine the user's emotional state. The server uses this emotional information to adjust the generated comments and the timing of feedback. For example, if the user is stressed, the comments will be more polite and helpful.
[0419] 4. Viewing Feedback
[0420] The adjusted comments are displayed on the smart glasses' display, allowing users to see the analysis results in real time and take appropriate action.
[0421] Prompt Sentence Examples
[0422] Below is an example of a prompt sentence for the generative AI model based on the code read by the user and the emotion recognition results.
[0423] Program code:
[0424] python
[0425] def robotic_arm_move(x, y):
[0426] move_to_position(x, y)
[0427] If the emotion recognition result is "Stress":
[0428] Generative AI model input prompt:
[0429] Add a comment to the code below and politely message the user, as they are frustrated:
[0430] def robotic_arm_move(x, y):
[0431] move_to_position(x, y)
[0432] Generative AI model output example:
[0433] The function robotic_arm_move takes x and y coordinates and moves the robotic arm based on them
[0434] Don't worry: if you get an error in this step, check your x and y values
[0435] def robotic_arm_move(x, y):
[0436] move_to_position(x, y)
[0437] In this way, the system of the present invention aims to help factory maintenance engineers efficiently understand robot operation codes and reduce stress when performing correction work. This system provides appropriate feedback according to the user's emotional state, making it possible to improve work efficiency and accuracy.
[0438] The flow of the specific processing in the application example 2 will be described with reference to FIG.
[0439] Step 1:
[0440] The user uses the smart glasses to capture the robot's motion code.
[0441] Input: Smart glasses camera image
[0442] How it works: Using the camera on the smart glasses, the user presses the capture button to capture the robot's movement code.
[0443] Output: Photographed code image
[0444] Step 2:
[0445] The smart glasses capture the code image and convert it into text format using OCR technology.
[0446] Input: Photographed code image
[0447] How it works: Using the OCR library (e.g. Tesseract OCR) built into the smart glasses, characters in the image are extracted and converted into text data.
[0448] Output: Text data of the code
[0449] Step 3:
[0450] The smart glasses send the converted text data to the server.
[0451] Input: Text data of the code
[0452] How it works: The smart glasses use an internet connection (e.g., Wi-Fi or 5G) to send text data to a server as an HTTP POST request.
[0453] Output: Response that code text data was uploaded successfully to the server
[0454] Step 4:
[0455] The server passes the received code to an analysis engine, which analyzes the structure and function of the program code.
[0456] Input: Text data of the uploaded code
[0457] How it works: The server uses a parsing engine (built in Python) to analyze each piece of code and understand its function and structure.
[0458] Output: Code structure and function data as analysis results
[0459] Step 5:
[0460] The server automatically generates comments based on the analysis results.
[0461] Input: Code structure and function data
[0462] How it works: The code analysis engine sends prompts to the generative AI model to generate appropriate comments.
[0463] Output: Code data with comments
[0464] Step 6:
[0465] The smart glasses capture the user's facial expressions and voice tone and analyze the emotional data using an emotion recognition library.
[0466] Input: User facial expression and voice tone data
[0467] How it works: The smart glasses use emotion recognition libraries (e.g., OpenCV, Google's Mediapipe) to analyze the captured data and determine the user's emotional state.
[0468] Output: User's emotional state data
[0469] Step 7:
[0470] The server adjusts the generated comments based on the user's emotional state data.
[0471] Input: Commented code data, user emotional state data
[0472] How it works: The server uses an emotion engine to adjust the content and timing of comments based on the user's emotional state. For example, if the user is feeling stressed, the server will make the comments more polite.
[0473] Output: Adjusted and commented code data
[0474] Step 8:
[0475] The server sends the adjusted commented code data to the smart glasses for display.
[0476] Input: Adjusted and commented code data
[0477] How it works: The server sends data to the smart glasses via internet and displays it on the smart glasses' display. Users can check the analysis results and comments in real time.
[0478] Output: Analysis results and comments displayed on the smart glasses
[0479] The specific processing unit 290 transmits the result of the specific processing to the smart device 14. In the smart device 14, the control unit 46A causes the output device 40 to output the result of the specific processing. The microphone 38B acquires audio indicating a user input regarding the result of the specific processing. The control unit 46A transmits audio data indicating the user input acquired by the microphone 38B to the data processing device 12. In the data processing device 12, the specific processing unit 290 acquires the audio data.
[0480] The data generation model 58 is a so-called generative AI (Artificial Intelligence). An example of the data generation model 58 is ChatGPT (Internet Search<URL: https: / / openai.com / blog / chatgpt> ), Gemini (Internet search <url: https: gemini.google.com ?hl="ja">) and other generation AIs. The data generation model 58 is obtained by performing deep learning on a neural network. A prompt including an instruction is input to the data generation model 58, and inference data such as voice data indicating voice, text data indicating text, and image data indicating an image is also input. The data generation model 58 performs inference on the input inference data in accordance with the instruction indicated by the prompt, and outputs the inference result in a data format such as voice data and text data. Here, inference refers to, for example, analysis, classification, prediction, and / or summarization.
[0481] In the above embodiment, an example in which the specific process is performed by the data processing device 12 has been given, but the technology of the present disclosure is not limited to this, and the specific process may be performed by the smart device 14.
[0482] [Second embodiment]
[0483] FIG. 3 shows an example of the configuration of a data processing system 210 according to the second embodiment.
[0484] 3, the data processing system 210 includes the data processing device 12 and smart glasses 214. An example of the data processing device 12 is a server.
[0485] The data processing device 12 includes a computer 22, a database 24, and a communication I / F 26. The computer 22 is an example of a "computer" according to the technology of the present disclosure. The computer 22 includes a processor 28, a RAM 30, and a storage 32. The processor 28, the RAM 30, and the storage 32 are connected to a bus 34. The database 24 and the communication I / F 26 are also connected to the bus 34. The communication I / F 26 is connected to a network 54. Examples of the network 54 include a WAN (Wide Area Network) and / or a LAN (Local Area Network).
[0486] The smart glasses 214 include a computer 36, a microphone 238, a speaker 240, a camera 42, and a communication I / F 44. The computer 36 includes a processor 46, a RAM 48, and a storage 50. The processor 46, the RAM 48, and the storage 50 are connected to a bus 52. The microphone 238, the speaker 240, and the camera 42 are also connected to the bus 52.
[0487] The microphone 238 receives instructions and the like from the user 20 by receiving voice uttered by the user 20. The microphone 238 captures the voice uttered by the user 20, converts the captured voice into audio data, and outputs it to the processor 46. The speaker 240 outputs audio in accordance with instructions from the processor 46.
[0488] Camera 42 is a small digital camera equipped with an optical system including a lens, aperture, and shutter, and an imaging element such as a CMOS (Complementary Metal-Oxide-Semiconductor) image sensor or a CCD (Charge Coupled Device) image sensor, and captures images of the surroundings of user 20 (for example, an imaging range defined by an angle of view equivalent to the field of vision of a typical healthy person).
[0489] The communication I / F 44 is connected to a network 54. The communication I / Fs 44 and 26 are responsible for the exchange of various information between the processor 46 and the processor 28 via the network 54. The exchange of various information between the processor 46 and the processor 28 using the communication I / Fs 44 and 26 is carried out in a secure state.
[0490] Fig. 4 shows an example of the main functions of the data processing device 12 and the smart glasses 214. As shown in Fig. 4, in the data processing device 12, a specific process is performed by the processor 28. A specific process program 56 is stored in the storage 32.
[0491] The specific processing program 56 is an example of a "program" according to the technology of the present disclosure. The processor 28 reads the specific processing program 56 from the storage 32 and executes the read specific processing program 56 on the RAM 30. The specific processing is realized by the processor 28 operating as a specific processing unit 290 in accordance with the specific processing program 56 executed on the RAM 30.
[0492] The storage 32 stores a data generation model 58 and an emotion identification model 59. The data generation model 58 and the emotion identification model 59 are used by the identification processing unit 290.
[0493] In the smart glasses 214, the reception output process is performed by the processor 46. A reception output program 60 is stored in the storage 50. The processor 46 reads the reception output program 60 from the storage 50 and executes the read reception output program 60 on the RAM 48. The reception output process is realized by the processor 46 operating as the control unit 46A in accordance with the reception output program 60 executed on the RAM 48.
[0494] Next, a description will be given of the identification process performed by the identification processing unit 290 of the data processing device 12. In the following description, the data processing device 12 will be referred to as the "server" and the smart glasses 214 will be referred to as the "terminal."
[0495] The present invention relates to a system that reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. This system is particularly advantageous in that it provides the user with analysis results in real time, enabling quick code understanding. Specific embodiments for carrying out the present invention are described below.
[0496] 1. Overall structure
[0497] This system consists of the following main elements:
[0498] Server: Responsible for analyzing program code and generating comments.
[0499] User terminal: Provides an interface for users to upload code and receive analysis results.
[0500] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0501] 2. Receiving the program code
[0502] A user selects a program code file from their device and uploads it to the server, which receives the HTTP POST request and stores the uploaded file on the server.
[0503] 3. Analysis of the program code
[0504] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of this code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[0505] 4. Automatic comment generation
[0506] The server receives the analysis results returned by the analysis engine and adds comments to the program code, so that the original code is provided to the user with appropriate comments inserted. The content of these comments can be adjusted to the required granularity, allowing for detailed explanations.
[0507] 5. Providing analysis results
[0508] The server then sends the analyzed program code, complete with added comments, back to the user, who can then review the analyzed code on their own device and deepen their understanding. The analysis results are provided in real time, so users can immediately check the content.
[0509] Specific examples
[0510] User-uploaded code example
[0511] Below is an example of the code that a user uploads when requesting analysis.
[0512] python
[0513] def multiply(a, b):
[0514] return ab
[0515] Example of analyzed code
[0516] After the server completes the analysis, the code returned to the user will have the following comment added:
[0517] python
[0518] The function multiply takes two arguments a and b and returns their product.
[0519] def multiply(a, b):
[0520] return ab
[0521] Description of the Examples
[0522] 1. The user selects the file containing the above code on their device and uploads it to the server.
[0523] 2. The server receives the contents of the uploaded file and sends it in text format to the analysis engine.
[0524] 3. The analysis engine analyzes the program code, understands its structure and function, and generates appropriate comments.
[0525] 4. The server generates code with added comments based on the analysis results obtained from the analysis engine.
[0526] 5. The server returns the parsed code with comments to the user in real time.
[0527] 6. Users receive analyzed code, allowing them to quickly understand the code.
[0528] In this way, the present invention significantly assists users in understanding the code by quickly and accurately analyzing other people's program code and adding appropriate comments.
[0529] The processing flow will be explained below.
[0530] Step 1:
[0531] The user prepares the program code they wish to analyze on their device, opens a browser on their device, and accesses the code analysis service's web application.
[0532] Step 2:
[0533] The user selects a program code file from the form in the web application and clicks the "Upload" button, which sends the program code file to the server.
[0534] Step 3:
[0535] The server receives an HTTP POST request. The server checks whether the file exists and returns an error response if the file does not exist. If the file exists, it reads the contents of the file in byte format, converts it to UTF-8 encoding, and retrieves it as a string.
[0536] Step 4:
[0537] The server sends a program code string to the analysis engine. At this time, the server generates an analysis request to the analysis engine to explain the structure and function of the code. Specifically, the server creates a prompt containing the content of the code and sends it to the analysis engine.
[0538] Step 5:
[0539] The analysis engine analyzes the program code. The analysis engine analyzes the received code, understands its structure and function, and generates appropriate comments. This analysis includes checking the code's syntax and analyzing its functions.
[0540] Step 6:
[0541] The analysis engine sends the results of the analysis back to the server, which receives the program code with the added comments and processes it as analyzed code.
[0542] Step 7:
[0543] The server returns the analysis results to the user. Specifically, it generates the analyzed code as a response in JSON format and returns it to the user's browser.
[0544] Step 8:
[0545] The user receives the analysis results and checks the analyzed code in the browser. The user can refer to the added comments to deepen their understanding of the code. Based on the analysis results, it becomes possible to quickly and accurately understand other people's code.
[0546] Example 1
[0547] Next, a description will be given of Example 1. In the following description, the data processing device 12 will be referred to as a "server" and the smart glasses 214 will be referred to as a "terminal."
[0548] Analyzing program code and adding appropriate comments is an important task in software development. However, doing it manually can be very time-consuming, and it can be difficult to understand the structure and function of code, especially when the code was written by someone else. The purpose of this invention is to solve these problems and perform real-time code analysis and comment generation, allowing users to quickly and accurately understand the code.
[0549] The specific processing by the specific processing unit 290 of the data processing device 12 in the first embodiment is realized by the following means.
[0550] In this invention, the server includes means for reading program code of others and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to a user, means for using natural language processing technology to analyze the program code, means for a user to upload a program code file, means for receiving an HTTP request and saving the program code file, means for sending the program code to an analysis engine and receiving the analysis results, means for inserting comments into the program code and generating analyzed code, and means for returning the analyzed code to the user. This makes it possible to automatically analyze the structure and function of program code and insert appropriate comments in real time.
[0551] "Someone else's program code" means that the program in question was created by another developer or group, not by you.
[0552] "Analysis methods" refers to a set of processes and techniques for reading program code and identifying and extracting its structure and functionality.
[0553] "Method for automatically adding comments" refers to a technology or process that automatically inserts appropriate comments into program code based on analysis results.
[0554] "User provision means" refers to the technology or process for returning and providing the analyzed program code to the user in an appropriate format.
[0555] "Natural language processing technology" is an artificial intelligence technology for understanding and processing human language, and is used here to analyze program code and generate comments.
[0556] "Uploading method" refers to the technology or process by which a user sends a file from their device to a server.
[0557] "HTTP request receiving means" refers to the technology or process by which a server receives an HTTP request sent from a user's terminal.
[0558] "File storage means" refers to the technology or process for temporarily storing received program code files on the server side.
[0559] "Analysis engine transmission means" refers to the technology or process by which the server sends program code to the analysis engine and receives the analysis results.
[0560] "Comment insertion means" refers to a technique or process for appropriately inserting comments returned from the analysis engine into the original program code.
[0561] "Analyzed code generator" refers to a technique or process for generating commented program code.
[0562] "Real-time delivery means" refers to the technology or process for instantly returning and delivering the generated analyzed code to the user.
[0563] 1. System Configuration
[0564] The system of this invention is designed to read someone else's program code, analyze its structure and function, and automatically add appropriate comments. The system consists of the following main components:
[0565] Server: Responsible for analyzing program code and generating comments.
[0566] User terminal: Provides an interface for users to upload code and receive analysis results.
[0567] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0568] 2. Upload the program code
[0569] The user selects a program code file on their device and uploads it to the server using the browser's file selection interface. This requires a standard web browser and an internet connection. When the user presses the upload button, the device sends the selected file data to the server in the body of an HTTP POST request.
[0570] 3. Receiving and storing on the server
[0571] The server parses the received HTTP POST request, extracts the file data from the body, and stores the extracted data in temporary storage on the server, which is typically a specific directory on a disk.
[0572] 4. Analysis of the program code
[0573] The server retrieves the saved file path and reads the file in text format. This text data is passed to an analysis engine. The analysis engine uses static analysis techniques and natural language processing (NLP) to analyze the code structure and functionality. NLP techniques include, for example, analysis algorithms written in Python.
[0574] 5. Comment Generation
[0575] The analysis engine generates explanatory comments for each part of the program code based on the results of static analysis. It uses natural language generation (NLG) technology to output comments in a format that is easy for humans to understand, explaining what each line of the program does.
[0576] 6. Inserting Comments
[0577] The server then inserts the comments returned by the parsing engine into the original program code appropriately, taking care not to alter the original code. For example, comments are added just before function definitions or at the beginning of loops. Comments are also inserted at the correct indentation level to maintain code readability.
[0578] 7. Return of analysis results
[0579] The server generates the program code with the comments inserted as a text file and returns it to the user's device in the form of an HTTP response, with an HTTP status code of 200 indicating that the request was processed successfully.
[0580] 8. Displaying the results
[0581] The user receives the HTTP response sent back from the server on their device. The response is displayed in the device's browser or text editor. The user can view the program code with properly added comments, allowing them to quickly understand the code.
[0582] Specific examples
[0583] Target program code
[0584] Below is an example of the code that a user uploads when requesting analysis.
[0585] def multiply(a, b):
[0586] return ab
[0587] Analyzed Code
[0588] After the server completes the analysis, the code returned to the user will have the following comment added:
[0589] The function multiply takes two arguments a and b and returns their product.
[0590] def multiply(a, b):
[0591] return ab
[0592] Prompt Sentence Examples
[0593] "Please analyze the following program code and add comments that explain its functionality:
[0594] def multiply(a, b):
[0595] return ab"
[0596] In this way, users can quickly and accurately understand other people's program code. This system significantly supports the understanding and maintenance of program code, especially in software development.
[0597] The flow of the identification process in the first embodiment will be described with reference to FIG.
[0598] Step 1:
[0599] A user selects a program code file on his / her device and uploads it to the server through the file selection interface of the web browser. As input, there is the program code file selected by the user. The user selects the program code file in the browser's file selection dialog and clicks the upload button. As output, the uploaded file data is sent to the server in the form of an HTTP POST request.
[0600] Step 2:
[0601] The server parses the received HTTP POST request and extracts the program code file data from its body. The input is the HTTP POST request sent to the server. To extract the data, the server parses the received request and retrieves the file data from the body. This data is saved in temporary storage and the directory path to the save location is output.
[0602] Step 3:
[0603] The server obtains the path of the saved program code file and reads the file in text format. The input is the directory path of the saved file. Using file system operations, it reads the text data from the specified file directory. This text data is output and sent to the analysis engine.
[0604] Step 4:
[0605] The analysis engine analyzes the text data of the received program code. The input is the text data of the program code. The analysis engine uses natural language processing and static analysis techniques to analyze the structure and function of the code. The data is processed to understand the meaning and function of each code block. The output is the analysis results.
[0606] Step 5:
[0607] The analysis engine generates appropriate comments for the program code based on the analysis results. The input is the structure and function information of the analyzed code. Natural language generation technology is used to create comments that are easy for humans to understand. The generated comments are obtained as the output.
[0608] Step 6:
[0609] The server inserts the comments returned by the analysis engine into the original program code appropriately. As input, it has the generated comments and the original program code. It adds the comments to the program code at the appropriate positions, adjusting the indentation level while preserving the code structure. As output, it generates the parsed code with the added comments.
[0610] Step 7:
[0611] The server returns the parsed code with the comments inserted to the user as an HTTP response. As input, it has the parsed code with the comments added. It generates an HTTP response and sends the parsed code with HTTP status code 200 to the user's device. As output, the parsed code is displayed in the browser.
[0612] Step 8:
[0613] The user receives the HTTP response returned from the server on their device and checks the parsed code in a browser or text editor. The input is the parsed code HTTP response. The user displays the returned code and checks the code with added comments to deepen their understanding. The output is the parsed code that has been understood.
[0614] In this way, by going through each step, the user can quickly and accurately understand program code created by others.
[0615] (Application example 1)
[0616] Next, a description will be given of Application Example 1. In the following description, the data processing device 12 will be referred to as a "server" and the smart glasses 214 will be referred to as a "terminal."
[0617] The program code for robots used in factories is complex, and maintaining and debugging it requires a great deal of time and effort. This requires a method to quickly understand the code. Another issue is that if the content and detail of comments are inappropriate, the efficiency of engineers' work will decrease.
[0618] The specific processing by the specific processing unit 290 of the data processing device 12 in the application example 1 is realized by the following means.
[0619] In this invention, the server includes means for reading other people's program code and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, and means for analyzing the robot's program code and automatically adding comments. This not only enables the robot's program code to be understood quickly, but also makes maintenance and debugging more efficient since appropriate comments are automatically added.
[0620] "Other person's program code" refers to program code that is not created by the user himself / herself but is created by a third party.
[0621] "Structure" refers to the physical arrangement and organization of a program, such as the layout of program code, function hierarchy, and flow control.
[0622] "Function" refers to the specific task or action that program code performs, and indicates the role of each code block.
[0623] "Analyzing" refers to the process of examining the structure and function of program code in detail to understand its properties and workings.
[0624] "Comments" refer to text information that describes the meaning of a specific part of program code, an overview of processing, details of operation, etc.
[0625] "Add automatically" means that the system automatically adds the necessary comments to the program code without the user having to manually enter them.
[0626] "Analyzed code" refers to program code that has been subjected to analytical means to understand its structure and function and to have appropriate comments added.
[0627] "Providing to the user" means displaying the analyzed code on the user's terminal or making it available for download.
[0628] "Robot program code" refers to program code written to control robots used in factories, etc.
[0629] The term "means" refers to a method or system component for realizing a specific function or process in the present invention.
[0630] The system for realizing this invention reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. It can be used particularly to streamline maintenance and debugging of program code for robots operating in factories.
[0631] The system consists of the following main components:
[0632] 1. Server:
[0633] The server is a node that is responsible for the main processing of program code analysis and comment generation. The server includes the following hardware and software:
[0634] Hardware: A computer with a high-performance CPU, memory, and storage
[0635] Software: Operating system (e.g., Ubuntu), code analysis engine (e.g., AST analysis tool), generative AI model (e.g., GPT-4 using the transformers library)
[0636] 2. User Device:
[0637] The user terminal provides an interface for users to upload program code and receive analysis results. It includes the following hardware and software:
[0638] Hardware: Personal computers, tablet devices
[0639] Software: Web browser (e.g. Google Chrome)
[0640] 3. Design:
[0641] The system is designed according to the following steps:
[0642] Receiving program code: The user selects a program code file from their device and uploads it to the server. The server receives the HTTP POST request and stores the uploaded file on the server.
[0643] Analysis of program code: The server reads the received program code in text format and sends it to the analysis engine, which analyzes the structure and function of the code to understand what processing is taking place at each step.
[0644] Automatic comment generation: The server receives the analysis results returned by the analysis engine and adds comments to the program code. It uses a generative AI model (e.g., GPT-4) to generate appropriate comments for the code.
[0645] Providing analysis results: The server returns the analyzed program code with added comments to the user, allowing the user to review the analyzed code on their own device and deepen their understanding.
[0646] 4. Example:
[0647] Example code:
[0648] Below is an example of the code that a user uploads when requesting analysis.
[0649] python
[0650] def move_forward(steps):
[0651] for _ in range(steps):
[0652] execute_step()
[0653] def turn(direction):
[0654] if direction == "left":
[0655] turn_left()
[0656] elif direction == "right":
[0657] turn_right()
[0658] After the server completes the analysis, the code returned to the user will have the following comment added:
[0659] python
[0660] The move_forward function performs a forward movement for a given number of steps.
[0661] def move_forward(steps):
[0662] for _ in range(steps):
[0663] execute_step()
[0664] The turn function performs a left or right turn depending on the direction.
[0665] def turn(direction):
[0666] if direction == "left":
[0667] turn_left()
[0668] elif direction == "right":
[0669] turn_right()
[0670] Example prompt sentence:
[0671] Use the following prompt for the generative AI model:
[0672] Analyze the program code and add appropriate comments for each function and process.
[0673] code:
[0674] def move_forward(steps):
[0675] for _ in range(steps):
[0676] execute_step()
[0677] def turn(direction):
[0678] if direction == "left":
[0679] turn_left()
[0680] elif direction == "right":
[0681] turn_right()
[0682] This system automates the analysis and commenting of robot program code, allowing engineers to quickly understand the code, thereby making maintenance and debugging more efficient.
[0683] The flow of the specific processing in the application example 1 will be described with reference to FIG.
[0684] Step 1:
[0685] The user uses the terminal to select their program code file (e.g., robot_control.py) and upload it to the server. Specifically, the user selects the file from their local disk and sends an HTTP POST request to the server through the web interface. The input is the program code file, and the output is the file submission.
[0686] Step 2:
[0687] The server saves the received program code in text format and sends it to the analysis engine. The server receives the file data from the HTTP request and stores it temporarily. At this point, the file is saved in a temporary directory on the server. The input is the uploaded file to the server, and the output is transferred to the analysis engine.
[0688] Step 3:
[0689] The analysis engine analyzes the structure and function of the received program code. Specifically, it uses an AST (Abstract Syntax Tree) analysis tool to analyze the code structure and understand the role of each function and processing block. As a result of the analysis, comment candidates are generated for each processing part. The input is the program code in text format, and the output is structural information and comment candidates as the analysis results.
[0690] Step 4:
[0691] The server receives the structural information and comment candidates returned by the analysis engine and adds comments to the program code. Using a generative AI model (e.g., GPT-4), it generates detailed comments for each part of the code and inserts them into the original program code. This turns the program code into analyzed code with comments. The input is the analysis result of the analysis engine, and the output is the program code with the added comments.
[0692] Step 5:
[0693] The server returns the analyzed program code with comments to the user. Specifically, the server generates an analyzed code file and provides it to the user's device as a download link. The user can obtain and review the analyzed code through the link. The input is the program code file with comments added, and the output is the file provided to the user.
[0694] The above steps allow the robot program code to be analyzed and commented efficiently and automatically, greatly improving the efficiency of the engineering process.
[0695] Furthermore, an emotion engine that estimates the user's emotion may be further combined. That is, the identification processing unit 290 may estimate the user's emotion using the emotion identification model 59, and perform identification processing using the user's emotion.
[0696] The present invention combines an emotion engine with a system that reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. This system is particularly advantageous in that it provides the user with the analysis results in real time and adjusts the content and timing of the comments according to the user's emotions. Specific embodiments for implementing the present invention are described below.
[0697] 1. Overall structure
[0698] This system consists of the following main elements:
[0699] Server: Responsible for analyzing program code and generating comments.
[0700] User terminal: Provides an interface for users to upload code and receive analysis results.
[0701] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0702] Emotion engine: An engine that recognizes user emotions and reflects them in analysis results and comment content.
[0703] 2. Receiving the program code
[0704] A user selects a program code file from their device and uploads it to the server, which receives the HTTP POST request and stores the uploaded file on the server.
[0705] 3. Analysis of the program code
[0706] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of the code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[0707] 4. User Emotion Recognition
[0708] When a user uses the system, the emotion engine acquires emotion data from the user's facial expressions, voice tone, etc. The emotion engine analyzes the acquired emotion data and determines the user's current emotional state.
[0709] 5. Automatic comment generation and moderation
[0710] The server receives the analysis results from the analysis engine and adds comments to the program code. At this time, it adjusts the content and expression of the comments based on the emotional information obtained from the emotion engine. For example, if the user is feeling stressed, the comments can be made more polite and kind.
[0711] 6. Provision of analysis results
[0712] The server then returns the analyzed program code with the added comments to the user. This process also utilizes information from the emotion engine to provide feedback at a time appropriate to the user's emotional state, increasing the user's receptivity to the analysis results.
[0713] Specific examples
[0714] User-uploaded code example
[0715] Below is an example of the code that a user uploads when requesting analysis.
[0716] python
[0717] def multiply(a, b):
[0718] return ab
[0719] Example of analyzed code
[0720] After the server completes the analysis, the code returned to the user will have the following comment added:
[0721] python
[0722] The function multiply takes two arguments a and b and returns their product.
[0723] def multiply(a, b):
[0724] return ab
[0725] Description of the Examples
[0726] 1. The user selects the file containing the above code on their device and uploads it to the server.
[0727] 2. The server receives the contents of the uploaded file and sends it in text format to the analysis engine.
[0728] 3. The analysis engine analyzes the program code, understands its structure and function, and generates appropriate comments.
[0729] 4. The emotion engine recognizes the user's emotions and adjusts the content of the analysis results and the timing of feedback based on that information.
[0730] 5. The server uses the information from the emotion engine to generate parsed code with added comments.
[0731] 6. The server returns the parsed code with comments added to it to the user in real time.
[0732] 7. The user receives the analysis results, checks the analyzed code in the browser, and deepens their understanding.
[0733] In this way, the present invention significantly supports users' understanding of the code by quickly and accurately analyzing other people's program code and adding appropriate comments. Furthermore, by adjusting the content and timing of comments based on the user's emotional information, the user experience can be improved.
[0734] The processing flow will be explained below.
[0735] Step 1:
[0736] The user prepares the program code they wish to analyze on their device, and then accesses the code analysis service's web application from their device.
[0737] Step 2:
[0738] A user selects a program code file from a form in a web application and clicks the "Upload" button, which sends the program code file to the server.
[0739] Step 3:
[0740] The server receives an HTTP POST request. The server checks whether the file exists and returns an error response if the file does not exist. If the file exists, it reads the contents of the file in byte format, converts it to UTF-8 encoding, and retrieves it as a string.
[0741] Step 4:
[0742] The server sends a program code string to the analysis engine. At this time, the server generates an analysis request to the analysis engine to explain the structure and function of the code. Specifically, the server creates a prompt containing the content of the code and sends it to the analysis engine.
[0743] Step 5:
[0744] The analysis engine analyzes the program code. The analysis engine analyzes the received code, understands its structure and function, and generates appropriate comments. This analysis includes checking the code's syntax and analyzing its functions.
[0745] Step 6:
[0746] The emotion engine recognizes the user's emotions. When a user uses the system, the emotion engine acquires emotional data from the user's facial expressions and tone of voice, and analyzes and judges their emotional state.
[0747] Step 7:
[0748] The server receives the analysis results returned by the analysis engine and adds comments to the program code. At this time, the server adjusts the content and expression of the comment based on the information from the emotion engine. For example, if the user is feeling stressed, the comment will be made more polite and kind.
[0749] Step 8:
[0750] The server returns the analyzed program code with added comments to the user. Utilizing information from the emotion engine, feedback is provided at a time appropriate to the user's emotional state. This increases the user's receptivity to the analysis results.
[0751] Step 9:
[0752] The user receives the analysis results and checks the analyzed code in the browser. The user can refer to the added comments to deepen their understanding of the code. Based on the analysis results, it becomes possible to quickly and accurately understand other people's code.
[0753] Example 2
[0754] Next, a description will be given of Example 2. In the following description, the data processing device 12 will be referred to as a "server" and the smart glasses 214 will be referred to as a "terminal."
[0755] While conventional program code analysis systems have the ability to analyze code structure and function and automatically add comments, they have the problem of being unable to adjust the content of comments or the timing of feedback depending on the user's emotions and situation. This results in a suboptimal user experience, making it difficult to provide appropriate support to help users understand the code, especially in stressful situations.
[0756] The identification process by the identification processing unit 290 of the data processing device 12 in the second embodiment is realized by the following means. In this invention, the server includes means for reading program code of others and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, and means for recognizing the user's emotions and adjusting the content and timing of the comments. This makes it possible to add optimal comments and feedback according to the user's emotions, and is expected to improve the user experience.
[0757] "Third party program code" refers to the source code of a program created by a third party other than the code creator.
[0758] "Structure" refers to the components of program code, their arrangement, and their relationships.
[0759] "Function" refers to the specific operations and processing content of the program code.
[0760] "Means of analysis" refers to techniques and tools for understanding the structure and function of program code.
[0761] "Appropriate comments" refers to information such as explanatory text inserted to help understand program code.
[0762] "Automatic addition" refers to a method in which comments are generated and inserted automatically by the system rather than manually.
[0763] "Analyzed code" means program code whose structure and function have been analyzed using analytical tools and whose appropriate comments have been added.
[0764] "Means for providing to the user" refers to methods and tools for transmitting or displaying the analyzed code to the user.
[0765] "Means for recognizing a user's emotions and adjusting the content and timing of comments" refers to methods and tools that analyze a user's current emotional state and change the tone and timing of comments based on that.
[0766] 1. Overall structure
[0767] The system of the present invention comprises the following main elements: This system provides a function to analyze other people's program code and automatically add appropriate comments based on the user's sentiment.
[0768] Server: Responsible for analyzing program code and generating comments.
[0769] User terminal: Provides an interface for users to upload code and receive analysis results.
[0770] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0771] Emotion engine: An engine that recognizes user emotions and reflects them in analysis results and comment content.
[0772] 2. Receiving the program code
[0773] The user selects a program code file from their device and uploads it to the server using an HTTP POST request. The server then stores the uploaded file in its internal storage.
[0774] 3. Analysis of the program code
[0775] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of the code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[0776] 4. User Emotion Recognition
[0777] When a user uses the system, the emotion engine acquires emotion data from the user's facial expressions, voice tone, etc. The emotion engine analyzes the acquired emotion data and determines the user's current emotional state.
[0778] 5. Automatic comment generation and moderation
[0779] The server receives the analysis results from the analysis engine and adds comments to the program code. At the same time, it adjusts the content and expression of the comments based on the emotional information obtained from the emotion engine. For example, if the user is feeling stressed, the comments can be made more polite and kind.
[0780] 6. Provision of analysis results
[0781] The server then returns the analyzed program code with the added comments to the user. This process also utilizes information from the emotion engine to provide feedback at a time appropriate to the user's emotional state, increasing the user's receptivity to the analysis results.
[0782] Specific examples
[0783] User-uploaded code example
[0784] Below is an example of the code that a user uploads when requesting analysis.
[0785] python
[0786] def multiply(a, b):
[0787] return ab
[0788] Example of analyzed code
[0789] After the server completes the analysis, the code returned to the user will have the following comment added:
[0790] python
[0791] The function multiply takes two arguments a and b and returns their product.
[0792] def multiply(a, b):
[0793] return ab
[0794] Prompt Sentence Examples
[0795] An example of a prompt sentence that the user enters into the system is as follows:
[0796] "Please analyze this code and add appropriate comments."
[0797] In this way, the present invention significantly supports users' understanding of the code by quickly and accurately analyzing other people's program code and adding appropriate comments. Furthermore, by adjusting the content and timing of comments based on the user's emotional information, the user experience can be improved.
[0798] The flow of the identification process in the second embodiment will be described with reference to FIG.
[0799] Step 1:
[0800] The user selects a program code file on their device that they wish to analyze. The selected file contains code data in text format. The user then uploads the file to the server using an HTTP POST request via a browser interface.
[0801] Input: User selected program code file
[0802] Output: Code data sent to the server via an HTTP POST request
[0803] Specific working example:
[0804] The user clicks the "Choose File" button in their browser.
[0805] The user selects a code file to analyze from their computer (e.g., multiply.py).
[0806] When the user clicks the "Upload" button, an HTTP POST request is sent to the server.
[0807] Step 2:
[0808] The server analyzes the HTTP POST request received from the user, extracts the contents of the code file, and saves the contents in the server's storage.
[0809] Input: HTTP POST request from user (program code file)
[0810] Output: Code file saved in server storage
[0811] Specific working example:
[0812] The server receives an HTTP POST request.
[0813] The server extracts the code from the request body and saves it in the specified directory in storage (e.g. / uploads / multiply.py).
[0814] Step 3:
[0815] The server reads the stored program code in text format and sends the text data to the analysis engine for syntax analysis. The analysis engine performs static and syntax analysis to understand the structure and function of the code.
[0816] Input: Code file stored in the server storage
[0817] Output: Text data passed to the analysis engine
[0818] Specific working example:
[0819] The server reads the saved code file.
[0820] The read text data is sent to the analysis engine.
[0821] The analysis engine analyzes the code's functions, variables, and logic flow.
[0822] Step 4:
[0823] As users interact with the system, the emotion engine captures their facial expressions and vocal tone in real time and analyzes the data to determine their emotional state, such as relaxed, stressed, or confused.
[0824] Input: User's facial expression, voice tone data
[0825] Output: Parsed user's emotional state
[0826] Specific working example:
[0827] The emotion engine collects data using the camera and microphone on the user's device.
[0828] The emotion engine analyzes the collected data in real time and classifies the user's emotions (e.g., stress state).
[0829] Step 5:
[0830] The server receives the analysis results from the analysis engine and adds appropriate comments to the program code, adjusting the content and expression of the comments based on the user's emotional state obtained from the emotion engine.
[0831] Input: Code analysis results from the analysis engine, user emotional state from the emotion engine
[0832] Output: Parsed code with comments added
[0833] Specific working example:
[0834] The server receives the results from the analysis engine, including the analysis information and generated comments for each code block.
[0835] The server receives the user's emotional state data from the emotion engine and makes adjustments, such as when to use a gentler tone or polite expressions.
[0836] The server adds comments to the code and generates the final parsed code.
[0837] Step 6:
[0838] The server then returns the analyzed program code with the added comments to the user, utilizing information from the emotion engine to provide optimal feedback based on the user's emotional state.
[0839] Input: Commented and parsed program code
[0840] Output: Parsed code that is sent back to the user
[0841] Specific working example:
[0842] The server generates the parsed code and sends it to the user as an HTTP response.
[0843] Based on the information from the emotion engine, the server determines the timing when the user is most receptive and returns the analysis results.
[0844] This series of steps allows users to quickly and accurately analyze and comment on other people's program code, making the most of that information to deepen their understanding.
[0845] (Application example 2)
[0846] Next, a description will be given of Application Example 2. In the following description, the data processing device 12 will be referred to as a "server" and the smart glasses 214 will be referred to as a "terminal."
[0847] While conventional program code analysis systems have the ability to automatically add appropriate comments to code, they do not provide feedback or adjust comments based on the user's emotional state. This has resulted in a lack of methods to reduce the stress and burden users feel when understanding code analysis results. This has been a particular issue for factory maintenance engineers, as the stress of analyzing robot operation code negatively impacts their productivity.
[0848] The specific processing by the specific processing unit 290 of the data processing device 12 in the application example 2 is realized by the following means.
[0849] In this invention, the server includes means for reading other people's program code and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, means for recognizing the user's emotions in real time and adjusting the analysis results and the comments, and means for displaying feedback based on the analyzed code and emotions on the user's device. This makes it possible to provide appropriate feedback according to the user's emotional state, reduce the stress of code analysis work, and improve the user experience.
[0850] "Third-party program code" is software code created by a person or organization other than the user.
[0851] "Structure" is a concept that refers to the layout of program code, the arrangement of modules and functions, and the relationships between them.
[0852] "Function" refers to the characteristics of what operations or processes each part of program code performs.
[0853] "Analysis" is the process of examining and understanding each part of a program code in order to understand its structure and function.
[0854] "Comments" are explanatory text or annotations added to program code to aid in understanding the code.
[0855] A "server" is a computer system for analyzing program code and generating comments.
[0856] A "user" is a person or organization that uses the system to upload program code and receive analyzed code.
[0857] An "emotion engine" is a technology that recognizes a user's emotional state and reflects that information in analysis and comment generation.
[0858] "Feedback" refers to the communication of information when the analyzed program code and comments are provided to the user.
[0859] The system for implementing the present invention is designed specifically for factory maintenance engineers, and provides the functionality to analyze robot operation codes, automatically add appropriate comments, and is superior in that it recognizes the user's emotions in real time and adjusts the content of the feedback accordingly.
[0860] System Configuration
[0861] The system includes the following major hardware and software:
[0862] 1. User Device
[0863] Hardware: Smart glasses (e.g., Google Glass, Microsoft HoloLens)
[0864] Software: OCR libraries (e.g., Tesseract OCR), emotion recognition libraries (e.g., OpenCV, Google's Mediapipe)
[0865] The smart glasses capture the robot's operational code read by the user with a camera and convert it into text using OCR. They also identify the user's facial expressions and tone of voice and obtain emotional data using an emotion recognition library.
[0866] 2. Server
[0867] Hardware: Cloud computing platforms (e.g., AWS EC2, Google Cloud)
[0868] Software: Code analysis engine (built in Python), emotion engine
[0869] The server analyzes the program code sent from the user's device. The analysis engine understands the structure and function of the program code and generates appropriate comments. The emotion engine also analyzes the user's emotions in real time and adjusts the content and timing of the comments accordingly.
[0870] Specific examples of processing
[0871] 1. Capture and send the code
[0872] The user uses smart glasses to capture the robot's operating code, which is then converted into text using OCR technology and sent to the server.
[0873] 2. Analysis of the program code
[0874] The server receives the submitted code and passes it to a code analysis engine, which analyzes each part of the code to understand its function and structure, and automatically generates comments based on the analysis results.
[0875] 3. Emotion recognition and feedback regulation
[0876] The smart glasses' camera and microphone capture the user's facial expressions and vocal tone. An emotion recognition library analyzes this data to determine the user's emotional state. The server uses this emotional information to adjust the generated comments and the timing of feedback. For example, if the user is stressed, the comments will be more polite and helpful.
[0877] 4. Viewing Feedback
[0878] The adjusted comments are displayed on the smart glasses' display, allowing users to see the analysis results in real time and take appropriate action.
[0879] Prompt Sentence Examples
[0880] Below is an example of a prompt sentence for the generative AI model based on the code read by the user and the emotion recognition results.
[0881] Program code:
[0882] python
[0883] def robotic_arm_move(x, y):
[0884] move_to_position(x, y)
[0885] If the emotion recognition result is "Stress":
[0886] Generative AI model input prompt:
[0887] Add a comment to the code below and politely message the user, as they are frustrated:
[0888] def robotic_arm_move(x, y):
[0889] move_to_position(x, y)
[0890] Generative AI model output example:
[0891] The function robotic_arm_move takes x and y coordinates and moves the robotic arm based on them
[0892] Don't worry: if you get an error in this step, check your x and y values
[0893] def robotic_arm_move(x, y):
[0894] move_to_position(x, y)
[0895] In this way, the system of the present invention aims to help factory maintenance engineers efficiently understand robot operation codes and reduce stress when performing correction work. This system provides appropriate feedback according to the user's emotional state, making it possible to improve work efficiency and accuracy.
[0896] The flow of the specific processing in the application example 2 will be described with reference to FIG.
[0897] Step 1:
[0898] The user uses the smart glasses to capture the robot's motion code.
[0899] Input: Smart glasses camera image
[0900] How it works: Using the camera on the smart glasses, the user presses the capture button to capture the robot's movement code.
[0901] Output: Photographed code image
[0902] Step 2:
[0903] The smart glasses capture the code image and convert it into text format using OCR technology.
[0904] Input: Photographed code image
[0905] How it works: Using the OCR library (e.g. Tesseract OCR) built into the smart glasses, characters in the image are extracted and converted into text data.
[0906] Output: Text data of the code
[0907] Step 3:
[0908] The smart glasses send the converted text data to the server.
[0909] Input: Text data of the code
[0910] How it works: The smart glasses use an internet connection (e.g., Wi-Fi or 5G) to send text data to a server as an HTTP POST request.
[0911] Output: Response that code text data was uploaded successfully to the server
[0912] Step 4:
[0913] The server passes the received code to an analysis engine, which analyzes the structure and function of the program code.
[0914] Input: Text data of the uploaded code
[0915] How it works: The server uses a parsing engine (built in Python) to analyze each piece of code and understand its function and structure.
[0916] Output: Code structure and function data as analysis results
[0917] Step 5:
[0918] The server automatically generates comments based on the analysis results.
[0919] Input: Code structure and function data
[0920] How it works: The code analysis engine sends prompts to the generative AI model to generate appropriate comments.
[0921] Output: Code data with comments
[0922] Step 6:
[0923] The smart glasses capture the user's facial expressions and voice tone and analyze the emotional data using an emotion recognition library.
[0924] Input: User facial expression and voice tone data
[0925] How it works: The smart glasses use emotion recognition libraries (e.g., OpenCV, Google's Mediapipe) to analyze the captured data and determine the user's emotional state.
[0926] Output: User's emotional state data
[0927] Step 7:
[0928] The server adjusts the generated comments based on the user's emotional state data.
[0929] Input: Commented code data, user emotional state data
[0930] How it works: The server uses an emotion engine to adjust the content and timing of comments based on the user's emotional state. For example, if the user is feeling stressed, the server will make the comments more polite.
[0931] Output: Adjusted and commented code data
[0932] Step 8:
[0933] The server sends the adjusted commented code data to the smart glasses for display.
[0934] Input: Adjusted and commented code data
[0935] How it works: The server sends data to the smart glasses via internet and displays it on the smart glasses' display. Users can check the analysis results and comments in real time.
[0936] Output: Analysis results and comments displayed on the smart glasses
[0937] The specific processing unit 290 transmits the result of the specific processing to the smart glasses 214. In the smart glasses 214, the control unit 46A causes the speaker 240 to output the result of the specific processing. The microphone 238 acquires audio indicating a user input regarding the result of the specific processing. The control unit 46A transmits audio data indicating the user input acquired by the microphone 238 to the data processing device 12. In the data processing device 12, the specific processing unit 290 acquires the audio data.
[0938] The data generation model 58 is a so-called generative AI (Artificial Intelligence). An example of the data generation model 58 is ChatGPT (Internet Search<URL: https: / / openai.com / blog / chatgpt> ), Gemini (Internet search <url: https: gemini.google.com ?hl="ja">) and other generation AIs. The data generation model 58 is obtained by performing deep learning on a neural network. A prompt including an instruction is input to the data generation model 58, and inference data such as voice data indicating voice, text data indicating text, and image data indicating an image is also input. The data generation model 58 performs inference on the input inference data in accordance with the instruction indicated by the prompt, and outputs the inference result in a data format such as voice data and text data. Here, inference refers to, for example, analysis, classification, prediction, and / or summarization.
[0939] In the above embodiment, an example in which the specific processing is performed by the data processing device 12 has been given, but the technology of the present disclosure is not limited to this, and the specific processing may be performed by the smart glasses 214.
[0940] [Third embodiment]
[0941] FIG. 5 shows an example of the configuration of a data processing system 310 according to the third embodiment.
[0942] 5, the data processing system 310 includes the data processing device 12 and a headset type terminal 314. An example of the data processing device 12 is a server.
[0943] The data processing device 12 includes a computer 22, a database 24, and a communication I / F 26. The computer 22 is an example of a "computer" according to the technology of the present disclosure. The computer 22 includes a processor 28, a RAM 30, and a storage 32. The processor 28, the RAM 30, and the storage 32 are connected to a bus 34. The database 24 and the communication I / F 26 are also connected to the bus 34. The communication I / F 26 is connected to a network 54. Examples of the network 54 include a WAN (Wide Area Network) and / or a LAN (Local Area Network).
[0944] The headset type terminal 314 includes a computer 36, a microphone 238, a speaker 240, a camera 42, a communication I / F 44, and a display 343. The computer 36 includes a processor 46, a RAM 48, and a storage 50. The processor 46, the RAM 48, and the storage 50 are connected to a bus 52. The microphone 238, the speaker 240, the camera 42, and the display 343 are also connected to the bus 52.
[0945] The microphone 238 receives instructions and the like from the user 20 by receiving voice uttered by the user 20. The microphone 238 captures the voice uttered by the user 20, converts the captured voice into audio data, and outputs it to the processor 46. The speaker 240 outputs audio in accordance with instructions from the processor 46.
[0946] Camera 42 is a small digital camera equipped with an optical system including a lens, aperture, and shutter, and an imaging element such as a CMOS (Complementary Metal-Oxide-Semiconductor) image sensor or a CCD (Charge Coupled Device) image sensor, and captures images of the surroundings of user 20 (for example, an imaging range defined by an angle of view equivalent to the field of vision of a typical healthy person).
[0947] The communication I / F 44 is connected to a network 54. The communication I / Fs 44 and 26 are responsible for the exchange of various information between the processor 46 and the processor 28 via the network 54. The exchange of various information between the processor 46 and the processor 28 using the communication I / Fs 44 and 26 is carried out in a secure state.
[0948] Fig. 6 shows an example of the main functions of the data processing device 12 and the headset type terminal 314. As shown in Fig. 6, in the data processing device 12, a specific process is performed by the processor 28. A specific process program 56 is stored in the storage 32.
[0949] The specific processing program 56 is an example of a "program" according to the technology of the present disclosure. The processor 28 reads the specific processing program 56 from the storage 32 and executes the read specific processing program 56 on the RAM 30. The specific processing is realized by the processor 28 operating as a specific processing unit 290 in accordance with the specific processing program 56 executed on the RAM 30.
[0950] The storage 32 stores a data generation model 58 and an emotion identification model 59. The data generation model 58 and the emotion identification model 59 are used by the identification processing unit 290.
[0951] In the headset type terminal 314, a reception output process is performed by the processor 46. A reception output program 60 is stored in the storage 50. The processor 46 reads the reception output program 60 from the storage 50 and executes the read reception output program 60 on the RAM 48. The reception output process is realized by the processor 46 operating as the control unit 46A in accordance with the reception output program 60 executed on the RAM 48.
[0952] Next, a description will be given of the identification process performed by the identification processing unit 290 of the data processing device 12. In the following description, the data processing device 12 will be referred to as the "server" and the headset type terminal 314 will be referred to as the "terminal."
[0953] The present invention relates to a system that reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. This system is particularly advantageous in that it provides the user with analysis results in real time, enabling quick code understanding. Specific embodiments for carrying out the present invention are described below.
[0954] 1. Overall structure
[0955] This system consists of the following main elements:
[0956] Server: Responsible for analyzing program code and generating comments.
[0957] User terminal: Provides an interface for users to upload code and receive analysis results.
[0958] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[0959] 2. Receiving the program code
[0960] A user selects a program code file from their device and uploads it to the server, which receives the HTTP POST request and stores the uploaded file on the server.
[0961] 3. Analysis of the program code
[0962] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of this code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[0963] 4. Automatic comment generation
[0964] The server receives the analysis results returned by the analysis engine and adds comments to the program code, so that the original code is provided to the user with appropriate comments inserted. The content of these comments can be adjusted to the required granularity, allowing for detailed explanations.
[0965] 5. Providing analysis results
[0966] The server then sends the analyzed program code, complete with added comments, back to the user, who can then review the analyzed code on their own device and deepen their understanding. The analysis results are provided in real time, so users can immediately check the content.
[0967] Specific examples
[0968] User-uploaded code example
[0969] Below is an example of the code that a user uploads when requesting analysis.
[0970] python
[0971] def multiply(a, b):
[0972] return ab
[0973] Example of analyzed code
[0974] After the server completes the analysis, the code returned to the user will have the following comment added:
[0975] python
[0976] The function multiply takes two arguments a and b and returns their product.
[0977] def multiply(a, b):
[0978] return ab
[0979] Description of the Examples
[0980] 1. The user selects the file containing the above code on their device and uploads it to the server.
[0981] 2. The server receives the contents of the uploaded file and sends it in text format to the analysis engine.
[0982] 3. The analysis engine analyzes the program code, understands its structure and function, and generates appropriate comments.
[0983] 4. The server generates code with added comments based on the analysis results obtained from the analysis engine.
[0984] 5. The server returns the parsed code with comments to the user in real time.
[0985] 6. Users receive analyzed code, allowing them to quickly understand the code.
[0986] In this way, the present invention significantly assists users in understanding the code by quickly and accurately analyzing other people's program code and adding appropriate comments.
[0987] The processing flow will be explained below.
[0988] Step 1:
[0989] The user prepares the program code they wish to analyze on their device, opens a browser on their device, and accesses the code analysis service's web application.
[0990] Step 2:
[0991] The user selects a program code file from the form in the web application and clicks the "Upload" button, which sends the program code file to the server.
[0992] Step 3:
[0993] The server receives an HTTP POST request. The server checks whether the file exists and returns an error response if the file does not exist. If the file exists, it reads the contents of the file in byte format, converts it to UTF-8 encoding, and retrieves it as a string.
[0994] Step 4:
[0995] The server sends a program code string to the analysis engine. At this time, the server generates an analysis request to the analysis engine to explain the structure and function of the code. Specifically, the server creates a prompt containing the content of the code and sends it to the analysis engine.
[0996] Step 5:
[0997] The analysis engine analyzes the program code. The analysis engine analyzes the received code, understands its structure and function, and generates appropriate comments. This analysis includes checking the code's syntax and analyzing its functions.
[0998] Step 6:
[0999] The analysis engine sends the results of the analysis back to the server, which receives the program code with the added comments and processes it as analyzed code.
[1000] Step 7:
[1001] The server returns the analysis results to the user. Specifically, it generates the analyzed code as a response in JSON format and returns it to the user's browser.
[1002] Step 8:
[1003] The user receives the analysis results and checks the analyzed code in the browser. The user can refer to the added comments to deepen their understanding of the code. Based on the analysis results, it becomes possible to quickly and accurately understand other people's code.
[1004] Example 1
[1005] Next, a description will be given of Example 1. In the following description, the data processing device 12 will be referred to as a "server" and the headset type terminal 314 will be referred to as a "terminal."
[1006] Analyzing program code and adding appropriate comments is an important task in software development. However, doing it manually can be very time-consuming, and it can be difficult to understand the structure and function of code, especially when the code was written by someone else. The purpose of this invention is to solve these problems and perform real-time code analysis and comment generation, allowing users to quickly and accurately understand the code.
[1007] The specific processing by the specific processing unit 290 of the data processing device 12 in the first embodiment is realized by the following means.
[1008] In this invention, the server includes means for reading program code of others and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to a user, means for using natural language processing technology to analyze the program code, means for a user to upload a program code file, means for receiving an HTTP request and saving the program code file, means for sending the program code to an analysis engine and receiving the analysis results, means for inserting comments into the program code and generating analyzed code, and means for returning the analyzed code to the user. This makes it possible to automatically analyze the structure and function of program code and insert appropriate comments in real time.
[1009] "Someone else's program code" means that the program in question was created by another developer or group, not by you.
[1010] "Analysis methods" refers to a set of processes and techniques for reading program code and identifying and extracting its structure and functionality.
[1011] "Method for automatically adding comments" refers to a technology or process that automatically inserts appropriate comments into program code based on analysis results.
[1012] "User provision means" refers to the technology or process for returning and providing the analyzed program code to the user in an appropriate format.
[1013] "Natural language processing technology" is an artificial intelligence technology for understanding and processing human language, and is used here to analyze program code and generate comments.
[1014] "Uploading method" refers to the technology or process by which a user sends a file from their device to a server.
[1015] "HTTP request receiving means" refers to the technology or process by which a server receives an HTTP request sent from a user's terminal.
[1016] "File storage means" refers to the technology or process for temporarily storing received program code files on the server side.
[1017] "Analysis engine transmission means" refers to the technology or process by which the server sends program code to the analysis engine and receives the analysis results.
[1018] "Comment insertion means" refers to a technique or process for appropriately inserting comments returned from the analysis engine into the original program code.
[1019] "Analyzed code generator" refers to a technique or process for generating commented program code.
[1020] "Real-time delivery means" refers to the technology or process for instantly returning and delivering the generated analyzed code to the user.
[1021] 1. System Configuration
[1022] The system of this invention is designed to read someone else's program code, analyze its structure and function, and automatically add appropriate comments. The system consists of the following main components:
[1023] Server: Responsible for analyzing program code and generating comments.
[1024] User terminal: Provides an interface for users to upload code and receive analysis results.
[1025] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[1026] 2. Upload the program code
[1027] The user selects a program code file on their device and uploads it to the server using the browser's file selection interface. This requires a standard web browser and an internet connection. When the user presses the upload button, the device sends the selected file data to the server in the body of an HTTP POST request.
[1028] 3. Receiving and storing on the server
[1029] The server parses the received HTTP POST request, extracts the file data from the body, and stores the extracted data in temporary storage on the server, which is typically a specific directory on a disk.
[1030] 4. Analysis of the program code
[1031] The server retrieves the saved file path and reads the file in text format. This text data is passed to an analysis engine. The analysis engine uses static analysis techniques and natural language processing (NLP) to analyze the code structure and functionality. NLP techniques include, for example, analysis algorithms written in Python.
[1032] 5. Comment Generation
[1033] The analysis engine generates explanatory comments for each part of the program code based on the results of static analysis. It uses natural language generation (NLG) technology to output comments in a format that is easy for humans to understand, explaining what each line of the program does.
[1034] 6. Inserting Comments
[1035] The server then inserts the comments returned by the parsing engine into the original program code appropriately, taking care not to alter the original code. For example, comments are added just before function definitions or at the beginning of loops. Comments are also inserted at the correct indentation level to maintain code readability.
[1036] 7. Return of analysis results
[1037] The server generates the program code with the comments inserted as a text file and returns it to the user's device in the form of an HTTP response, with an HTTP status code of 200 indicating that the request was processed successfully.
[1038] 8. Displaying the results
[1039] The user receives the HTTP response sent back from the server on their device. The response is displayed in the device's browser or text editor. The user can view the program code with properly added comments, allowing them to quickly understand the code.
[1040] Specific examples
[1041] Target program code
[1042] Below is an example of the code that a user uploads when requesting analysis.
[1043] def multiply(a, b):
[1044] return ab
[1045] Analyzed Code
[1046] After the server completes the analysis, the code returned to the user will have the following comment added:
[1047] The function multiply takes two arguments a and b and returns their product.
[1048] def multiply(a, b):
[1049] return ab
[1050] Prompt Sentence Examples
[1051] "Please analyze the following program code and add comments that explain its functionality:
[1052] def multiply(a, b):
[1053] return ab"
[1054] In this way, users can quickly and accurately understand other people's program code. This system significantly supports the understanding and maintenance of program code, especially in software development.
[1055] The flow of the identification process in the first embodiment will be described with reference to FIG.
[1056] Step 1:
[1057] A user selects a program code file on his / her device and uploads it to the server through the file selection interface of the web browser. As input, there is the program code file selected by the user. The user selects the program code file in the browser's file selection dialog and clicks the upload button. As output, the uploaded file data is sent to the server in the form of an HTTP POST request.
[1058] Step 2:
[1059] The server parses the received HTTP POST request and extracts the program code file data from its body. The input is the HTTP POST request sent to the server. To extract the data, the server parses the received request and retrieves the file data from the body. This data is saved in temporary storage and the directory path to the save location is output.
[1060] Step 3:
[1061] The server obtains the path of the saved program code file and reads the file in text format. The input is the directory path of the saved file. Using file system operations, it reads the text data from the specified file directory. This text data is output and sent to the analysis engine.
[1062] Step 4:
[1063] The analysis engine analyzes the text data of the received program code. The input is the text data of the program code. The analysis engine uses natural language processing and static analysis techniques to analyze the structure and function of the code. The data is processed to understand the meaning and function of each code block. The output is the analysis results.
[1064] Step 5:
[1065] The analysis engine generates appropriate comments for the program code based on the analysis results. The input is the structure and function information of the analyzed code. Natural language generation technology is used to create comments that are easy for humans to understand. The generated comments are obtained as the output.
[1066] Step 6:
[1067] The server inserts the comments returned by the analysis engine into the original program code appropriately. As input, it has the generated comments and the original program code. It adds the comments to the program code at the appropriate positions, adjusting the indentation level while preserving the code structure. As output, it generates the parsed code with the added comments.
[1068] Step 7:
[1069] The server returns the parsed code with the comments inserted to the user as an HTTP response. As input, it has the parsed code with the comments added. It generates an HTTP response and sends the parsed code with HTTP status code 200 to the user's device. As output, the parsed code is displayed in the browser.
[1070] Step 8:
[1071] The user receives the HTTP response returned from the server on their device and checks the parsed code in a browser or text editor. The input is the parsed code HTTP response. The user displays the returned code and checks the code with added comments to deepen their understanding. The output is the parsed code that has been understood.
[1072] In this way, by going through each step, the user can quickly and accurately understand program code created by others.
[1073] (Application example 1)
[1074] Next, a description will be given of Application Example 1. In the following description, the data processing device 12 will be referred to as a "server" and the headset type terminal 314 will be referred to as a "terminal."
[1075] The program code for robots used in factories is complex, and maintaining and debugging it requires a great deal of time and effort. This requires a method to quickly understand the code. Another issue is that if the content and detail of comments are inappropriate, the efficiency of engineers' work will decrease.
[1076] The specific processing by the specific processing unit 290 of the data processing device 12 in the application example 1 is realized by the following means.
[1077] In this invention, the server includes means for reading other people's program code and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, and means for analyzing the robot's program code and automatically adding comments. This not only enables the robot's program code to be understood quickly, but also makes maintenance and debugging more efficient since appropriate comments are automatically added.
[1078] "Other person's program code" refers to program code that is not created by the user himself / herself but is created by a third party.
[1079] "Structure" refers to the physical arrangement and organization of a program, such as the layout of program code, function hierarchy, and flow control.
[1080] "Function" refers to the specific task or action that program code performs, and indicates the role of each code block.
[1081] "Analyzing" refers to the process of examining the structure and function of program code in detail to understand its properties and workings.
[1082] "Comments" refer to text information that describes the meaning of a specific part of program code, an overview of processing, details of operation, etc.
[1083] "Add automatically" means that the system automatically adds the necessary comments to the program code without the user having to manually enter them.
[1084] "Analyzed code" refers to program code that has been subjected to analytical means to understand its structure and function and to have appropriate comments added.
[1085] "Providing to the user" means displaying the analyzed code on the user's terminal or making it available for download.
[1086] "Robot program code" refers to program code written to control robots used in factories, etc.
[1087] The term "means" refers to a method or system component for realizing a specific function or process in the present invention.
[1088] The system for realizing this invention reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. It can be used particularly to streamline maintenance and debugging of program code for robots operating in factories.
[1089] The system consists of the following main components:
[1090] 1. Server:
[1091] The server is a node that is responsible for the main processing of program code analysis and comment generation. The server includes the following hardware and software:
[1092] Hardware: A computer with a high-performance CPU, memory, and storage
[1093] Software: Operating system (e.g., Ubuntu), code analysis engine (e.g., AST analysis tool), generative AI model (e.g., GPT-4 using the transformers library)
[1094] 2. User Device:
[1095] The user terminal provides an interface for users to upload program code and receive analysis results. It includes the following hardware and software:
[1096] Hardware: Personal computers, tablet devices
[1097] Software: Web browser (e.g. Google Chrome)
[1098] 3. Design:
[1099] The system is designed according to the following steps:
[1100] Receiving program code: The user selects a program code file from their device and uploads it to the server. The server receives the HTTP POST request and stores the uploaded file on the server.
[1101] Analysis of program code: The server reads the received program code in text format and sends it to the analysis engine, which analyzes the structure and function of the code to understand what processing is taking place at each step.
[1102] Automatic comment generation: The server receives the analysis results returned by the analysis engine and adds comments to the program code. It uses a generative AI model (e.g., GPT-4) to generate appropriate comments for the code.
[1103] Providing analysis results: The server returns the analyzed program code with added comments to the user, allowing the user to review the analyzed code on their own device and deepen their understanding.
[1104] 4. Example:
[1105] Example code:
[1106] Below is an example of the code that a user uploads when requesting analysis.
[1107] python
[1108] def move_forward(steps):
[1109] for _ in range(steps):
[1110] execute_step()
[1111] def turn(direction):
[1112] if direction == "left":
[1113] turn_left()
[1114] elif direction == "right":
[1115] turn_right()
[1116] After the server completes the analysis, the code returned to the user will have the following comment added:
[1117] python
[1118] The move_forward function performs a forward movement for a given number of steps.
[1119] def move_forward(steps):
[1120] for _ in range(steps):
[1121] execute_step()
[1122] The turn function performs a left or right turn depending on the direction.
[1123] def turn(direction):
[1124] if direction == "left":
[1125] turn_left()
[1126] elif direction == "right":
[1127] turn_right()
[1128] Example prompt sentence:
[1129] Use the following prompt for the generative AI model:
[1130] Analyze the program code and add appropriate comments for each function and process.
[1131] code:
[1132] def move_forward(steps):
[1133] for _ in range(steps):
[1134] execute_step()
[1135] def turn(direction):
[1136] if direction == "left":
[1137] turn_left()
[1138] elif direction == "right":
[1139] turn_right()
[1140] This system automates the analysis and commenting of robot program code, allowing engineers to quickly understand the code, thereby making maintenance and debugging more efficient.
[1141] The flow of the specific processing in the application example 1 will be described with reference to FIG.
[1142] Step 1:
[1143] The user uses the terminal to select their program code file (e.g., robot_control.py) and upload it to the server. Specifically, the user selects the file from their local disk and sends an HTTP POST request to the server through the web interface. The input is the program code file, and the output is the file submission.
[1144] Step 2:
[1145] The server saves the received program code in text format and sends it to the analysis engine. The server receives the file data from the HTTP request and stores it temporarily. At this point, the file is saved in a temporary directory on the server. The input is the uploaded file to the server, and the output is transferred to the analysis engine.
[1146] Step 3:
[1147] The analysis engine analyzes the structure and function of the received program code. Specifically, it uses an AST (Abstract Syntax Tree) analysis tool to analyze the code structure and understand the role of each function and processing block. As a result of the analysis, comment candidates are generated for each processing part. The input is the program code in text format, and the output is structural information and comment candidates as the analysis results.
[1148] Step 4:
[1149] The server receives the structural information and comment candidates returned by the analysis engine and adds comments to the program code. Using a generative AI model (e.g., GPT-4), it generates detailed comments for each part of the code and inserts them into the original program code. This turns the program code into analyzed code with comments. The input is the analysis result of the analysis engine, and the output is the program code with the added comments.
[1150] Step 5:
[1151] The server returns the analyzed program code with comments to the user. Specifically, the server generates an analyzed code file and provides it to the user's device as a download link. The user can obtain and review the analyzed code through the link. The input is the program code file with comments added, and the output is the file provided to the user.
[1152] The above steps allow the robot program code to be analyzed and commented efficiently and automatically, greatly improving the efficiency of the engineering process.
[1153] Furthermore, an emotion engine that estimates the user's emotion may be further combined. That is, the identification processing unit 290 may estimate the user's emotion using the emotion identification model 59, and perform identification processing using the user's emotion.
[1154] The present invention combines an emotion engine with a system that reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. This system is particularly advantageous in that it provides the user with the analysis results in real time and adjusts the content and timing of the comments according to the user's emotions. Specific embodiments for implementing the present invention are described below.
[1155] 1. Overall structure
[1156] This system consists of the following main elements:
[1157] Server: Responsible for analyzing program code and generating comments.
[1158] User terminal: Provides an interface for users to upload code and receive analysis results.
[1159] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[1160] Emotion engine: An engine that recognizes user emotions and reflects them in analysis results and comment content.
[1161] 2. Receiving the program code
[1162] A user selects a program code file from their device and uploads it to the server, which receives the HTTP POST request and stores the uploaded file on the server.
[1163] 3. Analysis of the program code
[1164] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of the code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[1165] 4. User Emotion Recognition
[1166] When a user uses the system, the emotion engine acquires emotion data from the user's facial expressions, voice tone, etc. The emotion engine analyzes the acquired emotion data and determines the user's current emotional state.
[1167] 5. Automatic comment generation and moderation
[1168] The server receives the analysis results from the analysis engine and adds comments to the program code. At this time, it adjusts the content and expression of the comments based on the emotional information obtained from the emotion engine. For example, if the user is feeling stressed, the comments can be made more polite and kind.
[1169] 6. Provision of analysis results
[1170] The server then returns the analyzed program code with the added comments to the user. This process also utilizes information from the emotion engine to provide feedback at a time appropriate to the user's emotional state, increasing the user's receptivity to the analysis results.
[1171] Specific examples
[1172] User-uploaded code example
[1173] Below is an example of the code that a user uploads when requesting analysis.
[1174] python
[1175] def multiply(a, b):
[1176] return ab
[1177] Example of analyzed code
[1178] After the server completes the analysis, the code returned to the user will have the following comment added:
[1179] python
[1180] The function multiply takes two arguments a and b and returns their product.
[1181] def multiply(a, b):
[1182] return ab
[1183] Description of the Examples
[1184] 1. The user selects the file containing the above code on their device and uploads it to the server.
[1185] 2. The server receives the contents of the uploaded file and sends it in text format to the analysis engine.
[1186] 3. The analysis engine analyzes the program code, understands its structure and function, and generates appropriate comments.
[1187] 4. The emotion engine recognizes the user's emotions and adjusts the content of the analysis results and the timing of feedback based on that information.
[1188] 5. The server uses the information from the emotion engine to generate parsed code with added comments.
[1189] 6. The server returns the parsed code with comments added to it to the user in real time.
[1190] 7. The user receives the analysis results, checks the analyzed code in the browser, and deepens their understanding.
[1191] In this way, the present invention significantly supports users' understanding of the code by quickly and accurately analyzing other people's program code and adding appropriate comments. Furthermore, by adjusting the content and timing of comments based on the user's emotional information, the user experience can be improved.
[1192] The processing flow will be explained below.
[1193] Step 1:
[1194] The user prepares the program code they wish to analyze on their device, and then accesses the code analysis service's web application from their device.
[1195] Step 2:
[1196] A user selects a program code file from a form in a web application and clicks the "Upload" button, which sends the program code file to the server.
[1197] Step 3:
[1198] The server receives an HTTP POST request. The server checks whether the file exists and returns an error response if the file does not exist. If the file exists, it reads the contents of the file in byte format, converts it to UTF-8 encoding, and retrieves it as a string.
[1199] Step 4:
[1200] The server sends a program code string to the analysis engine. At this time, the server generates an analysis request to the analysis engine to explain the structure and function of the code. Specifically, the server creates a prompt containing the content of the code and sends it to the analysis engine.
[1201] Step 5:
[1202] The analysis engine analyzes the program code. The analysis engine analyzes the received code, understands its structure and function, and generates appropriate comments. This analysis includes checking the code's syntax and analyzing its functions.
[1203] Step 6:
[1204] The emotion engine recognizes the user's emotions. When a user uses the system, the emotion engine acquires emotional data from the user's facial expressions and tone of voice, and analyzes and judges their emotional state.
[1205] Step 7:
[1206] The server receives the analysis results returned by the analysis engine and adds comments to the program code. At this time, the server adjusts the content and expression of the comment based on the information from the emotion engine. For example, if the user is feeling stressed, the comment will be made more polite and kind.
[1207] Step 8:
[1208] The server returns the analyzed program code with added comments to the user. Utilizing information from the emotion engine, feedback is provided at a time appropriate to the user's emotional state. This increases the user's receptivity to the analysis results.
[1209] Step 9:
[1210] The user receives the analysis results and checks the analyzed code in the browser. The user can refer to the added comments to deepen their understanding of the code. Based on the analysis results, it becomes possible to quickly and accurately understand other people's code.
[1211] Example 2
[1212] Next, a description will be given of Example 2. In the following description, the data processing device 12 will be referred to as a "server" and the headset type terminal 314 will be referred to as a "terminal."
[1213] While conventional program code analysis systems have the ability to analyze code structure and function and automatically add comments, they have the problem of being unable to adjust the content of comments or the timing of feedback depending on the user's emotions and situation. This results in a suboptimal user experience, making it difficult to provide appropriate support to help users understand the code, especially in stressful situations.
[1214] The identification process by the identification processing unit 290 of the data processing device 12 in the second embodiment is realized by the following means. In this invention, the server includes means for reading program code of others and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, and means for recognizing the user's emotions and adjusting the content and timing of the comments. This makes it possible to add optimal comments and feedback according to the user's emotions, and is expected to improve the user experience.
[1215] "Third party program code" refers to the source code of a program created by a third party other than the code creator.
[1216] "Structure" refers to the components of program code, their arrangement, and their relationships.
[1217] "Function" refers to the specific operations and processing content of the program code.
[1218] "Means of analysis" refers to techniques and tools for understanding the structure and function of program code.
[1219] "Appropriate comments" refers to information such as explanatory text inserted to help understand program code.
[1220] "Automatic addition" refers to a method in which comments are generated and inserted automatically by the system rather than manually.
[1221] "Analyzed code" means program code whose structure and function have been analyzed using analytical tools and whose appropriate comments have been added.
[1222] "Means for providing to the user" refers to methods and tools for transmitting or displaying the analyzed code to the user.
[1223] "Means for recognizing a user's emotions and adjusting the content and timing of comments" refers to methods and tools that analyze a user's current emotional state and change the tone and timing of comments based on that.
[1224] 1. Overall structure
[1225] The system of the present invention comprises the following main elements: This system provides a function to analyze other people's program code and automatically add appropriate comments based on the user's sentiment.
[1226] Server: Responsible for analyzing program code and generating comments.
[1227] User terminal: Provides an interface for users to upload code and receive analysis results.
[1228] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[1229] Emotion engine: An engine that recognizes user emotions and reflects them in analysis results and comment content.
[1230] 2. Receiving the program code
[1231] The user selects a program code file from their device and uploads it to the server using an HTTP POST request. The server then stores the uploaded file in its internal storage.
[1232] 3. Analysis of the program code
[1233] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of the code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[1234] 4. User Emotion Recognition
[1235] When a user uses the system, the emotion engine acquires emotion data from the user's facial expressions, voice tone, etc. The emotion engine analyzes the acquired emotion data and determines the user's current emotional state.
[1236] 5. Automatic comment generation and moderation
[1237] The server receives the analysis results from the analysis engine and adds comments to the program code. At the same time, it adjusts the content and expression of the comments based on the emotional information obtained from the emotion engine. For example, if the user is feeling stressed, the comments can be made more polite and kind.
[1238] 6. Provision of analysis results
[1239] The server then returns the analyzed program code with the added comments to the user. This process also utilizes information from the emotion engine to provide feedback at a time appropriate to the user's emotional state, increasing the user's receptivity to the analysis results.
[1240] Specific examples
[1241] User-uploaded code example
[1242] Below is an example of the code that a user uploads when requesting analysis.
[1243] python
[1244] def multiply(a, b):
[1245] return ab
[1246] Example of analyzed code
[1247] After the server completes the analysis, the code returned to the user will have the following comment added:
[1248] python
[1249] The function multiply takes two arguments a and b and returns their product.
[1250] def multiply(a, b):
[1251] return ab
[1252] Prompt Sentence Examples
[1253] An example of a prompt sentence that the user enters into the system is as follows:
[1254] "Please analyze this code and add appropriate comments."
[1255] In this way, the present invention significantly supports users' understanding of the code by quickly and accurately analyzing other people's program code and adding appropriate comments. Furthermore, by adjusting the content and timing of comments based on the user's emotional information, the user experience can be improved.
[1256] The flow of the identification process in the second embodiment will be described with reference to FIG.
[1257] Step 1:
[1258] The user selects a program code file on their device that they wish to analyze. The selected file contains code data in text format. The user then uploads the file to the server using an HTTP POST request via a browser interface.
[1259] Input: User selected program code file
[1260] Output: Code data sent to the server via an HTTP POST request
[1261] Specific working example:
[1262] The user clicks the "Choose File" button in their browser.
[1263] The user selects a code file to analyze from their computer (e.g., multiply.py).
[1264] When the user clicks the "Upload" button, an HTTP POST request is sent to the server.
[1265] Step 2:
[1266] The server analyzes the HTTP POST request received from the user, extracts the contents of the code file, and saves the contents in the server's storage.
[1267] Input: HTTP POST request from user (program code file)
[1268] Output: Code file saved in server storage
[1269] Specific working example:
[1270] The server receives an HTTP POST request.
[1271] The server extracts the code from the request body and saves it in the specified directory in storage (e.g. / uploads / multiply.py).
[1272] Step 3:
[1273] The server reads the stored program code in text format and sends the text data to the analysis engine for syntax analysis. The analysis engine performs static and syntax analysis to understand the structure and function of the code.
[1274] Input: Code file stored in the server storage
[1275] Output: Text data passed to the analysis engine
[1276] Specific working example:
[1277] The server reads the saved code file.
[1278] The read text data is sent to the analysis engine.
[1279] The analysis engine analyzes the code's functions, variables, and logic flow.
[1280] Step 4:
[1281] As users interact with the system, the emotion engine captures their facial expressions and vocal tone in real time and analyzes the data to determine their emotional state, such as relaxed, stressed, or confused.
[1282] Input: User's facial expression, voice tone data
[1283] Output: Parsed user's emotional state
[1284] Specific working example:
[1285] The emotion engine collects data using the camera and microphone on the user's device.
[1286] The emotion engine analyzes the collected data in real time and classifies the user's emotions (e.g., stress state).
[1287] Step 5:
[1288] The server receives the analysis results from the analysis engine and adds appropriate comments to the program code, adjusting the content and expression of the comments based on the user's emotional state obtained from the emotion engine.
[1289] Input: Code analysis results from the analysis engine, user emotional state from the emotion engine
[1290] Output: Parsed code with comments added
[1291] Specific working example:
[1292] The server receives the results from the analysis engine, including the analysis information and generated comments for each code block.
[1293] The server receives the user's emotional state data from the emotion engine and makes adjustments, such as when to use a gentler tone or polite expressions.
[1294] The server adds comments to the code and generates the final parsed code.
[1295] Step 6:
[1296] The server then returns the analyzed program code with the added comments to the user, utilizing information from the emotion engine to provide optimal feedback based on the user's emotional state.
[1297] Input: Commented and parsed program code
[1298] Output: Parsed code that is sent back to the user
[1299] Specific working example:
[1300] The server generates the parsed code and sends it to the user as an HTTP response.
[1301] Based on the information from the emotion engine, the server determines the timing when the user is most receptive and returns the analysis results.
[1302] This series of steps allows users to quickly and accurately analyze and comment on other people's program code, making the most of that information to deepen their understanding.
[1303] (Application example 2)
[1304] Next, a description will be given of Application Example 2. In the following description, the data processing device 12 will be referred to as a "server" and the headset type terminal 314 will be referred to as a "terminal."
[1305] While conventional program code analysis systems have the ability to automatically add appropriate comments to code, they do not provide feedback or adjust comments based on the user's emotional state. This has resulted in a lack of methods to reduce the stress and burden users feel when understanding code analysis results. This has been a particular issue for factory maintenance engineers, as the stress of analyzing robot operation code negatively impacts their productivity.
[1306] The specific processing by the specific processing unit 290 of the data processing device 12 in the application example 2 is realized by the following means.
[1307] In this invention, the server includes means for reading other people's program code and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, means for recognizing the user's emotions in real time and adjusting the analysis results and the comments, and means for displaying feedback based on the analyzed code and emotions on the user's device. This makes it possible to provide appropriate feedback according to the user's emotional state, reduce the stress of code analysis work, and improve the user experience.
[1308] "Third-party program code" is software code created by a person or organization other than the user.
[1309] "Structure" is a concept that refers to the layout of program code, the arrangement of modules and functions, and the relationships between them.
[1310] "Function" refers to the characteristics of what operations or processes each part of program code performs.
[1311] "Analysis" is the process of examining and understanding each part of a program code in order to understand its structure and function.
[1312] "Comments" are explanatory text or annotations added to program code to aid in understanding the code.
[1313] A "server" is a computer system for analyzing program code and generating comments.
[1314] A "user" is a person or organization that uses the system to upload program code and receive analyzed code.
[1315] An "emotion engine" is a technology that recognizes a user's emotional state and reflects that information in analysis and comment generation.
[1316] "Feedback" refers to the communication of information when the analyzed program code and comments are provided to the user.
[1317] The system for implementing the present invention is designed specifically for factory maintenance engineers, and provides the functionality to analyze robot operation codes, automatically add appropriate comments, and is superior in that it recognizes the user's emotions in real time and adjusts the content of the feedback accordingly.
[1318] System Configuration
[1319] The system includes the following major hardware and software:
[1320] 1. User Device
[1321] Hardware: Smart glasses (e.g., Google Glass, Microsoft HoloLens)
[1322] Software: OCR libraries (e.g., Tesseract OCR), emotion recognition libraries (e.g., OpenCV, Google's Mediapipe)
[1323] The smart glasses capture the robot's operational code read by the user with a camera and convert it into text using OCR. They also identify the user's facial expressions and tone of voice and obtain emotional data using an emotion recognition library.
[1324] 2. Server
[1325] Hardware: Cloud computing platforms (e.g., AWS EC2, Google Cloud)
[1326] Software: Code analysis engine (built in Python), emotion engine
[1327] The server analyzes the program code sent from the user's device. The analysis engine understands the structure and function of the program code and generates appropriate comments. The emotion engine also analyzes the user's emotions in real time and adjusts the content and timing of the comments accordingly.
[1328] Specific examples of processing
[1329] 1. Capture and send the code
[1330] The user uses smart glasses to capture the robot's operating code, which is then converted into text using OCR technology and sent to the server.
[1331] 2. Analysis of the program code
[1332] The server receives the submitted code and passes it to a code analysis engine, which analyzes each part of the code to understand its function and structure, and automatically generates comments based on the analysis results.
[1333] 3. Emotion recognition and feedback regulation
[1334] The smart glasses' camera and microphone capture the user's facial expressions and vocal tone. An emotion recognition library analyzes this data to determine the user's emotional state. The server uses this emotional information to adjust the generated comments and the timing of feedback. For example, if the user is stressed, the comments will be more polite and helpful.
[1335] 4. Viewing Feedback
[1336] The adjusted comments are displayed on the smart glasses' display, allowing users to see the analysis results in real time and take appropriate action.
[1337] Prompt Sentence Examples
[1338] Below is an example of a prompt sentence for the generative AI model based on the code read by the user and the emotion recognition results.
[1339] Program code:
[1340] python
[1341] def robotic_arm_move(x, y):
[1342] move_to_position(x, y)
[1343] If the emotion recognition result is "Stress":
[1344] Generative AI model input prompt:
[1345] Add a comment to the code below and politely message the user, as they are frustrated:
[1346] def robotic_arm_move(x, y):
[1347] move_to_position(x, y)
[1348] Generative AI model output example:
[1349] The function robotic_arm_move takes x and y coordinates and moves the robotic arm based on them
[1350] Don't worry: if you get an error in this step, check your x and y values
[1351] def robotic_arm_move(x, y):
[1352] move_to_position(x, y)
[1353] In this way, the system of the present invention aims to help factory maintenance engineers efficiently understand robot operation codes and reduce stress when performing correction work. This system provides appropriate feedback according to the user's emotional state, making it possible to improve work efficiency and accuracy.
[1354] The flow of the specific processing in the application example 2 will be described with reference to FIG.
[1355] Step 1:
[1356] The user uses the smart glasses to capture the robot's motion code.
[1357] Input: Smart glasses camera image
[1358] How it works: Using the camera on the smart glasses, the user presses the capture button to capture the robot's movement code.
[1359] Output: Photographed code image
[1360] Step 2:
[1361] The smart glasses capture the code image and convert it into text format using OCR technology.
[1362] Input: Photographed code image
[1363] How it works: Using the OCR library (e.g. Tesseract OCR) built into the smart glasses, characters in the image are extracted and converted into text data.
[1364] Output: Text data of the code
[1365] Step 3:
[1366] The smart glasses send the converted text data to the server.
[1367] Input: Text data of the code
[1368] How it works: The smart glasses use an internet connection (e.g., Wi-Fi or 5G) to send text data to a server as an HTTP POST request.
[1369] Output: Response that code text data was uploaded successfully to the server
[1370] Step 4:
[1371] The server passes the received code to an analysis engine, which analyzes the structure and function of the program code.
[1372] Input: Text data of the uploaded code
[1373] How it works: The server uses a parsing engine (built in Python) to analyze each piece of code and understand its function and structure.
[1374] Output: Code structure and function data as analysis results
[1375] Step 5:
[1376] The server automatically generates comments based on the analysis results.
[1377] Input: Code structure and function data
[1378] How it works: The code analysis engine sends prompts to the generative AI model to generate appropriate comments.
[1379] Output: Code data with comments
[1380] Step 6:
[1381] The smart glasses capture the user's facial expressions and voice tone and analyze the emotional data using an emotion recognition library.
[1382] Input: User facial expression and voice tone data
[1383] How it works: The smart glasses use emotion recognition libraries (e.g., OpenCV, Google's Mediapipe) to analyze the captured data and determine the user's emotional state.
[1384] Output: User's emotional state data
[1385] Step 7:
[1386] The server adjusts the generated comments based on the user's emotional state data.
[1387] Input: Commented code data, user emotional state data
[1388] How it works: The server uses an emotion engine to adjust the content and timing of comments based on the user's emotional state. For example, if the user is feeling stressed, the server will make the comments more polite.
[1389] Output: Adjusted and commented code data
[1390] Step 8:
[1391] The server sends the adjusted commented code data to the smart glasses for display.
[1392] Input: Adjusted and commented code data
[1393] How it works: The server sends data to the smart glasses via internet and displays it on the smart glasses' display. Users can check the analysis results and comments in real time.
[1394] Output: Analysis results and comments displayed on the smart glasses
[1395] The specific processing unit 290 transmits the result of the specific processing to the headset type terminal 314. In the headset type terminal 314, the control unit 46A causes the speaker 240 and the display 343 to output the result of the specific processing. The microphone 238 acquires audio indicating a user input regarding the result of the specific processing. The control unit 46A transmits audio data indicating the user input acquired by the microphone 238 to the data processing device 12. In the data processing device 12, the specific processing unit 290 acquires the audio data.
[1396] The data generation model 58 is a so-called generative AI (Artificial Intelligence). An example of the data generation model 58 is ChatGPT (Internet Search<URL: https: / / openai.com / blog / chatgpt> ), Gemini (Internet search <url: https: gemini.google.com ?hl="ja">) and other generation AIs. The data generation model 58 is obtained by performing deep learning on a neural network. A prompt including an instruction is input to the data generation model 58, and inference data such as voice data indicating voice, text data indicating text, and image data indicating an image is also input. The data generation model 58 performs inference on the input inference data in accordance with the instruction indicated by the prompt, and outputs the inference result in a data format such as voice data and text data. Here, inference refers to, for example, analysis, classification, prediction, and / or summarization.
[1397] In the above embodiment, an example was given in which the specific processing is performed by the data processing device 12, but the technology of the present disclosure is not limited to this, and the specific processing may be performed by the headset type terminal 314.
[1398] [Fourth embodiment]
[1399] FIG. 7 shows an example of the configuration of a data processing system 410 according to the fourth embodiment.
[1400] 7, a data processing system 410 includes a data processing device 12 and a robot 414. An example of the data processing device 12 is a server.
[1401] The data processing device 12 includes a computer 22, a database 24, and a communication I / F 26. The computer 22 is an example of a "computer" according to the technology of the present disclosure. The computer 22 includes a processor 28, a RAM 30, and a storage 32. The processor 28, the RAM 30, and the storage 32 are connected to a bus 34. The database 24 and the communication I / F 26 are also connected to the bus 34. The communication I / F 26 is connected to a network 54. Examples of the network 54 include a WAN (Wide Area Network) and / or a LAN (Local Area Network).
[1402] The robot 414 includes a computer 36, a microphone 238, a speaker 240, a camera 42, a communication I / F 44, and a control target 443. The computer 36 includes a processor 46, a RAM 48, and a storage 50. The processor 46, the RAM 48, and the storage 50 are connected to a bus 52. The microphone 238, the speaker 240, the camera 42, and the control target 443 are also connected to the bus 52.
[1403] The microphone 238 receives instructions and the like from the user 20 by receiving voice uttered by the user 20. The microphone 238 captures the voice uttered by the user 20, converts the captured voice into audio data, and outputs it to the processor 46. The speaker 240 outputs audio in accordance with instructions from the processor 46.
[1404] Camera 42 is a small digital camera equipped with an optical system including a lens, aperture, and shutter, and an imaging element such as a CMOS (Complementary Metal-Oxide-Semiconductor) image sensor or a CCD (Charge Coupled Device) image sensor, and captures images of the surroundings of user 20 (for example, an imaging range defined by an angle of view equivalent to the field of vision of a typical healthy person).
[1405] The communication I / F 44 is connected to a network 54. The communication I / Fs 44 and 26 are responsible for the exchange of various information between the processor 46 and the processor 28 via the network 54. The exchange of various information between the processor 46 and the processor 28 using the communication I / Fs 44 and 26 is carried out in a secure state.
[1406] The control object 443 includes a display device, LEDs in the eyes, and motors for driving the arms, hands, and feet. The posture and gestures of the robot 414 are controlled by controlling the motors of the arms, hands, and feet. Some of the emotions of the robot 414 can be expressed by controlling these motors. In addition, the facial expressions of the robot 414 can also be expressed by controlling the light emission state of the LEDs in the eyes of the robot 414.
[1407] Fig. 8 shows an example of the main functions of the data processing device 12 and the robot 414. As shown in Fig. 8, in the data processing device 12, a specific process is performed by the processor 28. A specific process program 56 is stored in the storage 32.
[1408] The specific processing program 56 is an example of a "program" according to the technology of the present disclosure. The processor 28 reads the specific processing program 56 from the storage 32 and executes the read specific processing program 56 on the RAM 30. The specific processing is realized by the processor 28 operating as a specific processing unit 290 in accordance with the specific processing program 56 executed on the RAM 30.
[1409] The storage 32 stores a data generation model 58 and an emotion identification model 59. The data generation model 58 and the emotion identification model 59 are used by the identification processing unit 290.
[1410] In the robot 414, the processor 46 performs the reception output process. A reception output program 60 is stored in the storage 50. The processor 46 reads the reception output program 60 from the storage 50 and executes the read reception output program 60 on the RAM 48. The reception output process is realized by the processor 46 operating as the control unit 46A in accordance with the reception output program 60 executed on the RAM 48.
[1411] Next, a description will be given of the specific processing performed by the specific processing unit 290 of the data processing device 12. In the following description, the data processing device 12 will be referred to as a "server" and the robot 414 will be referred to as a "terminal."
[1412] The present invention relates to a system that reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. This system is particularly advantageous in that it provides the user with analysis results in real time, enabling quick code understanding. Specific embodiments for carrying out the present invention are described below.
[1413] 1. Overall structure
[1414] This system consists of the following main elements:
[1415] Server: Responsible for analyzing program code and generating comments.
[1416] User terminal: Provides an interface for users to upload code and receive analysis results.
[1417] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[1418] 2. Receiving the program code
[1419] A user selects a program code file from their device and uploads it to the server, which receives the HTTP POST request and stores the uploaded file on the server.
[1420] 3. Analysis of the program code
[1421] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of this code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[1422] 4. Automatic comment generation
[1423] The server receives the analysis results returned by the analysis engine and adds comments to the program code, so that the original code is provided to the user with appropriate comments inserted. The content of these comments can be adjusted to the required granularity, allowing for detailed explanations.
[1424] 5. Providing analysis results
[1425] The server then sends the analyzed program code, complete with added comments, back to the user, who can then review the analyzed code on their own device and deepen their understanding. The analysis results are provided in real time, so users can immediately check the content.
[1426] Specific examples
[1427] User-uploaded code example
[1428] Below is an example of the code that a user uploads when requesting analysis.
[1429] python
[1430] def multiply(a, b):
[1431] return ab
[1432] Example of analyzed code
[1433] After the server completes the analysis, the code returned to the user will have the following comment added:
[1434] python
[1435] The function multiply takes two arguments a and b and returns their product.
[1436] def multiply(a, b):
[1437] return ab
[1438] Description of the Examples
[1439] 1. The user selects the file containing the above code on their device and uploads it to the server.
[1440] 2. The server receives the contents of the uploaded file and sends it in text format to the analysis engine.
[1441] 3. The analysis engine analyzes the program code, understands its structure and function, and generates appropriate comments.
[1442] 4. The server generates code with added comments based on the analysis results obtained from the analysis engine.
[1443] 5. The server returns the parsed code with comments to the user in real time.
[1444] 6. Users receive analyzed code, allowing them to quickly understand the code.
[1445] In this way, the present invention significantly assists users in understanding the code by quickly and accurately analyzing other people's program code and adding appropriate comments.
[1446] The processing flow will be explained below.
[1447] Step 1:
[1448] The user prepares the program code they wish to analyze on their device, opens a browser on their device, and accesses the code analysis service's web application.
[1449] Step 2:
[1450] The user selects a program code file from the form in the web application and clicks the "Upload" button, which sends the program code file to the server.
[1451] Step 3:
[1452] The server receives an HTTP POST request. The server checks whether the file exists and returns an error response if the file does not exist. If the file exists, it reads the contents of the file in byte format, converts it to UTF-8 encoding, and retrieves it as a string.
[1453] Step 4:
[1454] The server sends a program code string to the analysis engine. At this time, the server generates an analysis request to the analysis engine to explain the structure and function of the code. Specifically, the server creates a prompt containing the content of the code and sends it to the analysis engine.
[1455] Step 5:
[1456] The analysis engine analyzes the program code. The analysis engine analyzes the received code, understands its structure and function, and generates appropriate comments. This analysis includes checking the code's syntax and analyzing its functions.
[1457] Step 6:
[1458] The analysis engine sends the results of the analysis back to the server, which receives the program code with the added comments and processes it as analyzed code.
[1459] Step 7:
[1460] The server returns the analysis results to the user. Specifically, it generates the analyzed code as a response in JSON format and returns it to the user's browser.
[1461] Step 8:
[1462] The user receives the analysis results and checks the analyzed code in the browser. The user can refer to the added comments to deepen their understanding of the code. Based on the analysis results, it becomes possible to quickly and accurately understand other people's code.
[1463] Example 1
[1464] Next, a description will be given of Example 1. In the following description, the data processing device 12 will be referred to as a "server" and the robot 414 will be referred to as a "terminal."
[1465] Analyzing program code and adding appropriate comments is an important task in software development. However, doing it manually can be very time-consuming, and it can be difficult to understand the structure and function of code, especially when the code was written by someone else. The purpose of this invention is to solve these problems and perform real-time code analysis and comment generation, allowing users to quickly and accurately understand the code.
[1466] The specific processing by the specific processing unit 290 of the data processing device 12 in the first embodiment is realized by the following means.
[1467] In this invention, the server includes means for reading program code of others and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to a user, means for using natural language processing technology to analyze the program code, means for a user to upload a program code file, means for receiving an HTTP request and saving the program code file, means for sending the program code to an analysis engine and receiving the analysis results, means for inserting comments into the program code and generating analyzed code, and means for returning the analyzed code to the user. This makes it possible to automatically analyze the structure and function of program code and insert appropriate comments in real time.
[1468] "Someone else's program code" means that the program in question was created by another developer or group, not by you.
[1469] "Analysis methods" refers to a set of processes and techniques for reading program code and identifying and extracting its structure and functionality.
[1470] "Method for automatically adding comments" refers to a technology or process that automatically inserts appropriate comments into program code based on analysis results.
[1471] "User provision means" refers to the technology or process for returning and providing the analyzed program code to the user in an appropriate format.
[1472] "Natural language processing technology" is an artificial intelligence technology for understanding and processing human language, and is used here to analyze program code and generate comments.
[1473] "Uploading method" refers to the technology or process by which a user sends a file from their device to a server.
[1474] "HTTP request receiving means" refers to the technology or process by which a server receives an HTTP request sent from a user's terminal.
[1475] "File storage means" refers to the technology or process for temporarily storing received program code files on the server side.
[1476] "Analysis engine transmission means" refers to the technology or process by which the server sends program code to the analysis engine and receives the analysis results.
[1477] "Comment insertion means" refers to a technique or process for appropriately inserting comments returned from the analysis engine into the original program code.
[1478] "Analyzed code generator" refers to a technique or process for generating commented program code.
[1479] "Real-time delivery means" refers to the technology or process for instantly returning and delivering the generated analyzed code to the user.
[1480] 1. System Configuration
[1481] The system of this invention is designed to read someone else's program code, analyze its structure and function, and automatically add appropriate comments. The system consists of the following main components:
[1482] Server: Responsible for analyzing program code and generating comments.
[1483] User terminal: Provides an interface for users to upload code and receive analysis results.
[1484] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[1485] 2. Upload the program code
[1486] The user selects a program code file on their device and uploads it to the server using the browser's file selection interface. This requires a standard web browser and an internet connection. When the user presses the upload button, the device sends the selected file data to the server in the body of an HTTP POST request.
[1487] 3. Receiving and storing on the server
[1488] The server parses the received HTTP POST request, extracts the file data from the body, and stores the extracted data in temporary storage on the server, which is typically a specific directory on a disk.
[1489] 4. Analysis of the program code
[1490] The server retrieves the saved file path and reads the file in text format. This text data is passed to an analysis engine. The analysis engine uses static analysis techniques and natural language processing (NLP) to analyze the code structure and functionality. NLP techniques include, for example, analysis algorithms written in Python.
[1491] 5. Comment Generation
[1492] The analysis engine generates explanatory comments for each part of the program code based on the results of static analysis. It uses natural language generation (NLG) technology to output comments in a format that is easy for humans to understand, explaining what each line of the program does.
[1493] 6. Inserting Comments
[1494] The server then inserts the comments returned by the parsing engine into the original program code appropriately, taking care not to alter the original code. For example, comments are added just before function definitions or at the beginning of loops. Comments are also inserted at the correct indentation level to maintain code readability.
[1495] 7. Return of analysis results
[1496] The server generates the program code with the comments inserted as a text file and returns it to the user's device in the form of an HTTP response, with an HTTP status code of 200 indicating that the request was processed successfully.
[1497] 8. Displaying the results
[1498] The user receives the HTTP response sent back from the server on their device. The response is displayed in the device's browser or text editor. The user can view the program code with properly added comments, allowing them to quickly understand the code.
[1499] Specific examples
[1500] Target program code
[1501] Below is an example of the code that a user uploads when requesting analysis.
[1502] def multiply(a, b):
[1503] return ab
[1504] Analyzed Code
[1505] After the server completes the analysis, the code returned to the user will have the following comment added:
[1506] The function multiply takes two arguments a and b and returns their product.
[1507] def multiply(a, b):
[1508] return ab
[1509] Prompt Sentence Examples
[1510] "Please analyze the following program code and add comments that explain its functionality:
[1511] def multiply(a, b):
[1512] return ab"
[1513] In this way, users can quickly and accurately understand other people's program code. This system significantly supports the understanding and maintenance of program code, especially in software development.
[1514] The flow of the identification process in the first embodiment will be described with reference to FIG.
[1515] Step 1:
[1516] A user selects a program code file on his / her device and uploads it to the server through the file selection interface of the web browser. As input, there is the program code file selected by the user. The user selects the program code file in the browser's file selection dialog and clicks the upload button. As output, the uploaded file data is sent to the server in the form of an HTTP POST request.
[1517] Step 2:
[1518] The server parses the received HTTP POST request and extracts the program code file data from its body. The input is the HTTP POST request sent to the server. To extract the data, the server parses the received request and retrieves the file data from the body. This data is saved in temporary storage and the directory path to the save location is output.
[1519] Step 3:
[1520] The server obtains the path of the saved program code file and reads the file in text format. The input is the directory path of the saved file. Using file system operations, it reads the text data from the specified file directory. This text data is output and sent to the analysis engine.
[1521] Step 4:
[1522] The analysis engine analyzes the text data of the received program code. The input is the text data of the program code. The analysis engine uses natural language processing and static analysis techniques to analyze the structure and function of the code. The data is processed to understand the meaning and function of each code block. The output is the analysis results.
[1523] Step 5:
[1524] The analysis engine generates appropriate comments for the program code based on the analysis results. The input is the structure and function information of the analyzed code. Natural language generation technology is used to create comments that are easy for humans to understand. The generated comments are obtained as the output.
[1525] Step 6:
[1526] The server inserts the comments returned by the analysis engine into the original program code appropriately. As input, it has the generated comments and the original program code. It adds the comments to the program code at the appropriate positions, adjusting the indentation level while preserving the code structure. As output, it generates the parsed code with the added comments.
[1527] Step 7:
[1528] The server returns the parsed code with the comments inserted to the user as an HTTP response. As input, it has the parsed code with the comments added. It generates an HTTP response and sends the parsed code with HTTP status code 200 to the user's device. As output, the parsed code is displayed in the browser.
[1529] Step 8:
[1530] The user receives the HTTP response returned from the server on their device and checks the parsed code in a browser or text editor. The input is the parsed code HTTP response. The user displays the returned code and checks the code with added comments to deepen their understanding. The output is the parsed code that has been understood.
[1531] In this way, by going through each step, the user can quickly and accurately understand program code created by others.
[1532] (Application example 1)
[1533] Next, a description will be given of Application Example 1. In the following description, the data processing device 12 will be referred to as a "server" and the robot 414 will be referred to as a "terminal."
[1534] The program code for robots used in factories is complex, and maintaining and debugging it requires a great deal of time and effort. This requires a method to quickly understand the code. Another issue is that if the content and detail of comments are inappropriate, the efficiency of engineers' work will decrease.
[1535] The specific processing by the specific processing unit 290 of the data processing device 12 in the application example 1 is realized by the following means.
[1536] In this invention, the server includes means for reading other people's program code and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, and means for analyzing the robot's program code and automatically adding comments. This not only enables the robot's program code to be understood quickly, but also makes maintenance and debugging more efficient since appropriate comments are automatically added.
[1537] "Other person's program code" refers to program code that is not created by the user himself / herself but is created by a third party.
[1538] "Structure" refers to the physical arrangement and organization of a program, such as the layout of program code, function hierarchy, and flow control.
[1539] "Function" refers to the specific task or action that program code performs, and indicates the role of each code block.
[1540] "Analyzing" refers to the process of examining the structure and function of program code in detail to understand its properties and workings.
[1541] "Comments" refer to text information that describes the meaning of a specific part of program code, an overview of processing, details of operation, etc.
[1542] "Add automatically" means that the system automatically adds the necessary comments to the program code without the user having to manually enter them.
[1543] "Analyzed code" refers to program code that has been subjected to analytical means to understand its structure and function and to have appropriate comments added.
[1544] "Providing to the user" means displaying the analyzed code on the user's terminal or making it available for download.
[1545] "Robot program code" refers to program code written to control robots used in factories, etc.
[1546] The term "means" refers to a method or system component for realizing a specific function or process in the present invention.
[1547] The system for realizing this invention reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. It can be used particularly to streamline maintenance and debugging of program code for robots operating in factories.
[1548] The system consists of the following main components:
[1549] 1. Server:
[1550] The server is a node that is responsible for the main processing of program code analysis and comment generation. The server includes the following hardware and software:
[1551] Hardware: A computer with a high-performance CPU, memory, and storage
[1552] Software: Operating system (e.g., Ubuntu), code analysis engine (e.g., AST analysis tool), generative AI model (e.g., GPT-4 using the transformers library)
[1553] 2. User Device:
[1554] The user terminal provides an interface for users to upload program code and receive analysis results. It includes the following hardware and software:
[1555] Hardware: Personal computers, tablet devices
[1556] Software: Web browser (e.g. Google Chrome)
[1557] 3. Design:
[1558] The system is designed according to the following steps:
[1559] Receiving program code: The user selects a program code file from their device and uploads it to the server. The server receives the HTTP POST request and stores the uploaded file on the server.
[1560] Analysis of program code: The server reads the received program code in text format and sends it to the analysis engine, which analyzes the structure and function of the code to understand what processing is taking place at each step.
[1561] Automatic comment generation: The server receives the analysis results returned by the analysis engine and adds comments to the program code. It uses a generative AI model (e.g., GPT-4) to generate appropriate comments for the code.
[1562] Providing analysis results: The server returns the analyzed program code with added comments to the user, allowing the user to review the analyzed code on their own device and deepen their understanding.
[1563] 4. Example:
[1564] Example code:
[1565] Below is an example of the code that a user uploads when requesting analysis.
[1566] python
[1567] def move_forward(steps):
[1568] for _ in range(steps):
[1569] execute_step()
[1570] def turn(direction):
[1571] if direction == "left":
[1572] turn_left()
[1573] elif direction == "right":
[1574] turn_right()
[1575] After the server completes the analysis, the code returned to the user will have the following comment added:
[1576] python
[1577] The move_forward function performs a forward movement for a given number of steps.
[1578] def move_forward(steps):
[1579] for _ in range(steps):
[1580] execute_step()
[1581] The turn function performs a left or right turn depending on the direction.
[1582] def turn(direction):
[1583] if direction == "left":
[1584] turn_left()
[1585] elif direction == "right":
[1586] turn_right()
[1587] Example prompt sentence:
[1588] Use the following prompt for the generative AI model:
[1589] Analyze the program code and add appropriate comments for each function and process.
[1590] code:
[1591] def move_forward(steps):
[1592] for _ in range(steps):
[1593] execute_step()
[1594] def turn(direction):
[1595] if direction == "left":
[1596] turn_left()
[1597] elif direction == "right":
[1598] turn_right()
[1599] This system automates the analysis and commenting of robot program code, allowing engineers to quickly understand the code, thereby making maintenance and debugging more efficient.
[1600] The flow of the specific processing in the application example 1 will be described with reference to FIG.
[1601] Step 1:
[1602] The user uses the terminal to select their program code file (e.g., robot_control.py) and upload it to the server. Specifically, the user selects the file from their local disk and sends an HTTP POST request to the server through the web interface. The input is the program code file, and the output is the file submission.
[1603] Step 2:
[1604] The server saves the received program code in text format and sends it to the analysis engine. The server receives the file data from the HTTP request and stores it temporarily. At this point, the file is saved in a temporary directory on the server. The input is the uploaded file to the server, and the output is transferred to the analysis engine.
[1605] Step 3:
[1606] The analysis engine analyzes the structure and function of the received program code. Specifically, it uses an AST (Abstract Syntax Tree) analysis tool to analyze the code structure and understand the role of each function and processing block. As a result of the analysis, comment candidates are generated for each processing part. The input is the program code in text format, and the output is structural information and comment candidates as the analysis results.
[1607] Step 4:
[1608] The server receives the structural information and comment candidates returned by the analysis engine and adds comments to the program code. Using a generative AI model (e.g., GPT-4), it generates detailed comments for each part of the code and inserts them into the original program code. This turns the program code into analyzed code with comments. The input is the analysis result of the analysis engine, and the output is the program code with the added comments.
[1609] Step 5:
[1610] The server returns the analyzed program code with comments to the user. Specifically, the server generates an analyzed code file and provides it to the user's device as a download link. The user can obtain and review the analyzed code through the link. The input is the program code file with comments added, and the output is the file provided to the user.
[1611] The above steps allow the robot program code to be analyzed and commented efficiently and automatically, greatly improving the efficiency of the engineering process.
[1612] Furthermore, an emotion engine that estimates the user's emotion may be further combined. That is, the identification processing unit 290 may estimate the user's emotion using the emotion identification model 59, and perform identification processing using the user's emotion.
[1613] The present invention combines an emotion engine with a system that reads other people's program code, analyzes its structure and function, and automatically adds appropriate comments. This system is particularly advantageous in that it provides the user with the analysis results in real time and adjusts the content and timing of the comments according to the user's emotions. Specific embodiments for implementing the present invention are described below.
[1614] 1. Overall structure
[1615] This system consists of the following main elements:
[1616] Server: Responsible for analyzing program code and generating comments.
[1617] User terminal: Provides an interface for users to upload code and receive analysis results.
[1618] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[1619] Emotion engine: An engine that recognizes user emotions and reflects them in analysis results and comment content.
[1620] 2. Receiving the program code
[1621] A user selects a program code file from their device and uploads it to the server, which receives the HTTP POST request and stores the uploaded file on the server.
[1622] 3. Analysis of the program code
[1623] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of the code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[1624] 4. User Emotion Recognition
[1625] When a user uses the system, the emotion engine acquires emotion data from the user's facial expressions, voice tone, etc. The emotion engine analyzes the acquired emotion data and determines the user's current emotional state.
[1626] 5. Automatic comment generation and moderation
[1627] The server receives the analysis results from the analysis engine and adds comments to the program code. At this time, it adjusts the content and expression of the comments based on the emotional information obtained from the emotion engine. For example, if the user is feeling stressed, the comments can be made more polite and kind.
[1628] 6. Provision of analysis results
[1629] The server then returns the analyzed program code with the added comments to the user. This process also utilizes information from the emotion engine to provide feedback at a time appropriate to the user's emotional state, increasing the user's receptivity to the analysis results.
[1630] Specific examples
[1631] User-uploaded code example
[1632] Below is an example of the code that a user uploads when requesting analysis.
[1633] python
[1634] def multiply(a, b):
[1635] return ab
[1636] Example of analyzed code
[1637] After the server completes the analysis, the code returned to the user will have the following comment added:
[1638] python
[1639] The function multiply takes two arguments a and b and returns their product.
[1640] def multiply(a, b):
[1641] return ab
[1642] Description of the Examples
[1643] 1. The user selects the file containing the above code on their device and uploads it to the server.
[1644] 2. The server receives the contents of the uploaded file and sends it in text format to the analysis engine.
[1645] 3. The analysis engine analyzes the program code, understands its structure and function, and generates appropriate comments.
[1646] 4. The emotion engine recognizes the user's emotions and adjusts the content of the analysis results and the timing of feedback based on that information.
[1647] 5. The server uses the information from the emotion engine to generate parsed code with added comments.
[1648] 6. The server returns the parsed code with comments added to it to the user in real time.
[1649] 7. The user receives the analysis results, checks the analyzed code in the browser, and deepens their understanding.
[1650] In this way, the present invention significantly supports users' understanding of the code by quickly and accurately analyzing other people's program code and adding appropriate comments. Furthermore, by adjusting the content and timing of comments based on the user's emotional information, the user experience can be improved.
[1651] The processing flow will be explained below.
[1652] Step 1:
[1653] The user prepares the program code they wish to analyze on their device, and then accesses the code analysis service's web application from their device.
[1654] Step 2:
[1655] A user selects a program code file from a form in a web application and clicks the "Upload" button, which sends the program code file to the server.
[1656] Step 3:
[1657] The server receives an HTTP POST request. The server checks whether the file exists and returns an error response if the file does not exist. If the file exists, it reads the contents of the file in byte format, converts it to UTF-8 encoding, and retrieves it as a string.
[1658] Step 4:
[1659] The server sends a program code string to the analysis engine. At this time, the server generates an analysis request to the analysis engine to explain the structure and function of the code. Specifically, the server creates a prompt containing the content of the code and sends it to the analysis engine.
[1660] Step 5:
[1661] The analysis engine analyzes the program code. The analysis engine analyzes the received code, understands its structure and function, and generates appropriate comments. This analysis includes checking the code's syntax and analyzing its functions.
[1662] Step 6:
[1663] The emotion engine recognizes the user's emotions. When a user uses the system, the emotion engine acquires emotional data from the user's facial expressions and tone of voice, and analyzes and judges their emotional state.
[1664] Step 7:
[1665] The server receives the analysis results returned by the analysis engine and adds comments to the program code. At this time, the server adjusts the content and expression of the comment based on the information from the emotion engine. For example, if the user is feeling stressed, the comment will be made more polite and kind.
[1666] Step 8:
[1667] The server returns the analyzed program code with added comments to the user. Utilizing information from the emotion engine, feedback is provided at a time appropriate to the user's emotional state. This increases the user's receptivity to the analysis results.
[1668] Step 9:
[1669] The user receives the analysis results and checks the analyzed code in the browser. The user can refer to the added comments to deepen their understanding of the code. Based on the analysis results, it becomes possible to quickly and accurately understand other people's code.
[1670] Example 2
[1671] Next, a description will be given of Example 2. In the following description, the data processing device 12 will be referred to as a "server" and the robot 414 will be referred to as a "terminal."
[1672] While conventional program code analysis systems have the ability to analyze code structure and function and automatically add comments, they have the problem of being unable to adjust the content of comments or the timing of feedback depending on the user's emotions and situation. This results in a suboptimal user experience, making it difficult to provide appropriate support to help users understand the code, especially in stressful situations.
[1673] The identification process by the identification processing unit 290 of the data processing device 12 in the second embodiment is realized by the following means. In this invention, the server includes means for reading program code of others and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, and means for recognizing the user's emotions and adjusting the content and timing of the comments. This makes it possible to add optimal comments and feedback according to the user's emotions, and is expected to improve the user experience.
[1674] "Third party program code" refers to the source code of a program created by a third party other than the code creator.
[1675] "Structure" refers to the components of program code, their arrangement, and their relationships.
[1676] "Function" refers to the specific operations and processing content of the program code.
[1677] "Means of analysis" refers to techniques and tools for understanding the structure and function of program code.
[1678] "Appropriate comments" refers to information such as explanatory text inserted to help understand program code.
[1679] "Automatic addition" refers to a method in which comments are generated and inserted automatically by the system rather than manually.
[1680] "Analyzed code" means program code whose structure and function have been analyzed using analytical tools and whose appropriate comments have been added.
[1681] "Means for providing to the user" refers to methods and tools for transmitting or displaying the analyzed code to the user.
[1682] "Means for recognizing a user's emotions and adjusting the content and timing of comments" refers to methods and tools that analyze a user's current emotional state and change the tone and timing of comments based on that.
[1683] 1. Overall structure
[1684] The system of the present invention comprises the following main elements: This system provides a function to analyze other people's program code and automatically add appropriate comments based on the user's sentiment.
[1685] Server: Responsible for analyzing program code and generating comments.
[1686] User terminal: Provides an interface for users to upload code and receive analysis results.
[1687] Analysis engine: Contains algorithms that analyze program code and generate appropriate comments.
[1688] Emotion engine: An engine that recognizes user emotions and reflects them in analysis results and comment content.
[1689] 2. Receiving the program code
[1690] The user selects a program code file from their device and uploads it to the server using an HTTP POST request. The server then stores the uploaded file in its internal storage.
[1691] 3. Analysis of the program code
[1692] The server reads the received program code in text format and sends it to the analysis engine. The analysis engine analyzes the structure and function of the code and understands what processing is performed at each step. The analysis engine adds appropriate comments to each processing part so that the computer program can be properly understood.
[1693] 4. User Emotion Recognition
[1694] When a user uses the system, the emotion engine acquires emotion data from the user's facial expressions, voice tone, etc. The emotion engine analyzes the acquired emotion data and determines the user's current emotional state.
[1695] 5. Automatic comment generation and moderation
[1696] The server receives the analysis results from the analysis engine and adds comments to the program code. At the same time, it adjusts the content and expression of the comments based on the emotional information obtained from the emotion engine. For example, if the user is feeling stressed, the comments can be made more polite and kind.
[1697] 6. Provision of analysis results
[1698] The server then returns the analyzed program code with the added comments to the user. This process also utilizes information from the emotion engine to provide feedback at a time appropriate to the user's emotional state, increasing the user's receptivity to the analysis results.
[1699] Specific examples
[1700] User-uploaded code example
[1701] Below is an example of the code that a user uploads when requesting analysis.
[1702] python
[1703] def multiply(a, b):
[1704] return ab
[1705] Example of analyzed code
[1706] After the server completes the analysis, the code returned to the user will have the following comment added:
[1707] python
[1708] The function multiply takes two arguments a and b and returns their product.
[1709] def multiply(a, b):
[1710] return ab
[1711] Prompt Sentence Examples
[1712] An example of a prompt sentence that the user enters into the system is as follows:
[1713] "Please analyze this code and add appropriate comments."
[1714] In this way, the present invention significantly supports users' understanding of the code by quickly and accurately analyzing other people's program code and adding appropriate comments. Furthermore, by adjusting the content and timing of comments based on the user's emotional information, the user experience can be improved.
[1715] The flow of the identification process in the second embodiment will be described with reference to FIG.
[1716] Step 1:
[1717] The user selects a program code file on their device that they wish to analyze. The selected file contains code data in text format. The user then uploads the file to the server using an HTTP POST request via a browser interface.
[1718] Input: User selected program code file
[1719] Output: Code data sent to the server via an HTTP POST request
[1720] Specific working example:
[1721] The user clicks the "Choose File" button in their browser.
[1722] The user selects a code file to analyze from their computer (e.g., multiply.py).
[1723] When the user clicks the "Upload" button, an HTTP POST request is sent to the server.
[1724] Step 2:
[1725] The server analyzes the HTTP POST request received from the user, extracts the contents of the code file, and saves the contents in the server's storage.
[1726] Input: HTTP POST request from user (program code file)
[1727] Output: Code file saved in server storage
[1728] Specific working example:
[1729] The server receives an HTTP POST request.
[1730] The server extracts the code from the request body and saves it in the specified directory in storage (e.g. / uploads / multiply.py).
[1731] Step 3:
[1732] The server reads the stored program code in text format and sends the text data to the analysis engine for syntax analysis. The analysis engine performs static and syntax analysis to understand the structure and function of the code.
[1733] Input: Code file stored in the server storage
[1734] Output: Text data passed to the analysis engine
[1735] Specific working example:
[1736] The server reads the saved code file.
[1737] The read text data is sent to the analysis engine.
[1738] The analysis engine analyzes the code's functions, variables, and logic flow.
[1739] Step 4:
[1740] As users interact with the system, the emotion engine captures their facial expressions and vocal tone in real time and analyzes the data to determine their emotional state, such as relaxed, stressed, or confused.
[1741] Input: User's facial expression, voice tone data
[1742] Output: Parsed user's emotional state
[1743] Specific working example:
[1744] The emotion engine collects data using the camera and microphone on the user's device.
[1745] The emotion engine analyzes the collected data in real time and classifies the user's emotions (e.g., stress state).
[1746] Step 5:
[1747] The server receives the analysis results from the analysis engine and adds appropriate comments to the program code, adjusting the content and expression of the comments based on the user's emotional state obtained from the emotion engine.
[1748] Input: Code analysis results from the analysis engine, user emotional state from the emotion engine
[1749] Output: Parsed code with comments added
[1750] Specific working example:
[1751] The server receives the results from the analysis engine, including the analysis information and generated comments for each code block.
[1752] The server receives the user's emotional state data from the emotion engine and makes adjustments, such as when to use a gentler tone or polite expressions.
[1753] The server adds comments to the code and generates the final parsed code.
[1754] Step 6:
[1755] The server then returns the analyzed program code with the added comments to the user, utilizing information from the emotion engine to provide optimal feedback based on the user's emotional state.
[1756] Input: Commented and parsed program code
[1757] Output: Parsed code that is sent back to the user
[1758] Specific working example:
[1759] The server generates the parsed code and sends it to the user as an HTTP response.
[1760] Based on the information from the emotion engine, the server determines the timing when the user is most receptive and returns the analysis results.
[1761] This series of steps allows users to quickly and accurately analyze and comment on other people's program code, making the most of that information to deepen their understanding.
[1762] (Application example 2)
[1763] Next, a description will be given of Application Example 2. In the following description, the data processing device 12 will be referred to as a "server" and the robot 414 will be referred to as a "terminal."
[1764] While conventional program code analysis systems have the ability to automatically add appropriate comments to code, they do not provide feedback or adjust comments based on the user's emotional state. This has resulted in a lack of methods to reduce the stress and burden users feel when understanding code analysis results. This has been a particular issue for factory maintenance engineers, as the stress of analyzing robot operation code negatively impacts their productivity.
[1765] The specific processing by the specific processing unit 290 of the data processing device 12 in the application example 2 is realized by the following means.
[1766] In this invention, the server includes means for reading other people's program code and analyzing its structure and function, means for automatically adding appropriate comments to the program code based on the analysis results, means for providing the analyzed code to the user, means for recognizing the user's emotions in real time and adjusting the analysis results and the comments, and means for displaying feedback based on the analyzed code and emotions on the user's device. This makes it possible to provide appropriate feedback according to the user's emotional state, reduce the stress of code analysis work, and improve the user experience.
[1767] "Third-party program code" is software code created by a person or organization other than the user.
[1768] "Structure" is a concept that refers to the layout of program code, the arrangement of modules and functions, and the relationships between them.
[1769] "Function" refers to the characteristics of what operations or processes each part of program code performs.
[1770] "Analysis" is the process of examining and understanding each part of a program code in order to understand its structure and function.
[1771] "Comments" are explanatory text or annotations added to program code to aid in understanding the code.
[1772] A "server" is a computer system for analyzing program code and generating comments.
[1773] A "user" is a person or organization that uses the system to upload program code and receive analyzed code.
[1774] An "emotion engine" is a technology that recognizes a user's emotional state and reflects that information in analysis and comment generation.
[1775] "Feedback" refers to the communication of information when the analyzed program code and comments are provided to the user.
[1776] The system for implementing the present invention is designed specifically for factory maintenance engineers, and provides the functionality to analyze robot operation codes, automatically add appropriate comments, and is superior in that it recognizes the user's emotions in real time and adjusts the content of the feedback accordingly.
[1777] System Configuration
[1778] The system includes the following major hardware and software:
[1779] 1. User Device
[1780] Hardware: Smart glasses (e.g., Google Glass, Microsoft HoloLens)
[1781] Software: OCR libraries (e.g., Tesseract OCR), emotion recognition libraries (e.g., OpenCV, Google's Mediapipe)
[1782] The smart glasses capture the robot's operational code read by the user with a camera and convert it into text using OCR. They also identify the user's facial expressions and tone of voice and obtain emotional data using an emotion recognition library.
[1783] 2. Server
[1784] Hardware: Cloud computing platforms (e.g., AWS EC2, Google Cloud)
[1785] Software: Code analysis engine (built in Python), emotion engine
[1786] The server analyzes the program code sent from the user's device. The analysis engine understands the structure and function of the program code and generates appropriate comments. The emotion engine also analyzes the user's emotions in real time and adjusts the content and timing of the comments accordingly.
[1787] Specific examples of processing
[1788] 1. Capture and send the code
[1789] The user uses smart glasses to capture the robot's operating code, which is then converted into text using OCR technology and sent to the server.
[1790] 2. Analysis of the program code
[1791] The server receives the submitted code and passes it to a code analysis engine, which analyzes each part of the code to understand its function and structure, and automatically generates comments based on the analysis results.
[1792] 3. Emotion recognition and feedback regulation
[1793] The smart glasses' camera and microphone capture the user's facial expressions and vocal tone. An emotion recognition library analyzes this data to determine the user's emotional state. The server uses this emotional information to adjust the generated comments and the timing of feedback. For example, if the user is stressed, the comments will be more polite and helpful.
[1794] 4. Viewing Feedback
[1795] The adjusted comments are displayed on the smart glasses' display, allowing users to see the analysis results in real time and take appropriate action.
[1796] Prompt Sentence Examples
[1797] Below is an example of a prompt sentence for the generative AI model based on the code read by the user and the emotion recognition results.
[1798] Program code:
[1799] python
[1800] def robotic_arm_move(x, y):
[1801] move_to_position(x, y)
[1802] If the emotion recognition result is "Stress":
[1803] Generative AI model input prompt:
[1804] Add a comment to the code below and politely message the user, as they are frustrated:
[1805] def robotic_arm_move(x, y):
[1806] move_to_position(x, y)
[1807] Generative AI model output example:
[1808] The function robotic_arm_move takes x and y coordinates and moves the robotic arm based on them
[1809] Don't worry: if you get an error in this step, check your x and y values
[1810] def robotic_arm_move(x, y):
[1811] move_to_position(x, y)
[1812] In this way, the system of the present invention aims to help factory maintenance engineers efficiently understand robot operation codes and reduce stress when performing correction work. This system provides appropriate feedback according to the user's emotional state, making it possible to improve work efficiency and accuracy.
[1813] The flow of the specific processing in the application example 2 will be described with reference to FIG.
[1814] Step 1:
[1815] The user uses the smart glasses to capture the robot's motion code.
[1816] Input: Smart glasses camera image
[1817] How it works: Using the camera on the smart glasses, the user presses the capture button to capture the robot's movement code.
[1818] Output: Photographed code image
[1819] Step 2:
[1820] The smart glasses capture the code image and convert it into text format using OCR technology.
[1821] Input: Photographed code image
[1822] How it works: Using the OCR library (e.g. Tesseract OCR) built into the smart glasses, characters in the image are extracted and converted into text data.
[1823] Output: Text data of the code
[1824] Step 3:
[1825] The smart glasses send the converted text data to the server.
[1826] Input: Text data of the code
[1827] How it works: The smart glasses use an internet connection (e.g., Wi-Fi or 5G) to send text data to a server as an HTTP POST request.
[1828] Output: Response that code text data was uploaded successfully to the server
[1829] Step 4:
[1830] The server passes the received code to an analysis engine, which analyzes the structure and function of the program code.
[1831] Input: Text data of the uploaded code
[1832] How it works: The server uses a parsing engine (built in Python) to analyze each piece of code and understand its function and structure.
[1833] Output: Code structure and function data as analysis results
[1834] Step 5:
[1835] The server automatically generates comments based on the analysis results.
[1836] Input: Code structure and function data
[1837] How it works: The code analysis engine sends prompts to the generative AI model to generate appropriate comments.
[1838] Output: Code data with comments
[1839] Step 6:
[1840] The smart glasses capture the user's facial expressions and voice tone and analyze the emotional data using an emotion recognition library.
[1841] Input: User facial expression and voice tone data
[1842] How it works: The smart glasses use emotion recognition libraries (e.g., OpenCV, Google's Mediapipe) to analyze the captured data and determine the user's emotional state.
[1843] Output: User's emotional state data
[1844] Step 7:
[1845] The server adjusts the generated comments based on the user's emotional state data.
[1846] Input: Commented code data, user emotional state data
[1847] How it works: The server uses an emotion engine to adjust the content and timing of comments based on the user's emotional state. For example, if the user is feeling stressed, the server will make the comments more polite.
[1848] Output: Adjusted and commented code data
[1849] Step 8:
[1850] The server sends the adjusted commented code data to the smart glasses for display.
[1851] Input: Adjusted and commented code data
[1852] How it works: The server sends data to the smart glasses via internet and displays it on the smart glasses' display. Users can check the analysis results and comments in real time.
[1853] Output: Analysis results and comments displayed on the smart glasses
[1854] The specific processing unit 290 transmits the result of the specific processing to the robot 414. In the robot 414, the control unit 46A causes the speaker 240 and the control target 443 to output the result of the specific processing. The microphone 238 acquires voice indicating a user input regarding the result of the specific processing. The control unit 46A transmits voice data indicating the user input acquired by the microphone 238 to the data processing device 12. In the data processing device 12, the specific processing unit 290 acquires the voice data.
[1855] The data generation model 58 is a so-called generative AI (Artificial Intelligence). An example of the data generation model 58 is ChatGPT (Internet Search<URL: https: / / openai.com / blog / chatgpt> ), Gemini (Internet search <url: https: gemini.google.com ?hl="ja">) and other generation AIs. The data generation model 58 is obtained by performing deep learning on a neural network. A prompt including an instruction is input to the data generation model 58, and inference data such as voice data indicating voice, text data indicating text, and image data indicating an image is also input. The data generation model 58 performs inference on the input inference data in accordance with the instruction indicated by the prompt, and outputs the inference result in a data format such as voice data and text data. Here, inference refers to, for example, analysis, classification, prediction, and / or summarization.
[1856] In the above embodiment, an example was given in which the specific processing is performed by the data processing device 12, but the technology of the present disclosure is not limited to this, and the specific processing may be performed by the robot 414.
[1857] The emotion identification model 59 as an emotion engine may determine the user's emotion according to a specific mapping. Specifically, the emotion identification model 59 may determine the user's emotion according to an emotion map (see FIG. 9), which is a specific mapping. Similarly, the emotion identification model 59 may determine the robot's emotion, and the identification processing unit 290 may perform identification processing using the robot's emotion.
[1858] FIG. 9 is a diagram illustrating an emotion map 400 on which multiple emotions are mapped. In the emotion map 400, emotions are arranged in concentric circles radiating from the center. Emotions closer to the center of the concentric circles are more primitive. Emotions representing states and actions arising from a state of mind are arranged on the outer edges of the concentric circles. The concept of emotion includes both affect and mental states. Emotions generally generated from reactions occurring in the brain are arranged on the left side of the concentric circles. Emotions generally induced by situational judgment are arranged on the right side of the concentric circles. Emotions generally generated from reactions occurring in the brain and induced by situational judgment are arranged on the upper and lower sides of the concentric circles. Furthermore, the emotion of "pleasure" is arranged on the upper side of the concentric circles, and the emotion of "discomfort" is arranged on the lower side. In this way, in the emotion map 400, multiple emotions are mapped based on the structure by which emotions are generated, and emotions that tend to occur simultaneously are mapped close to each other.
[1859] These emotions are distributed in the 3 o'clock direction on emotion map 400, and typically fluctuate between relief and anxiety. In the right half of emotion map 400, situational awareness dominates over internal sensations, resulting in a sense of calm.
[1860] The inside of emotion map 400 represents what is going on in the mind, and the outside of emotion map 400 represents behavior, so the further you go outside emotion map 400, the more visible the emotions become (the more they are expressed in behavior).
[1861] Human emotions are based on various balances, such as posture and blood sugar levels. When these balances deviate from the ideal, a state of discomfort is indicated, and when they approach the ideal, a state of pleasure is indicated. Emotions can also be created for robots, automobiles, and motorcycles, based on various balances, such as posture and remaining battery life. When these balances deviate from the ideal, a state of discomfort is indicated, and when they approach the ideal, a state of pleasure is indicated. An emotion map can be generated, for example, based on Dr. Mitsuyoshi's emotion map (Research on Voice Emotion Recognition and Emotional Brain Physiological Signal Analysis Systems, Tokushima University, Doctoral Dissertation: https: / / ci.nii.ac.jp / naid / 500000375379). The left half of the emotion map lists emotions belonging to the "reaction" domain, where sensation is dominant. The right half of the emotion map lists emotions belonging to the "situation" domain, where situational awareness is dominant.
[1862] The emotion map defines two emotions that promote learning. One is a negative emotion on the situation side, around the middle of "repentance" or "reflection." In other words, this occurs when the robot experiences negative emotions such as "I never want to feel this way again" or "I don't want to be scolded again." The other is a positive emotion on the response side, around "desire." In other words, this occurs when the robot experiences positive feelings such as "I want more" or "I want to know more."
[1863] The emotion identification model 59 inputs user input into a pre-trained neural network, obtains emotion values indicating each emotion shown in the emotion map 400, and determines the user's emotion. This neural network is pre-trained based on multiple pieces of training data that are combinations of user input and emotion values indicating each emotion shown in the emotion map 400. Furthermore, this neural network is trained so that emotions that are located close to each other have similar values, as in the emotion map 900 shown in FIG. 10. FIG. 10 shows an example in which multiple emotions, "relieved," "calm," and "reassuring," have similar emotion values.
[1864] The system according to the present disclosure has been described above mainly with respect to the functions of the data processing device 12, but the system according to the present disclosure is not necessarily implemented on a server. The system according to the present disclosure may be implemented as a general information processing system. The present disclosure may be implemented, for example, as a software program running on a personal computer or an application running on a smartphone, etc. The method according to the present disclosure may be provided to users in the form of SaaS (Software as a Service).
[1865] In the above embodiment, an example was given in which the specific processing is performed by one computer 22, but the technology of the present disclosure is not limited to this, and the specific processing may be distributed and performed by a plurality of computers including the computer 22. For example, the data generation model 58 may be provided in an external device of the data processing device 12, and data may be generated in the external device in accordance with input data.
[1866] In the above embodiment, an example in which the specific processing program 56 is stored in the storage 32 has been described, but the technology of the present disclosure is not limited to this. For example, the specific processing program 56 may be stored in a portable, computer-readable, non-transitory storage medium such as a USB (Universal Serial Bus) memory. The specific processing program 56 stored in the non-transitory storage medium is installed in the computer 22 of the data processing device 12. The processor 28 executes the specific processing in accordance with the specific processing program 56.
[1867] Alternatively, the specific processing program 56 may be stored in a storage device such as a server connected to the data processing device 12 via the network 54, and the specific processing program 56 may be downloaded and installed on the computer 22 in response to a request from the data processing device 12.
[1868] It is not necessary to store all of the specific processing program 56 in a storage device such as a server connected to the data processing device 12 via the network 54, or to store all of the specific processing program 56 in the storage 32; only a portion of the specific processing program 56 may be stored.
[1869] The hardware resource for executing a specific process can be any of the following processors: An example of a processor is a CPU, which is a general-purpose processor that functions as a hardware resource for executing a specific process by executing software, i.e., a program. Another example of a processor is a dedicated electrical circuit, such as an FPGA (Field-Programmable Gate Array), a PLD (Programmable Logic Device), or an ASIC (Application Specific Integrated Circuit), which is a processor with a circuit configuration designed specifically for executing a specific process. Each processor has built-in or connected memory, and each processor uses the memory to execute the specific process.
[1870] The hardware resource that executes the specific processing may be configured with one of these various processors, or may be configured with a combination of two or more processors of the same or different types (for example, a combination of multiple FPGAs, or a combination of a CPU and an FPGA). Also, the hardware resource that executes the specific processing may be a single processor.
[1871] As an example of a system configured with a single processor, first, one processor is configured by combining one or more CPUs and software, and this processor functions as a hardware resource that executes a specific process. Second, there is a system that uses a processor that realizes the functions of an entire system including multiple hardware resources that execute a specific process on a single IC chip, as typified by SoC (System-on-a-chip). In this way, a specific process is realized using one or more of the above-mentioned various processors as hardware resources.
[1872] Furthermore, the hardware structure of these various processors can be, more specifically, an electric circuit that combines circuit elements such as semiconductor devices. The specific processing described above is merely an example. Therefore, it goes without saying that unnecessary steps may be deleted, new steps may be added, or the processing order may be rearranged, without departing from the spirit of the invention.
[1873] The above-described description and illustrations are a detailed explanation of the parts related to the technology of the present disclosure and are merely an example of the technology of the present disclosure. For example, the above description of the configuration, functions, actions, and effects is an explanation of an example of the configuration, functions, actions, and effects of the parts related to the technology of the present disclosure. Therefore, it goes without saying that unnecessary parts may be deleted, new elements may be added, or replacements may be made to the above-described description and illustrations within the scope of the gist of the technology of the present disclosure. Furthermore, to avoid confusion and facilitate understanding of the parts related to the technology of the present disclosure, the above-described description and illustrations omit explanations of common technical knowledge that do not require particular explanation to enable the implementation of the technology of the present disclosure.
[1874] All publications, patent applications, and technical standards mentioned in this specification are herein incorporated by reference to the same extent as if each individual publication, patent application, or technical standard was specifically and individually indicated to be incorporated by reference.
[1875] The following is further disclosed regarding the above embodiment.
[1876] (Claim 1)
[1877] A means for reading other people's program code and analyzing its structure and function;
[1878] A means for automatically adding appropriate comments to program code based on the analysis results;
[1879] a means for providing the analyzed code to the user;
[1880] A system including:
[1881] (Claim 2)
[1882] 2. The system according to claim 1, further comprising means for enabling a user to adjust the granularity of the comments in the analysis results.
[1883] (Claim 3)
[1884] 10. The system of claim 1, further comprising means for supporting code analysis based on directory structure.
[1885] (Claim 4)
[1886] 10. The system of claim 1, further comprising means for providing the analysis results to a user in real time.
[1887] "Example 1"
[1888] (Claim 1)
[1889] A means for reading other people's program code and analyzing its structure and function;
[1890] A means for automatically adding appropriate comments to program code based on the analysis results;
[1891] a means for providing the analyzed code to the user;
[1892] A means for utilizing natural language processing techniques for analyzing program code;
[1893] a means for users to upload program code files;
[1894] means for receiving HTTP requests and storing program code files;
[1895] A means for sending program code to the analysis engine and receiving the analysis results;
[1896] means for inserting comments into program code and generating parsed code;
[1897] means for returning the parsed code to the user;
[1898] A system including:
[1899] (Claim 2)
[1900] 2. The system according to claim 1, further comprising means for enabling a user to adjust the granularity of the comments in the analysis results.
[1901] (Claim 3)
[1902] 10. The system of claim 1, further comprising means for supporting code analysis based on directory structure.
[1903] "Application Example 1"
[1904] (Claim 1)
[1905] A means for reading other people's program code and analyzing its structure and function;
[1906] A means for automatically adding appropriate comments to program code based on the analysis results;
[1907] a means for providing the analyzed code to the user;
[1908] A means to analyze the robot's program code and automatically add comments,
[1909] A system including:
[1910] (Claim 2)
[1911] 2. The system according to claim 1, further comprising means for enabling a user to adjust the granularity of the comments in the analysis results.
[1912] (Claim 3)
[1913] 10. The system of claim 1, further comprising means for supporting code analysis based on directory structure.
[1914] "Example 2: Combining Emotion Engines"
[1915] (Claim 1)
[1916] A means for reading other people's program code and analyzing its structure and function;
[1917] A means for automatically adding appropriate comments to program code based on the analysis results;
[1918] a means for providing the analyzed code to the user;
[1919] A means to recognize user emotions and adjust the content and timing of comments;
[1920] A system including:
[1921] (Claim 2)
[1922] 2. The system according to claim 1, further comprising means for enabling a user to adjust the granularity of the comments in the analysis results.
[1923] (Claim 3)
[1924] 10. The system of claim 1, further comprising means for supporting code analysis based on directory structure.
[1925] "Application example 2 when combining emotion engines"
[1926] (Claim 1)
[1927] A means for reading other people's program code and analyzing its structure and function;
[1928] A means for automatically adding appropriate comments to program code based on the analysis results;
[1929] a means for providing the analyzed code to the user;
[1930] A means to recognize user emotions in real time and adjust the analysis results and comment content,
[1931] means for displaying feedback based on the analyzed code and the emotion on the user's device;
[1932] A system including:
[1933] (Claim 2)
[1934] 2. The system according to claim 1, further comprising means for enabling a user to adjust the granularity of the comments in the analysis results.
[1935] (Claim 3)
[1936] 10. The system of claim 1, further comprising means for supporting code analysis based on directory structure. [Explanation of symbols]
[1937] 10, 210, 310, 410 Data Processing Systems 12 Data Processing Device 14 Smart Devices 214 Smart Glasses 314 Headset-type terminal 414 Robot< / url:> < / url:> < / url:> < / url:>
Claims
1. A means for reading other people's program code and analyzing its structure and function; A means for automatically adding appropriate comments to program code based on the analysis results; a means for providing the analyzed code to the user; A system including:
2. The system according to claim 1 , further comprising means for enabling a user to adjust the granularity of the comments in the analysis results.
3. 10. The system of claim 1, further comprising means for supporting code analysis based on directory structure.
4. The system of claim 1 further comprising means for providing the analysis results to a user in real time.
Citation Information
Patent Citations
Persona chatbot control method and system
JP2022180282A