Information processing device, information processing method, and program

The information processing device uses a generation AI to analyze source code through a call graph, sequentially processing methods to generate comprehensive explanatory text, addressing token limits and incomplete explanations in conventional AI-based code documentation.

JP2026043417APending Publication Date: 2026-03-12NS SOLUTIONS CORPORATION
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2026-03-12

AI Technical Summary

Technical Problem

Conventional methods using generation AI to generate explanatory text from source code face challenges in creating sufficient explanations without considering called methods and often exceed the token limit, leading to incomplete or inaccurate comments.

Method used

An information processing device that utilizes a generation AI to generate explanatory text by analyzing source code through a call graph, processing methods sequentially from the end to the root, adding comments to called methods, and generating explanations in a controlled order to manage token limits.

Benefits of technology

Enables the generation of comprehensive and accurate explanatory text for source code by considering called methods, ensuring sufficient explanations within token limits, thereby improving understanding of complex code structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026043417000001_ABST
    Figure 2026043417000001_ABST
Patent Text Reader

Abstract

By using generation AI, it is possible to generate the description of the method defined in the target source code in a more suitable manner. [Solution] An information processing device having a comment adding means for adding a description of a second method called from a first method as a comment to the source code of the first method; a generation means for inputting the source code of the first method with the description of the second method added as a comment to the generation AI, thereby causing the generation AI to generate a description of the first method; and a control means for controlling the order in which each of the series of methods is processed, so that the comment adding means and generation means cause the generation AI to generate a description of the first method by treating each of the series of methods as the first method in sequence from the end side to the root side of a call graph showing the call relationship between each of the series of methods.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present disclosure relates to an information processing device, an information processing method, and a program. [Background technology]

[0002] The source code of a developed system may contain various comments, such as explanations of the source code's processing, intentions that are difficult to understand directly from the source code, and notes of caution. However, in systems that have been built, operated, maintained, replaced, etc. in the past, insufficient comments may make it difficult for workers to understand the intentions expressed by the source code. Furthermore, even in situations where documentation related to the source code remains, the documentation may not be organized, making it difficult to extract information about the source code. Against this background, technology for generating explanatory text for source code based on the source code is being considered. Patent Document 1 discloses an example of a technology for generating explanatory text for source code (e.g., explanatory text to be added as a comment) based on the source code. Furthermore, in recent years, advances in AI technology have made it possible to generate a variety of content using AI (learning models) that have been trained through so-called machine learning. Against this background, research is also being conducted into technologies that use AI to generate explanatory text to be added as comments from source code. Non-Patent Document 1 discloses an example of a technology that uses AI to generate explanatory text from source code that indicates the content of processing defined in the source code (e.g., the processing content of a method). In particular, so-called generative AI technologies, such as ChatGPT (registered trademark), have been attracting attention in recent years, which generate content in response to various instructions input as prompts. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] Japanese Patent Application Laid-Open No. 2001-5650 [Non-patent literature]

[0004] [Non-Patent Document 1] Akiyoshi Takahashi and two others, "Automatic Generation of Program Comments Matched to Questions," JSiSE Research Report vol.33, no.7, Japan Society for Information and Systems in Education, March 2019, pp.51-55 Summary of the Invention [Problem to be solved by the invention]

[0005] On the other hand, when using a generation AI to generate explanatory text from source code that shows the content of the processing specified in the source code, conventional methods have difficulty creating a sufficient explanation from only the source code of the target method, and it may be difficult to generate a sufficient explanation without also taking into account the content of methods called from that method. Furthermore, even if the generation AI is made to generate comments that include the source code of the called method, the number of tokens will increase, exceeding the limit on the number of tokens that the generation AI can accept, which may make it difficult for the generation AI to generate comments.

[0006] In view of the above problems, the present invention aims to use generation AI to enable the generation of method descriptions defined in target source code in a more suitable manner. [Means for solving the problem]

[0007] The information processing device of the present invention comprises a comment adding means for adding, as a comment, an explanatory text of a second method called from a first method among a series of methods defined in a series of source codes to be analyzed; a generation means for inputting the source code of the first method to which the explanatory text of the second method has been added as a comment into a generation AI that analyzes the meaning of the methods defined in the input source code and generates an explanatory text of the method, thereby causing the generation AI to generate an explanatory text of the first method; and a control means for controlling the order in which each of the series of methods is processed by the comment adding means and the generation means, so that the comment adding means and the generation means cause the generation AI to generate an explanatory text of the first method by sequentially treating each of the series of methods as the first method from the end side to the root side of a call graph showing the call relationship between each of the series of methods. [Effects of the Invention]

[0008] According to the present invention, it is possible to use a generation AI to generate comments for a method defined in a target source code in a more suitable manner. [Brief explanation of the drawings]

[0009] [Figure 1] FIG. 10 is a diagram showing an example of a method for generating method descriptions using a generation AI. [Figure 2] FIG. 10 shows an example of the results of a method description generated by a generation AI. [Figure 3] FIG. 10 is a diagram illustrating an example of a call graph. [Figure 4] FIG. 10 is a diagram illustrating an example of a prompt related to the generation of an explanatory sentence. [Figure 5] FIG. 1 illustrates an example of a hardware configuration of an information processing device. [Figure 6] FIG. 2 is a functional block diagram illustrating an example of a functional configuration of an information processing device. [Figure 7]10 is a flowchart illustrating an example of processing by an information processing device. [Figure 8] 10A and 10B are diagrams illustrating an example of a prompt and a generated result related to generation of an explanatory sentence. [Figure 9] 10A and 10B are diagrams illustrating an example of a prompt and a generated result related to generation of an explanatory sentence. [Figure 10] 10A and 10B are diagrams illustrating an example of a prompt and a generated result related to generation of an explanatory sentence. [Figure 11] 10A and 10B are diagrams illustrating an example of a prompt and a generated result related to generation of an explanatory sentence. [Figure 12] 10A and 10B are diagrams illustrating an example of a prompt and a generated result related to generation of an explanatory sentence. [Figure 13] FIG. 10 is a diagram illustrating an example of a prompt related to the generation of an explanatory sentence. [Figure 14] FIG. 10 is a diagram showing an example of source code and an explanatory text. [Figure 15] 10A and 10B are diagrams illustrating an example of a prompt related to the integration of explanatory texts and an integration result. [Figure 16] FIG. 10 is a diagram illustrating an example of a relationship between source code and a call graph. [Figure 17] FIG. 10 is a diagram showing an example of source code specified in a prompt. [Figure 18] FIG. 10 is a diagram illustrating an example of a call graph in which a recursive call is included. [Figure 19] FIG. 10 is a diagram showing an example of a flow of processing related to brushing up an explanation. [Figure 20] FIG. 10 is a diagram illustrating an example of source code of a method for which an explanation is to be generated. [Figure 21] FIG. 10 is a diagram illustrating an example of source code of a series of methods to be analyzed. DETAILED DESCRIPTION OF THE INVENTION

[0010] Preferred embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. In this specification and drawings, components having substantially the same functional configurations are designated by the same reference numerals, and redundant description will be omitted.

[0011] <Summary> An overview of features of an information processing device according to an embodiment of the present disclosure will be described with reference to FIGS. The information processing device according to this embodiment generates explanatory text for a method defined in target source code by using a model known as generative AI, among learning models such as neural networks that have been trained based on deep learning or machine learning. Generative AI is an AI (model) that learns data patterns, relationships, etc., and generates new content such as text and images. Therefore, to make the features of the information processing device according to this embodiment easier to understand, an example of a method for generating explanatory text that takes into account the meaning of a method defined in target source code (e.g., the processing content defined as a method) using generative AI will be described with reference to FIG. 1.

[0012] 1, a target source code C100 is designated as an analysis target, and a prompt D200 instructing to generate a comment for the source code C100 is input to the generation AI 500. The generation AI 500 analyzes the meaning (e.g., processing content) of the source code C100 designated in the prompt D200 in accordance with the instructions in the prompt D200, and generates and outputs an explanatory text D300 for the source code C100 based on the analysis result. Note that the generated explanatory text D300 may be added (feedback) as a comment to the source code C100 to be analyzed, for example. A generator built based on existing technology may be applied to the generator AI 500. As described above, an example of a generator AI that receives a prompt indicating instruction content as input and generates and outputs text according to the instruction content is ChatGPT. Furthermore, Non-Patent Document 1 discloses an example of a technique for automatically generating comments for target source code using AI (model) that has been trained based on machine learning.

[0013] On the other hand, as shown in Figure 1, even if the generation AI is simply input with a prompt specifying the source code to be analyzed, as in the conventional method, sufficient explanation may not be obtained. For example, Figure 2 shows an example of the results of a description generated by a generative AI for a method defined in source code. In the example shown in Figure 2, the source code for which a description is to be generated defines a process for sequentially calling the methods of three objects a, b, and c received as input. In such a situation, even if the target source code is analyzed, it will only be possible to identify that a method of each object is being called, and so, as shown in Figure 2, a description may be generated that only indicates that each individual method is being called. One solution to this problem is to have the generation AI generate explanatory text for not only the target source code but also the source code of the called methods. However, generation AIs generally have a limit on the number of tokens, and the larger the target system, the more difficult it can be to input a series of related source codes into the generation AI. Furthermore, some programming languages ​​have specifications such as inheritance and override that allow code to be reinterpreted depending on conditions. Under these circumstances, the generation AI cannot necessarily accurately recognize the call relationships between source codes based on the specifications of the target programming language and analyze a series of source codes. In view of the above circumstances, this disclosure describes an example of a technology that uses so-called generation AI to enable generation of a description of a target source code in a more suitable manner. For convenience, in this embodiment, the applied generating AI (model) is constructed by learning based on so-called machine learning, but as long as it is possible to construct the generating AI, the method is not limited to machine learning and is not particularly limited.

[0014] 3 and 4 provide an overview of the basic technical concept of the function of the information processing device according to this embodiment, which is related to the generation of a description of a method defined in source code to be analyzed using a generation AI. The information processing device of this embodiment generates a description of each of a series of methods defined in a series of source code to be analyzed based on information (e.g., a call graph) showing the analysis results of the call relationships of each of the series of methods. For example, Fig. 3 is a diagram showing an example of a call graph showing the call relationships of each of a series of methods for which explanations are to be generated. In the example shown in Fig. 3, nodes N110 to N160 corresponding to six methods are connected according to the call relationships of the six methods to form call graph N100. Note that since known techniques can be applied to the analysis of the call relationships of each of the series of methods defined in the series of source code to be analyzed and the generation of a call graph based on the analysis results, detailed explanations will be omitted. Furthermore, in this disclosure, for convenience, of the connection relationships of the nodes corresponding to the methods shown as a call graph, the caller side is also referred to as the root side, and the callee side is also referred to as the end side. As a specific example, when attention is focused on the relationship between node N130 associated with method "B.process()" and node N140 associated with method "E.process()", node N130 is located on the root side, and node N140 is located on the end side.

[0015] The information processing device 100 according to this embodiment processes a series of target methods (methods associated with nodes N110 to N160) in the call graph N100, sequentially from the end to the root, and causes the generation AI to generate descriptions of the methods. This processing order can be determined, for example, by performing a topological sort on the call graph N100 to assign an order to the series of nodes in the call graph N100 and then reversing that order. In the example shown in FIG. 3, the methods associated with each node are processed in the order of nodes N140, N130, N150, N160, N120, and N110, and the generation AI generates descriptions of the methods.

[0016] Fig. 4 shows an example of a prompt when the generation AI is made to generate a description of a method. The example shown in Fig. 4 shows an example of a case where the generation AI 500 is made to generate a description of the method "Processor.process()" associated with the node N120 in the example shown in Fig. 3. 4 shows an example of source code for a method corresponding to node N120, which is specified as an analysis target in prompt D210, which is input to generated AI 500. Source code C110 defines code C1101, C1102, and C1103 that call methods corresponding to nodes N130, N150, and N160 shown in FIG. When a description of another method called by the target method has already been generated, the information processing device 100 adds the description as a comment associated with the other method. For example, in the example shown in Fig. 3, when the method corresponding to node N120 becomes the processing target, description sentences for the methods corresponding to nodes N130, N150, and N160 have already been generated. Therefore, in the example shown in Fig. 4, the information processing device 100 adds method descriptions C1104, C1105, and C1106 as comments to source code C110, associated with code C1101, C1102, and C1103 of the methods corresponding to nodes N130, N150, and N160, respectively. 4, a method for which an explanation is to be generated, such as the method indicated by code C110, is an example of a "first method." Also, other methods called from the method for which an explanation is to be generated, such as the methods indicated by codes C1101, C1102, and C1103, are examples of a "second method."

[0017] Then, the information processing device 100 adds the source code C110 of the target method as the code to be processed to a prompt D210 that instructs the generation AI 500 to generate an explanatory text. In the example shown in Fig. 4, the source code of the method to be analyzed is specified in an area indicated by the "#Code" tag in the prompt D210. Furthermore, the prompt D210 specifies a rule for outputting an explanatory text in an area indicated by the "#Rule" tag, and specifies an output format of the explanatory text in an area indicated by the "#Output format" tag. In this way, the information processing device 100 generates the prompt D210 and inputs the prompt D210 to the generation AI 500, causing the generation AI 500 to generate an explanatory text D310 for the method shown as the source code C110. Furthermore, the information processing device 100 may add (feed back) the explanatory text D310 generated by the generation AI 500 as a comment to the target source code (the source code from which the source code C110 is generated), as in the example described with reference to FIG.

[0018] The features of the information processing device according to an embodiment of the present disclosure have been outlined above with reference to Figures 1 to 4. In the following, the configuration and processing of the information processing device according to this embodiment will be described in more detail.

[0019] <Hardware configuration> An example of a hardware configuration of an information processing device 900 applicable as the information processing device 100 according to this embodiment will be described with reference to Fig. 5. As shown in Fig. 5, the information processing device 900 includes a central processing unit (CPU) 910, a read-only memory (ROM) 920, and a random access memory (RAM) 930. The information processing device 900 also includes an auxiliary storage device 940 and a network I / F 970. The information processing device 900 may also include at least one of an output device 950 and an input device 960. The CPU 910, the ROM 920, the RAM 930, the auxiliary storage device 940, the output device 950, the input device 960, and the network I / F 970 are connected to one another via a bus 980.

[0020] The CPU 910 is a central processing unit that controls various operations of the information processing device 900. For example, the CPU 910 may control the operation of the entire information processing device 900. The ROM 920 stores control programs, boot programs, and the like that can be executed by the CPU 910. The RAM 930 is the main storage memory of the CPU 910, and is used as a work area or a temporary storage area for expanding various programs.

[0021] The auxiliary storage device 940 stores various data and programs. The auxiliary storage device 940 is realized by a storage device capable of temporarily or permanently storing various data, such as a hard disk drive (HDD) or a nonvolatile memory such as a solid state drive (SSD).

[0022] The output device 950 is a device that outputs various types of information and is used to present various types of information to a user. For example, the output device 950 is realized by a display device such as a display. In this case, the output device 950 presents information to a user by displaying various types of display information. As another example, the output device 950 may be realized by an audio output device that outputs sounds such as voices and electronic sounds. In this case, the output device 950 presents information to a user by outputting sounds such as voices and electronic sounds. Furthermore, the device used as the output device 950 may be changed as appropriate depending on the medium used to present information to a user.

[0023] The input device 960 is used to receive various instructions from the user. In this embodiment, the input device 960 includes input devices such as a mouse, a keyboard, and a touch panel. As another example, the input device 960 may include a sound collection device such as a microphone, and collect voices uttered by the user. In this case, various analysis processes such as acoustic analysis and natural language processing are performed on the collected voices, and the contents of the voices are recognized as instructions from the user. Furthermore, the device applied as the input device 960 may be changed as appropriate depending on the method for recognizing instructions from the user. Furthermore, multiple types of devices may be applied as the input device 960.

[0024] The network I / F 970 is used for communication with external devices via a network. The device used as the network I / F 970 may be changed as appropriate depending on the type of communication path and the communication method used.

[0025] The CPU 910 expands a program stored in the ROM 920 or the auxiliary storage device 940 into the RAM 930 and executes this program, thereby realizing the functional configuration of the information processing device shown in Figure 6 and the processing of the information processing device described below with reference to Figure 7.

[0026] An example of the hardware configuration of the information processing device 900 applicable as the information processing device 100 according to this embodiment has been described above with reference to FIG.

[0027] <Functional configuration> Referring to FIG. 6, an example of the functional configuration of the information processing device 100 according to this embodiment will be described, focusing particularly on the part related to the generation of explanatory text for each of a series of methods defined in a series of source codes to be analyzed. As shown in FIG. 6, the information processing device 100 includes a call relationship analysis unit 101, a control unit 110, a code extraction unit 102, a comment addition processing unit 103, a prompt generation unit 104, an explanatory text generation unit 105, a memory unit 106, and an explanatory text reflection unit 107.

[0028] The call relationship analysis unit 101 analyzes the call relationships of each of a series of methods defined in a series of source code C100 to be analyzed, and generates a call graph based on the results of the analysis. As mentioned above, known techniques can be applied to the analysis of the call relationships of each of a series of methods and the generation of a call graph based on the results of the analysis, so detailed explanations will be omitted. For convenience, the other components will be explained assuming that the call graph N100 shown in Figure 3 has been generated. The control unit 110 determines the processing order of each of the series of methods to be processed, based on the call graph N100 generated by the call relationship analysis unit 101. Specifically, as described above with reference to Fig. 3, the control unit 110 determines the processing order of each of the series of methods so that each of the series of methods to be processed is sequentially processed from the end to the root of the call graph N100. Then, the control unit 110 controls the operations of the code extraction unit 102, the comment addition processing unit 103, the explanation generation unit 105, etc., which will be described later, so that each method is sequentially processed in accordance with the determined processing order.

[0029] The code extraction unit 102 follows instructions from the control unit 110 to extract source code that defines a method to be processed from a series of source code C100 to be analyzed.

[0030] The comment addition processing unit 103 reads the code of a method to be processed from the source code extracted by the code extraction unit 102, and if another method is called from the method, adds an explanatory text of the other method to the code as a comment. As described above with reference to FIGS. 3 and 4, if another method is called from the target method, the other method has previously been targeted for processing, and an explanatory text of the other method has already been generated. Therefore, in this case, the code extraction unit 102 reads an explanatory text of the other method that was previously generated and stored in a predetermined storage area (e.g., the storage unit 106, described later), and adds it as a comment to the code of the target method. The control unit 110 may also identify the call relationships between the target method and the other methods based on the call graph N100 and notify the comment addition processing unit 103 of the identified relationships.

[0031] The prompt generation unit 104 generates a prompt D210 for instructing the generation AI 500, which has specified the code of the method to be processed as the analysis target, to generate an explanation of the method. At this time, if a comment has been added to the code of the method to be processed by the comment addition processing unit 103, the prompt generation unit 104 generates the prompt D210 so that the code to which the comment has been added is specified as the analysis target. The method for generating the prompt D210 has been described above with reference to FIG. 4, so a detailed description thereof will be omitted.

[0032] The explanatory text generation unit 105 inputs the prompt D210 generated by the prompt generation unit 104 to the generation AI 500, causing the generation AI 500 to generate explanatory text D310 for the target method. Then, the explanatory text generation unit 105 associates the explanatory text D310 generated by the generation AI 500 with the target method and stores it in a predetermined storage area (for example, the storage unit 106).

[0033] The storage unit 106 is a storage area for storing various data. In this embodiment, the storage unit 106 is used as a storage area for holding the explanation D310 generated by the generation AI 500 in the explanation generation unit 105.

[0034] In this way, based on the control by the control unit 110, each of the series of methods defined in the series of source code C100 to be analyzed is processed sequentially according to the call graph N100 shown in Figure 3, and the generation AI 500 generates an explanation D310 and stores it in the memory unit 106.

[0035] When the explanatory text D310 is generated for each of the series of methods defined in the series of source code C100 to be analyzed, the explanatory text reflection unit 107 reads the explanatory text D310 corresponding to each method from the storage unit 106. Then, the explanatory text reflection unit 107 reflects the explanatory text D310 read for each method as a comment in the source code in which the method is defined.

[0036] An example of the functional configuration of the information processing device 100 according to this embodiment has been described above with reference to FIG. 6, focusing particularly on the portion related to generating the description of each of a series of methods defined in a series of source code to be analyzed. Note that the configuration shown in FIG. 6 is merely an example and does not limit the functional configuration of the information processing device 100 according to this embodiment. For example, the series of components shown in FIG. 6 may be realized by multiple devices working together. As a specific example, the functions of some of the series of components shown in FIG. 6 may be realized by an external device different from the information processing device 100 or a so-called network service such as a cloud service. As another example, the processing load of at least some of the series of components shown in FIG. 6 may be distributed to multiple devices.

[0037] <Processing> Referring to FIG. 7, an example of processing by the information processing device 100 according to this embodiment will be described, focusing particularly on the part related to the generation of explanatory text for each of a series of methods defined in a series of source codes to be analyzed.

[0038] In S101, the call relationship analysis unit 101 analyzes the call relationships of each of a series of methods defined in a series of source code C100 to be analyzed, and generates a call graph based on the results of the analysis. Furthermore, the control unit 110 determines the processing order of each of the series of methods to be processed based on the call graph N100 generated by the call relationship analysis unit 101.

[0039] In S102, the code extraction unit 102 follows an instruction from the control unit 110 to extract source code that defines a method to be processed from a series of source code C100 to be analyzed. In S103, the comment addition processor 103 reads the code of the method to be processed from the source code extracted in S102. If the method in question calls another method, the comment addition processor 103 adds an explanatory text of the other method to the read code as a comment. If an explanatory text of the other method has not been generated, the comment addition processor 103 does not need to add a comment to the code to be processed. In S104, the prompt generation unit 104 generates a prompt D210 for instructing the generation AI 500 to generate a description of the method to be processed, the code of which is designated as an analysis target, based on the processing result of S103. In S105, the explanation generation unit 105 inputs the prompt D210 generated in S104 to the generation AI 500, causing the generation AI 500 to generate an explanation D310 for the target method. Then, the explanation generation unit 105 associates the explanation D310 generated by the generation AI 500 with the target method and stores it in the storage unit 106.

[0040] In S106, the control unit 110 determines whether or not the generation of the explanations for each of the series of methods defined in the series of source code to be analyzed has been completed. If the control unit 110 determines in S106 that the generation of explanations for each of the methods defined in the source code to be analyzed has not been completed, the control unit 110 proceeds to S102. In this case, the control unit 110 controls the processes from S102 onward to be executed again for the methods that have not yet been processed. Then, when the control unit 110 determines in S106 that the generation of the explanations for each of the series of methods defined in the series of source codes to be analyzed is completed, the control unit 110 ends the series of processes shown in FIG.

[0041] Above, with reference to Figure 7, an example of processing by the information processing device 100 according to this embodiment has been described, focusing particularly on the part relating to the generation of explanatory text for each of a series of methods defined in a series of source code to be analyzed.

[0042] <Example> As an example of the information processing device 100 according to this embodiment, an example of a prompt input to the generation AI 500 and an example of an explanatory text generated by the generation AI 500 in response to the input of the prompt will be described with reference to Figures 8 to 12 and 21. In this example, an example will be described in which each method shown in the call graph N100 is the processing target, based on the call graph N100 illustrated in Figure 3.

[0043] First, for reference, an example of the source code from which the call graph N100 shown in Figure 3 is generated, i.e., the source code of a series of methods to be analyzed, will be outlined with reference to Figure 21. The series of source codes shown in Figure 21 prescribes a process to read the contents of a target file, replace target character strings contained in the content, and then write the result to a file. Class E inherits class D, and in class E, the method D.process() defined in class D is overridden as E.process(). Specifically, while method D.process() is defined as a process that returns a directory list, method E.process() is defined as a process that returns the contents of a file. In addition, in class B, variable d is defined as an object of class D, and it is defined that method D.process() should be called, but due to the definition of the Main class, method E.process() will actually be called.

[0044] Next, the process for analyzing each method will be described. In the example shown in Fig. 3, the method "E.process()" shown as node N140 is applied as the first processing target. Fig. 8 shows an example of a prompt D211 generated for the method shown as node N140, and an example of an explanation D311 output from the generation AI 500 using the prompt D211 as input. Specifically, FIG. 8(a) shows an example of prompt D211. Code C111 corresponds to the code of the method specified as the analysis target (target for generating a description). Note that, as shown in FIG. 3, the method specified as node N140 does not call the method specified as the target for generating a description. Therefore, as shown by code C111, no separate comment has been added to the code of the method specified as node N140. Instruction D2111 is an instruction related to specifying the conditions for generating a description of the method specified as the analysis target. Instruction D2112 is an instruction related to specifying the output format of the description of the method specified as the analysis target. FIG. 8(b) shows an example of an explanation D311 output by the generation AI 500 using the prompt D211 as input.

[0045] The second processing target is the method "B.process()" shown as node N130 in Fig. 3. Fig. 9 shows an example of a prompt D212 generated for the method shown as node N130, and an example of an explanatory text D312 output from a generation AI 500 that receives the prompt D212 as input. Specifically, Figure 9(a) shows an example of prompt D212. Code C112 corresponds to the code of the method specified as the analysis target. As shown in Figure 3, the method shown as node N130 calls the method shown as node N140. Therefore, in prompt D212, explanatory text D311a of the method shown as node N140 is added as a comment in association with code C112. The explanatory text D311a shown in Figure 9(a) is an explanatory text that has been edited as shown below based on explanatory text D311 shown in Figure 8(b). Class E, which defines the method indicated as node N150 and is called in code C112, inherits class D, and code C112 calls the method indicated as node N150 as a method of the inherited class D. As described above, due to inheritance (extends) and implementation (implements), the type of the method actually called may differ from the type of the method defined in the code. In such cases, information indicating this may be added to the comment. For example, in the example shown in FIG. 9(a), explanatory text D311 added as a comment is edited to add explanatory text D311b indicating that the class in which the target method is defined inherits another class (class D), thereby forming explanatory text D311a. As another example, instead of the explanatory text, the content of the explanatory text of the method added as a comment may be modified to match the type of the method defined in the code. FIG. 9(b) shows an example of an explanation D312 output by the generation AI 500 using the prompt D212 as input. In addition, an inheriting class such as class E that inherits class D in the example shown in Figure 9(a) corresponds to an example of a "first class," and an inheriting class such as class D corresponds to an example of a "second class."

[0046] The third processing target is the method "A.process()" shown as node N150 in Fig. 3. Fig. 10 shows an example of a prompt D213 generated for the method shown as node N150, and an example of an explanatory text D313 output from a generation AI500 that uses the prompt D213 as input. Specifically, Figure 10(a) shows an example of prompt D213. Code C113 corresponds to the code of the method specified as the analysis target. Note that, as shown in Figure 3, the method indicated as node N150 does not call the method to be explained. Therefore, as shown by code C113, no separate comments have been added to the code of the method indicated as node N150. FIG. 10(b) shows an example of an explanation D313 output by the generation AI 500 using the prompt D213 as input.

[0047] The fourth processing target is the method "C.process()" shown as node N160 in Fig. 3. Fig. 11 shows an example of a prompt D214 generated for the method shown as node N160, and an example of an explanatory text D314 output from a generation AI 500 that receives the prompt D214 as input. Specifically, Figure 11(a) shows an example of prompt D214. Code C114 corresponds to the code of the method specified as the analysis target. Note that, as shown in Figure 3, no other methods are called from the method shown as node N160. Therefore, as shown as code C114, no separate comments have been added to the code of the method shown as node N160. FIG. 11(b) shows an example of an explanation D314 output by the generation AI 500 using the prompt D214 as input.

[0048] The fifth processing target is the method "Processor.process()" shown as node N120 in Fig. 3. Fig. 12 shows an example of a prompt D215 generated for the method shown as node N120, and an example of an explanatory text D315 output from a generation AI 500 that receives the prompt D215 as input. Specifically, FIG. 12(a) shows an example of prompt D215. Codes C1151, C1152, and C1153 correspond to the code of the method specified as the analysis target. As shown in FIG. 3, the method indicated as node N120 sequentially calls each of the methods indicated as nodes N130, N150, and N150, and codes C1151, C1152, and C1153 correspond to the code related to the invocation of each method. Therefore, in prompt D215, explanatory text D312, D313, and D314 of the methods indicated as nodes N130, N150, and N150 are added as comments in association with codes C1151, C1152, and C1153. The explanatory sentences D312, D313, and D314 shown in FIG. 12(a) correspond to the explanatory sentence D312 shown in FIG. 9(b), the explanatory sentence D313 shown in FIG. 10(b), and the explanatory sentence D314 shown in FIG. 11(b). FIG. 10(b) shows an example of an explanation D315 output by the generation AI 500 using the prompt D215 as input.

[0049] As an example of the information processing device 100 according to this embodiment, an example of a prompt input to the generation AI 500 and an example of an explanatory text generated by the generation AI 500 in response to the input of the prompt has been described above with reference to FIGS. 8 to 12.

[0050] <Modification> A modified example of the information processing device 100 according to this embodiment will be described below.

[0051] (Variation 1: When multiple methods are called in one line of code) As Variation 1, we will explain an example of a method for adding explanatory comments to the code specified in the prompt when multiple methods are called in one line of code. For example, Fig. 13 is a diagram showing an example of a prompt when multiple methods are called in one line of code, and shows an excerpt of the specified part of the code to be analyzed. Specifically, in prompt D221, the methods "m()," "n()," "s()," and "t()" are called in sequence in one line of code. In such a case, as shown in Fig. 13, the descriptions generated for the multiple methods that are being called can be added in the order in which the multiple methods are called.

[0052] (Variation 2: When multiple methods are called by calling one method) As a second modification, an example of a method for adding explanatory text as a comment to the code specified in the prompt when multiple methods are called by calling one method will be described. For example, FIG. 14 shows an example of an explanatory text generated for the source code to be analyzed and other methods that are called from the method defined in the source code. Specifically, in source code C131 shown in Figure 14(a), when a method "foo" to be analyzed, shown as code C1311, is called, a method "foo" in class A1, shown as code C1312, and a method "foo" in class A2, shown as code C1313, are called. Explanatory text D231 shown in Figure 14(b) is an example of an explanatory text generated for the method "foo" in class A1, shown as code C1312. Furthermore, explanatory text D232 shown in Figure 14(c) is an example of an explanatory text generated for the method "foo" in class A2, shown as code C1313. As shown in the example of Figure 14(a), when a call to one method actually results in the call of multiple methods, it is advisable to add a single explanatory statement that integrates the explanatory statements of the multiple methods that are actually called to the call of that single method as a comment. Furthermore, a generation AI may be used to integrate the multiple explanatory statements.

[0053] For example, Figure 15 shows an example of a prompt D233 that is input to a generation AI and an explanation D234 that is output from the generation AI when the generation AI is configured to integrate (e.g., merge) the explanations of multiple methods to output a single explanation. Specifically, FIG. 15(a) shows an example of a prompt D233. In the prompt D233, a plurality of explanatory sentences to be integrated are specified in an area indicated by the "#Input" tag. For example, in the example shown in FIG. 15(a), explanatory sentence D231 of the method "foo" of class A1 shown in FIG. 14(b) and explanatory sentence D232 of the method "foo" of class A2 shown in FIG. 14(c) are specified as the objects to be integrated. In addition, in the prompt D233, an output format of the explanatory sentences is specified in an area indicated by the "#Output format" tag. Instruction D2331 is an instruction related to specifying the output format of the explanatory sentences after integration. FIG. 15(b) shows an example of an integrated explanation D234 output by the generation AI using the prompt D233 as input. Note that the generation AI used to integrate multiple explanatory sentences is not particularly limited. Therefore, the prompt D233 shown in Figure 15(a) is merely an example, and the format of the input prompt can be changed as appropriate depending on the generation AI to be applied.

[0054] 14(a), it may be difficult to distinguish from a call graph whether a call to one method results in the calling of multiple methods or whether multiple methods are called individually. In such cases, it is advisable to determine which case applies based on, for example, information indicating the call relationships between the methods from which the call graph was generated (in other words, information according to the analysis results of the call relationships between the methods).

[0055] For example, Figure 16 shows an example of the difference between a case where multiple methods are called by calling one method and a case where multiple methods are called individually. Note that although not shown in the source code shown in Figures 16(a) and 16(d), it is assumed that classes A1 and A2 shown as code C1312 and C1313 in Figure 14(a) are defined in each case.

[0056] Specifically, source code 1 shown in FIG. 16(a) shows an example of a case where multiple methods are called by calling one method. In source code 1, a call to method "foo" in method "bar" results in a call to method "foo" in class A1 and method "foo" in class A2. FIG. 16(b) shows an example of a call graph generated for source code 1 shown in FIG. 16(a). FIG. 16(c) shows information indicating the call relationships between a series of methods defined in source code 1 shown in FIG. 16(a), which is the source of the call graph shown in FIG. 16(b). In contrast, source code 2 shown in Figure 16(d) shows an example of a case where multiple methods are called individually. In source code 1, method "bar" calls method "foo" of class A1 and method "foo" of class A2 individually. Figure 16(e) shows an example of a call graph generated for source code 2 shown in Figure 16(d). Figure 16(f) is information showing the call relationships between a series of methods defined in source code 2 shown in Figure 16(d), which is the source from which the call graph shown in Figure 16(e) was generated.

[0057] As can be seen by comparing Figures 16(b) and 16(e), source code 1 shown in Figure 16(a) and source code 2 shown in Figure 16(d) may generate similar call graphs. In such cases, it may be difficult to mechanically identify which source code corresponds from the call graph. On the other hand, as can be seen by comparing Figures 16(c) and 16(f), source code 1 and source code 2 have different information indicating the call relationships between the series of methods that generated the call graph. Therefore, when multiple methods are called from one method in the call graph, it is possible to mechanically determine whether the case corresponds to source code 1 or source code 2 by analyzing the information indicating the call relationships between the methods that generated the call graph.

[0058] (Variation 3: When the parent class constructor is not explicitly called) As a third modification, an example of code to be specified in the prompt when the call to the constructor of the parent class is not explicitly stated will be described. For example, Fig. 17(a) is a diagram showing an example of source code in which the call to the constructor of the parent class is not explicitly stated. 17(a), a class A is defined, and a class B that inherits the class A is defined, and no processing is written in the constructor of the class B, but the constructor of the class A is actually called. In this way, when there is processing that is implicitly called, the source code in question may be edited to explicitly indicate that processing. For example, Figure 17(b) shows an example of code relating to the definition of class B, in which code for a process that is implicitly called has been added by editing so that the code is explicitly specified. In the example shown in Figure 17(a), the source code specified in the prompt can be edited so that code that calls the constructor of the parent class (i.e., class A) is added to the constructor of class B, as shown in Figure 17(b). By making such edits, it becomes possible for the generation AI 500 to generate a description that takes into account the code that was implicit in the original source code.

[0059] (Variation 4: Processing order when recursive calls are made) As a fourth modification, an example of a method for determining the processing order of each of a series of methods for which an explanation is to be generated when a part of the series of methods includes a part in which a recursive call is made will be described. For example, Figure 18 shows an example of a call graph showing the call relationships of a series of methods, some of which include recursive calls. In the example shown in Figure 18, a loop occurs in the call relationships between methods "b," "c," and "d" due to recursive calls. In such a case, a call graph is first generated in which a series of nodes in the part of the target call graph where recursive calls are made (in other words, a series of nodes corresponding to strongly connected components in the call graph) are grouped together as a single node, and the series of nodes in the call graph are then ordered for processing.

[0060] As a specific example, in the example shown in FIG. 18, a call graph is generated in which the nodes of methods "b," "c," and "d" are grouped together as a single node. In the example shown in FIG. 18, methods "b," "c," and "d" are considered as a single method "B," and the nodes of methods "b," "c," and "d" are grouped together as a node of method "B." Then, the order in which the nodes in the call graph are to be processed is determined using a method similar to that described with reference to FIG. 3 (for example, a method using topological sorting). In the example shown in FIG. 18, the methods are ordered to be processed in the order of "f," "e," "B (recursive call portion)," and "a." Then, the series of methods grouped into one node as a strongly connected component, i.e., the recursively called methods "b," "c," and "d" grouped into method "B," are expanded. In this case, the part grouped into a strongly connected component is expanded so that each of the series of methods "b," "c," and "d" that form a loop through recursive calls is called at least twice. That is, in the example shown in FIG. 18, the methods to be processed are ordered in the following order: "f," "e," "b," "c," "d," "b," "c," "d," and "a."

[0061] In this way, by controlling the recursive call so that each of the series of methods forming a loop is processed at least twice, some of the method descriptions related to the recursive call may not have been generated at the time of the first call, but they will have been generated at the time of the second call. This makes it possible for the generation AI 500 to generate descriptions that take into account calls between methods due to recursive calls.

[0062] (Variation 5: Handling of existing comments) As a fifth modification, an example of how to handle existing comments when the source code of a method for which an explanation is to be generated contains the existing comments will be described. If the source code of the method for which you want to generate a description contains existing comments, you can take one of the following measures to handle the existing comments: (Solution 1) Have the generation AI generate explanatory text for the code from which existing comments have been deleted. (Solution 2) Have the generation AI generate explanatory text for code that already contains comments. (Solution 3) Have the AI ​​generate an explanation for the code from which the existing comments have been deleted, and then edit (brush up) that explanation based on the existing comments.

[0063] When applying Countermeasure 3, if the explanatory text generated by the generation AI is to be brushed up using existing comments, the brushing up may be performed by the generation AI. Therefore, with reference to Figure 19, an example of a rough processing flow when Countermeasure 3 is applied will be described, focusing on the case where the generation AI is applied to brush up the explanatory text. 19 shows source code C161 including existing comments. By deleting the existing comments from this source code C161, source code C162 that does not include the existing comments is generated. Then, by inputting a prompt D261 that specifies the source code C162 as an analysis target to a generation AI (for example, the generation AI 500 described above), the generation AI generates a description D262 of the method defined in the source code C162. Next, a prompt D263 instructing the generation AI to edit (brush up) the explanatory text D262 using existing comments included in the source code C161 is input to the generation AI, whereby an explanatory text D264 edited by the generation AI is generated. Note that the type of the generation AI applied in this case is not particularly limited. Also, the format of the prompt D263 may be changed as appropriate depending on the generation AI applied. Furthermore, when editing (brushing up) the description, the input to the generation AI is not limited to textual information such as existing comments, but may also include other types of data other than textual information, such as documents and images related to the target source code. In other words, as long as the generation AI that edits the description can accept the type of data as input, various types of data, not just textual information, can be used as input to the generation AI to edit (brush up) the description.

[0064] The above describes an example of how to handle existing comments when the source code of a method for which an explanation is to be generated contains the existing comments.

[0065] <Supplementary information> Supplementary explanations regarding the application of the technology disclosed herein are summarized below. As described above, the information processing device 100 according to one embodiment of the present disclosure uses the descriptions of other methods that are called from some methods when generating descriptions of those methods, but does not apply this to the descriptions of the methods that are the callers. As a specific example, let's say that a call graph is generated so that the methods "As()," "Bt()," and "Cu()" are called in that order, and the description of the method "Bt()" is generated. In this case, the description of the method "Cu()" is used when generating the description of the method "Bt()," but the description and code of the calling method "As()" are not used. Applying this type of control makes it possible to prevent the generated description from becoming too complex or too voluminous.

[0066] On the other hand, since pointer analysis is performed when generating the call graph, it is possible to reflect the influence of the caller based on the call graph. Here, an overview of the process for generating an explanation that takes into account the influence of the caller will be explained with reference to Figure 20. Figure 20 shows an example of source code for a method for which an explanation is to be generated. In the example shown in Figure 20, an object of class C is passed to method "Bt()" in method "As()." In contrast, the definition of method "Bt()" specifies that method "Du()" of class D, which class C inherits, is to be called as input. In this case, essentially, method "Cu()" of class C is called when method "Bt()" is called in method "As()." Even in such a situation, by using the call graph, it is possible to mechanically identify that the method "Cu()" of class C is being called, rather than the method "Du()" of class D.

[0067] It is also possible that existing libraries (e.g., standard libraries) will be used to implement various functions. In such a situation, it may be desirable to generate descriptions by analyzing only newly created methods or independently created methods, without analyzing methods defined in existing libraries. In such a case, for example, when generating a call graph used to determine the order of processes to be processed for description generation, it is possible to exclude methods defined in existing libraries from the targets of generation and specify newly created methods or independently created methods as targets of generation. Note that the methods to be generated as targets for call graph generation can be controlled by filtering using package names, for example. In addition, the methods to be excluded from the call graph generation target can be changed as appropriate depending on the use case. For example, not only the standard libraries mentioned above, but also major libraries and frameworks may reflect information by being used as training data when building generative AI. Even if such methods are not included in the analysis target, their impact on the accuracy of the output results (description of the generated code) tends to be small, so they may be excluded from the call graph generation target.

[0068] <Conclusion> As described above, the information processing device according to this embodiment adds, as a comment, a description of a second method called from a first method among a series of methods defined in a series of source code to be analyzed. The information processing device also inputs the source code of the first method, to which the description of the second method has been added as a comment, into a model trained based on machine learning to analyze the meaning of the input source code and generate a description of the source code, thereby causing the model to generate a description of the first method. The information processing device then controls the order in which each of the series of methods is processed, so that the comment addition and description generation process proceeds from the end to the root of a call graph showing the call relationships between each of the series of methods, sequentially treating each of the series of methods as the first method and causing the model to generate a description of the first method.

[0069] With the above configuration, it is possible to have the model (generative AI) generate a description of each method by taking into account the call relationships of each method defined in a series of source code to be analyzed. Furthermore, this is expected to have the effect of suppressing an increase in the number of tokens when the model generates the target methods. In other words, the information processing device according to this embodiment makes it possible to generate a description of the target source code in a more suitable manner by using a model trained based on machine learning. In the above-described embodiment, an example of the application of a generation AI (model) that has been trained mainly based on machine learning is described, but as long as it is possible to realize similar functions, there are no particular limitations on the method of constructing the components corresponding to the generation AI.

[0070] The following configurations also fall within the technical scope of the present disclosure. (1) An information processing device having: a comment adding means for adding, as a comment, a description of a second method called from a first method among a series of methods defined in a series of source codes to be analyzed; a generation means for inputting the source code of the first method to which the description of the second method has been added as a comment to a generation AI that analyzes the meaning of the methods defined in the input source code and generates a description of the method, thereby causing the generation AI to generate a description of the first method; and a control means for controlling the order in which the comment adding means and the generation means process each of the series of methods, so that the comment adding means and the generation means cause the generation AI to generate a description of the first method by sequentially treating each of the series of methods as the first method from the end side to the root side of a call graph showing the call relationship between each of the series of methods. (2) The information processing device described in (1), wherein, when there are multiple methods as the second method called from the first method, the comment adding means adds explanatory text for each of the multiple methods as a comment to the source code of the first method. (3) The information processing device described in (1), wherein, when multiple methods are called by calling the second method, the comment adding means combines the descriptions of each of the multiple methods into a single description and adds the single description as a comment to the source code of the first method. (4) The information processing device described in (3), wherein the comment adding means identifies that the multiple methods are called by calling the second method based on the call graph or information indicating the call relationship between each of the series of methods from which the call graph was generated. (5) An information processing device according to any one of (1) to (4), wherein the comment adding means adds information indicating that the method to be called as the second method is a method defined in a second class inherited by a first class in which the second method is defined, or in an interface implemented in the first class, to a description of the second method to be added as a comment to the source code of the first method. (6) The information processing device described in (5), wherein the comment adding means identifies that the method called as the second method is a method defined in the second class or the interface based on the call graph or information indicating the call relationship between each of the series of methods from which the call graph is generated. (7) In the case where the series of methods includes a recursive call, the control means determines the order in which the comment adding means and the generation means will process the methods corresponding to each of the series of nodes in the call graph based on a call graph in which multiple methods that are the target of the recursive call are grouped into one node, and then expands the one node so that each of the multiple methods that are the target of the recursive call is called at least twice, thereby determining the order in which the series of methods will be processed by the comment adding means and the generation means. (8) An information processing device described in any one of (1) to (7), wherein, if the source code of the first method contains an existing comment, the comment adding means deletes the existing comment from the source code and adds an explanatory text of the second method as a comment, and the generation means inputs the source code of the first method from which the existing comment has been deleted and from which the explanatory text of the second method has been added as a comment into the generation AI, thereby causing the generation AI to generate an explanatory text of the first method. (9) The information processing device according to (8), wherein the generation means edits the description of the first method generated by the generation AI based on the existing comments. (10) An information processing device described in any one of (1) to (7), wherein the comment adding means, if the source code of the first method contains an existing comment, adds an explanatory text of the second method as a comment to the source code while including the existing comment, and the generation means inputs the source code of the first method, which includes the existing comment and to which the explanatory text of the second method has been added as a comment, into the generation AI, thereby causing the generation AI to generate an explanatory text of the first method. (11) An information processing method executed by an information processing device, comprising: a comment adding step of adding, as a comment, a description of a second method called from a first method among a series of methods defined in a series of source codes to be analyzed; a generation step of inputting the source code of the first method to which the description of the second method has been added as a comment to a generation AI that analyzes the meaning of the method defined in the input source code and generates a description of the method, thereby causing the generation AI to generate a description of the first method; and a control step of controlling the order in which each of the series of methods is processed in the comment adding step and the generation step, so that the comment adding step and the generation step cause the generation AI to generate a description of the first method by sequentially treating each of the series of methods as the first method from the end side to the root side of a call graph showing the call relationship between each of the series of methods. (12) A program that causes a computer to execute the following steps: a comment adding step of adding, as a comment, a description of a second method called from a first method among a series of methods defined in a series of source codes to be analyzed; a generation step of inputting the source code of the first method to which the description of the second method has been added as a comment to a generation AI that analyzes the meaning of the methods defined in the input source code and generates a description of the method, thereby causing the generation AI to generate a description of the first method; and a control step of controlling the order in which each of the series of methods is processed in the comment adding step and the generation step, so that the comment adding step and the generation step cause the generation AI to generate a description of the first method by sequentially treating each of the series of methods as the first method from the end side to the root side of a call graph showing the call relationship between each of the series of methods. [Explanation of symbols]

[0071] 100 Information processing device 101 Call Relationship Analysis Unit 102 Code Extraction Unit 103 Comment addition processing section 104 Prompt Generation Unit 105 Description Generation Unit 106 Storage section 107 Description Reflection Section 110 control section

Claims

1. a comment adding means for adding, to the source code of a first method among a series of methods defined in the series of source codes to be analyzed, a comment describing a second method called from the first method; a generation means for inputting the source code of the first method to which the explanatory text of the second method has been added as a comment to a generation AI that analyzes the meaning of a method defined in an input source code and generates an explanatory text of the method, thereby causing the generation AI to generate an explanatory text of the first method; a control means for controlling the order in which the comment adding means and the generating means process each of the series of methods, so that the comment adding means and the generating means sequentially treat each of the series of methods as the first method from the end side to the root side of a call graph showing the call relationships between each of the series of methods, and cause the generating AI to generate an explanation of the first method; An information processing device having the above.

2. When there are a plurality of second methods called from the first method, the comment adding means adds explanatory text for each of the plurality of methods as a comment to the source code of the first method. The information processing device according to claim 1 .

3. when a plurality of methods are called by the invocation of the second method, the comment adding means combines explanatory statements of the plurality of methods into one explanatory statement and adds the one explanatory statement as a comment to the source code of the first method; The information processing device according to claim 1 .

4. the comment adding means identifies that the plurality of methods are called by a call of the second method based on the call graph or information indicating a call relationship between each of the series of methods that are the source of generation of the call graph; The information processing device according to claim 3 .

5. When the method called as the second method is a method defined in a second class inherited by a first class in which the second method is defined, or in an interface implemented in the first class, the comment adding means adds information indicating that the method called as the second method is a method defined in the second class or the interface to an explanatory statement of the second method added as a comment to the source code of the first method. The information processing device according to claim 1 .

6. the comment adding means identifies that the method called as the second method is a method defined in the second class or the interface, based on the call graph or information indicating a call relationship between each of the series of methods that are the source of generating the call graph; The information processing device according to claim 5 .

7. The control means If the series of methods includes a recursive call, the order of processing by the comment adding means and the generating means is determined based on a call graph in which a plurality of methods that are targets of the recursive call are grouped into one node, among the methods corresponding to each of the series of nodes in the call graph, and determining an order in which the series of methods are to be processed by the comment adding means and the generating means by expanding the one node so that each of the plurality of methods to be recursively called is called at least twice; The information processing device according to claim 1 .

8. the comment adding means, when an existing comment is included in the source code of the first method, deletes the existing comment from the source code and then adds an explanatory text of the second method as a comment; the generating means inputs the source code of the first method, from which the existing comment has been deleted and to which the explanatory text of the second method has been added as a comment, to the generating AI, thereby causing the generating AI to generate the explanatory text of the first method; The information processing device according to claim 1 .

9. The generation means edits the description of the first method generated by the generation AI based on the existing comments. The information processing device according to claim 8 .

10. the comment adding means, when an existing comment is included in the source code of the first method, adds an explanatory text of the second method as a comment to the source code in a state where the existing comment is included; the generating means inputs the source code of the first method, which includes the existing comments and to which the explanatory text of the second method has been added as a comment, into the generating AI, thereby causing the generating AI to generate the explanatory text of the first method; The information processing device according to claim 1 .

11. An information processing method executed by an information processing device, a comment adding step of adding, as a comment, a description of a second method called from a first method among a series of methods defined in a series of source codes to be analyzed; a generation step of inputting the source code of the first method to which the explanatory text of the second method has been added as a comment to a generation AI that analyzes the meaning of a method defined in the input source code and generates an explanatory text of the method, thereby causing the generation AI to generate an explanatory text of the first method; a control step of controlling the order in which each of the series of methods is processed in the comment adding step and the generation step, so that the comment adding step and the generation step sequentially treat each of the series of methods as the first method from the end side to the root side of a call graph showing the call relationships between each of the series of methods, and have the generation AI generate an explanation of the first method; An information processing method, including:

12. On the computer, a comment adding step of adding, as a comment, a description of a second method called from a first method among a series of methods defined in a series of source codes to be analyzed; a generation step of inputting the source code of the first method to which the explanatory text of the second method has been added as a comment to a generation AI that analyzes the meaning of a method defined in the input source code and generates an explanatory text of the method, thereby causing the generation AI to generate an explanatory text of the first method; a control step of controlling the order in which each of the series of methods is processed in the comment adding step and the generation step, so that the comment adding step and the generation step sequentially treat each of the series of methods as the first method from the end side to the root side of a call graph showing the call relationships between each of the series of methods, and have the generation AI generate an explanation of the first method; A program that executes.

Citation Information

Patent Citations

  • Method and device for generating comment sentence of computer program

    JP2001005650A