Information processing apparatus, information processing method, program, and recording medium

The information processing device uses a call graph to sequence method analysis and AI generation, addressing token limits and call relationship challenges, ensuring comprehensive explanatory text is added to source code.

WO2026048144A1PCT designated stage Publication Date: 2026-03-05NS SOLUTIONS CORPORATION
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2025/016578
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-08-28
Filing Date
2025-05-02
Publication Date
2026-03-05

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 the content of called methods, leading to increased token usage and difficulty in accurately recognizing call relationships.

Method used

An information processing device that uses generation AI to generate explanatory text by analyzing source code through a call graph, processing methods sequentially from the end to the root, and adding comments to the source code, ensuring comprehensive explanations are generated efficiently.

Benefits of technology

The device effectively generates detailed explanatory text for source code methods, addressing the limitations of conventional AI methods by considering call relationships and token limits, resulting in improved understanding of complex code structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2025016578_05032026_PF_FP_ABST
    Figure JP2025016578_05032026_PF_FP_ABST
Patent Text Reader

Abstract

The present invention makes it possible for explanatory text for a method defined in a target source code to be generated in a more suitable form by using a generative AI. An information processing apparatus comprises: a comment addition means for adding explanatory text, for a second method called from a first method, as a comment to the source code for the first method; a generation means for inputting the source code for the first method, to which the explanatory text for the second method has been added as a comment, to a generative AI, and thereby causing the generative AI to generate the explanatory text for the first method; and a control means for controlling the order in which each of a series of methods is to be processed so that the comment addition means and the generation means cause the generative AI to generate the explanatory text for the first method sequentially using each of the series of methods as the first method from an end side to a root side of a call graph indicating calling relationships between each of the series of methods.
Need to check novelty before this filing date? Find Prior Art

Description

Information processing device, information processing method, program, and recording medium

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

[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 previously built, operated, maintained, replaced, etc., insufficient comments on the source code may make it difficult for workers to understand the intentions expressed by the source code. Furthermore, even in situations where documentation related to the target source code remains, the documentation may not be organized, making it difficult to extract information about the target source code. Against this background, technologies for generating explanatory text for the target source code based on the source code have been studied. Patent Document 1 discloses an example of a technology for generating explanatory text for the source code (e.g., explanatory text added as a comment) based on the source code. Furthermore, in recent years, with the development of AI technology, it has become possible to generate a variety of content using AI (learning models) trained by so-called machine learning. Against this background, technologies for generating explanatory text to be added as comments from source code using AI have also been studied. 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 (for example, the processing content of a method). In particular, in recent years, so-called generative AI technology, such as ChatGPT (registered trademark), has been attracting attention, which generates content according to various instructions input as prompts.

[0003] Japanese Patent Application Laid-Open No. 2001-5650

[0004] 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

[0005] On the other hand, when generating explanatory text from source code using a generation AI to indicate the content of the processing defined in the source code, conventional methods have difficulty in 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 considering the content of the methods called from that method. Furthermore, even if the generation AI is made to generate comments including 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 tolerate, 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 the target source code in a more suitable manner.

[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 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; 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.

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

[0009] 1 is a diagram showing an example of a method for generating a method description using generation AI; FIG. 1 is a diagram showing an example of a result of generation of a method description by generation AI; FIG. 1 is a diagram showing an example of a call graph; FIG. 1 is a diagram showing an example of a prompt related to description generation; FIG. 1 is a diagram showing an example of a hardware configuration of an information processing device; FIG. 2 is a functional block diagram showing an example of a functional configuration of an information processing device; FIG. 2 is a flowchart showing an example of processing of an information processing device; FIG. 3 is a diagram showing an example of a prompt related to description generation and a generation result; FIG. 4 is a diagram showing an example of a prompt related to description generation and a generation result; FIG. 5 is a diagram showing an example of a prompt related to description generation and a generation result; FIG. 6 is a diagram showing an example of a prompt related to description generation and a generation result; FIG. 7 is a diagram showing an example of a prompt related to description generation and a generation result; FIG. 8 is a diagram showing an example of a prompt related to description generation.

[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] <Overview> An overview of features of an information processing device according to an embodiment of the present disclosure will be described with reference to FIGS. 1 to 4 . The information processing device according to this embodiment generates explanatory text for a method defined in target source code using a model known as generative AI, among learning models such as neural networks that have undergone training 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 incorporates 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] In the example shown in FIG. 1 , a target source code C100 is designated as an analysis target, and a prompt D200 instructing the generation of comments for the source code C100 is input to the generation AI 500. The generation AI 500 analyzes the meaning (e.g., processing content, etc.) of the source code C100 designated in the prompt D200 according to the instructions in the prompt D200, and generates and outputs an explanatory text D300 for the source code C100 based on the analysis results. The generated explanatory text D300 may be added (feedback) to the source code C100 to be analyzed as a comment. The generation AI 500 may be based on existing technology. Examples of the generation AI that receives a prompt instructing the user as input and generates and outputs text corresponding to the instruction include ChatGPT. Furthermore, an example of a technology for automatically generating comments for a target source code using an AI (model) trained based on machine learning is disclosed in Non-Patent Document 1.

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

[0014] 3 and 4 provide an overview of the basic technical concept of the information processing device according to this embodiment, which uses AI to generate descriptions for methods defined in source code to be analyzed. The information processing device according to this embodiment generates descriptions for each method based on information (e.g., a call graph) indicating the analysis results of the call relationships for each method defined in the source code to be analyzed. For example, FIG. 3 illustrates an example of a call graph indicating the call relationships for each method for which descriptions are to be generated. In the example shown in FIG. 3, nodes N110 to N160 associated with six methods are connected according to the call relationships of the six methods to form a call graph N100. Since known techniques can be applied to the analysis of the call relationships for each method defined in the source code to be analyzed and the generation of a call graph based on the analysis results, detailed descriptions are omitted. Furthermore, for convenience, in this disclosure, the caller side of the connection relationships between nodes corresponding to each method shown in the call graph is also referred to as the root side, and the callee side is also referred to as the end side. As a specific example, if we focus on the relationship between node N130 associated with method "B.process()" and node N140 associated with method "E.process()", node N130 will be located on the root side and node N140 will be 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 target 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 target 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 node N120 in the example shown in FIG. 3. The source code C110 shown in FIG. 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 the generation AI 500. The source code C110 specifies code C1101, C1102, and C1103 that call methods corresponding to nodes N130, N150, and N160 shown in FIG. 3. If 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 corresponding method description sentences C1104, C1105, and C1106 as comments to source code C110, associating them with code C1101, C1102, and C1103 of the methods corresponding to nodes N130, N150, and N160, respectively. Note that in the example shown in FIG. 4 , a method for which description sentences are to be generated, such as the method shown as code C110, is an example of a "first method." Furthermore, other methods called from the method for which description sentences are to be generated, such as the methods shown as code C1101, C1102, and C1103, are an example of a "second method."

[0017] The information processing device 100 then adds the source code C110 of the target method as the code to be processed to a prompt D210, which instructs the generation AI 500 to generate an explanatory statement. In the example shown in FIG. 4 , the prompt D210 specifies the source code of the method to be analyzed in an area indicated by the "#Code" tag. The prompt D210 also specifies a rule for outputting the explanatory statement in an area indicated by the "#Rule" tag, and specifies the output format of the explanatory statement 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, thereby causing the generation AI 500 to generate an explanatory statement D310 of the method indicated as the source code C110. In addition, 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 Figure 1.

[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 the 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 CPU (Central Processing Unit) 910, a ROM (Read Only Memory) 920, and a RAM (Random Access Memory) 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 each other 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 various programs. The auxiliary storage device 940 is realized by a storage device that can temporarily or permanently store various data, such as a non-volatile memory such as a hard disk drive (HDD) or 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> An example of the functional configuration of the information processing device 100 according to this embodiment will be described with reference to Fig. 6, focusing particularly on the portion related to generating an explanatory statement for each of a series of methods defined in a series of source code 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 statement generation unit 105, a storage unit 106, and an explanatory statement 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 described 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, and detailed description thereof will be omitted. For convenience, the other components will be described assuming that the call graph N100 illustrated in FIG. 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 to be processed so that each of the methods in the series is processed sequentially from the end to the root of the call graph N100. The control unit 110 then controls the operation of the code extraction unit 102, the comment addition processing unit 103, the explanation generation unit 105, and other units, described below, so that each method is processed sequentially according to 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 the target method from the source code extracted by the code extraction unit 102, and if the target method calls another method, adds an explanatory text for the other method to the code as a comment. As described above with reference to Figures 3 and 4, if the target method calls another method, the other method has previously been targeted for processing, and an explanatory text for the other method has already been generated. Therefore, in this case, the code extraction unit 102 reads an explanatory text for the other method that was previously generated and stored in a predetermined storage area (e.g., the storage unit 106 described below) 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 to generate an explanation of the method, with the code of the method to be processed designated as the analysis target. 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 designated as the analysis target. The method for generating the prompt D210 has been described above with reference to FIG. 4, and therefore 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 into 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 memory area (e.g., the memory 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 explanatory text D310 which is stored 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] Above, with reference to FIG. 6 , an example of the functional configuration of the information processing device 100 according to this embodiment has been described, focusing particularly on the portion related to generating descriptions 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 in particular on the part related to generating explanatory text for each of a series of methods defined in a series of source code 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 extracts source code that defines a method to be processed from a series of source code C100 to be analyzed in accordance with instructions from the control unit 110. In S103, the comment addition processing unit 103 reads the code of the method to be processed from the source code extracted in S102. Furthermore, if the method in question calls another method, the comment addition processing unit 103 adds an explanatory text for the other method to the read code as a comment. Note that if an explanatory text for the other method has not been generated, the comment addition processing unit 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 based on the processing result of S103, instructing the generation AI 500 to generate an explanatory text for the method, for which the code of the method to be processed has been specified as the analysis target. In S105, the explanatory text generation unit 105 inputs the prompt D210 generated in S104 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 the storage unit 106.

[0040] In S106, the control unit 110 determines whether the generation of explanatory text for each of the methods defined in the source code to be analyzed has been completed. If the control unit 110 determines in S106 that the generation of explanatory text 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 processing from S102 onwards to be executed again for methods that have not yet been processed. If the control unit 110 determines in S106 that the generation of explanatory text for each of the methods defined in the source code to be analyzed has been completed, the control unit 110 ends the series of processing shown in FIG. 7.

[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] 8 to 12 and 21, 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. In this example, an example of a case where each method shown in the call graph N100 is the processing target based on the call graph N100 illustrated in FIG.

[0043] First, for reference, an example of source code from which the call graph N100 shown in FIG. 3 is generated, i.e., source code of a series of methods to be analyzed, will be outlined with reference to FIG. 21. The series of source code shown in FIG. 21 defines a process for reading the contents of a target file, replacing target strings contained in the contents, and writing the results to a file. Class E inherits class D, and in class E, method D.process() defined in class D is overridden as E.process(). Specifically, method D.process() is defined as a process for returning a directory list, while method E.process() is defined as a process for returning the contents of a file. Furthermore, in class B, variable d is defined as an object of class D and is defined to call method D.process(), but due to the definition of the Main class, method E.process() is actually called.

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

[0045] The method "B.process()" shown as node N130 in FIG. 3 is applied as the second processing target. FIG. 9 shows an example of a prompt D212 generated for the method shown as node N130 and an example of an explanatory statement D312 output from the generation AI 500 using the prompt D212 as input. Specifically, FIG. 9(a) shows an example of the prompt D212. Code C112 corresponds to the code of the method specified as the analysis target. Note that, as shown in FIG. 3, the method shown as node N130 calls the method shown as node N140. Therefore, in the prompt D212, explanatory statement D311a of the method shown as node N140 is added as a comment in association with code C112. The explanatory statement D311a shown in FIG. 9(a) is an explanatory statement based on explanatory statement D311 shown in FIG. 8(b) and edited as follows: Class E, which defines the method indicated as node N150 called in code C112, inherits class D, and code C112 calls the method indicated as node N150 as a method of the inheritor class D. As such, due to inheritance (extends) and implementation (implements), the type of the actually called method 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 D311a is formed by editing explanatory text D311 added as a comment to add explanatory text D311b indicating that the class in which the target method is defined inherits another class (class D). As another example, instead of adding 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 explanatory text D312 output by generation AI500 using 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 method "A.process()" shown as node N150 in Figure 3 is applied as the third processing target. Figure 10 shows an example of a prompt D213 generated for the method shown as node N150 and an example of an explanatory statement D313 output from the generation AI 500 using the prompt D213 as input. Specifically, Figure 10(a) shows an example of the 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 shown as node N150 does not call the method to be explained. Therefore, as shown as code C113, no separate comments are added to the code of the method shown as node N150. Figure 10(b) shows an example of an explanatory statement D313 output from the generation AI 500 using the prompt D213 as input.

[0047] The method "C.process()" shown as node N160 in Figure 3 is applied as the fourth processing target. Figure 11 shows an example of a prompt D214 generated for the method shown as node N160 and an explanatory statement D314 output from the generation AI 500 using the prompt D214 as input. Specifically, Figure 11(a) shows an example of the 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 are added to the code of the method shown as node N160. Figure 11(b) shows an example of an explanatory statement D314 output from the generation AI 500 using the prompt D214 as input.

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

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

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

[0051] (Variation 1: When Multiple Methods are Called in a Single Line of Code) As Variation 1, an example of a method for adding explanatory text as a comment to code specified in a prompt when multiple methods are called in a single line of code will be described. For example, FIG. 13 is a diagram showing an example of a prompt when multiple methods are called in a single line of code, and shows an excerpt of the specified portion of the code to be analyzed. Specifically, in prompt D221, the methods "m()," "n()," "s()," and "t()" are each called sequentially in a single line of code. In such a case, as shown in FIG. 13 , explanatory text generated for each of the multiple called methods may be added in the order in which the multiple methods are called.

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

[0053] For example, FIG. 15 shows an example of a prompt D233 that is input to the generation AI and an example of 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 the prompt D233. In the prompt D233, multiple explanations to be integrated are specified in an area indicated by the "#Input" tag. For example, in the example shown in FIG. 15(a), the explanation D231 of the method "foo" of class A1 shown in FIG. 14(b) and the explanation D232 of the method "foo" of class A2 shown in FIG. 14(c) are specified as the items to be integrated. Furthermore, in the prompt D233, the output format of the explanations is specified in an area indicated by the "#Output format" tag. Instruction D2331 is an instruction for specifying the output format of the integrated explanations. 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 explanations is not particularly limited. Therefore, the prompt D233 shown in FIG. 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) illustrates an example in which multiple methods are called by a single method call. 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) illustrates an example of a call graph generated for source code 1 shown in FIG. 16( a). FIG. 16( c) illustrates information indicating the call relationships between a series of methods defined in source code 1 shown in FIG. 16( a), from which the call graph shown in FIG. 16( b) was generated. In contrast, source code 2 shown in FIG. 16( d) illustrates an example in which multiple methods are called individually. In source code 1, a call to method "foo" in class A1 and method "foo" in class A2 are called individually in method "bar". FIG. 16( e) illustrates an example of a call graph generated for source code 2 shown in FIG. 16( d). 16(f) is information showing the calling relationships between a series of methods defined in source code 2 shown in FIG. 16(d), which is the source of the call graph shown in FIG. 16(e).

[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 determine 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 Call to the Parent Class Constructor is Not Explicitly Specified) As Variation 3, an example of code to be specified in the prompt when the call to the parent class constructor is not explicitly specified will be described. For example, FIG. 17( a) is a diagram showing an example of source code in which the call to the parent class constructor is not explicitly specified. Specifically, in the example shown in FIG. 17( a), a definition of class A and a definition of class B that inherits class A are made. Although no processing is described in the constructor of class B, the constructor of class A is actually called. In this case, when implicitly called processing exists, the target source code may be edited to explicitly specify the processing. For example, FIG. 17( b) shows an example of code related to the definition of class B, in which code for the implicitly called processing has been added so that the code is explicitly specified. In the example shown in FIG. 17( a), the source code specified in the prompt may be edited so that code for calling the constructor of the parent class (i.e., class A) is added to the constructor of class B, as shown in FIG. 17( b). By making such edits, it becomes possible for the generation AI 500 to generate explanatory text that takes into account code that was implicit in the original source code.

[0059] (Variation 4: Processing Order When Recursive Calls Are Made) As Variation 4, an example of a method for determining the processing order of each of a series of methods for which description is to be generated when a recursive call is made in part of the series of methods will be described. For example, FIG. 18 shows an example of a call graph showing the call relationships of a series of methods, some of which include a recursive call. In the example shown in FIG. 18, a loop occurs in the call relationships between methods "b," "c," and "d" due to a recursive call between them. 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 for method “B.” Then, the order in which the nodes in the call graph are processed is determined using a method similar to that described with reference to FIG. 3 (e.g., 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 together as a single node as a strongly connected component, i.e., the recursively called methods “b,” “c,” and “d” grouped together as method “B,” are expanded. In this case, the part grouped as 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 Figure 18, the methods are ordered to be processed in the following order: "f", "e", "b", "c", "d", "b", "c", "d", and "a".

[0061] In this way, by controlling a series of methods that form a loop by recursive calls so that each is processed at least twice, it is possible that some of the method descriptions related to the recursive calls 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] (Variant 5: Handling of existing comments) As variant 5, an example of how to handle existing comments when the source code of a method for which a description is to be generated contains existing comments will be described. When the source code of a method for which a description is to be generated contains existing comments, one of the following example measures can be applied to handle the existing comments. (Measure 1) Have the generation AI generate a description for code from which existing comments have been deleted. (Measure 2) Have the generation AI generate a description for code that contains existing comments. (Measure 3) Have the generation AI generate a description for code from which existing comments have been deleted, and then edit (brush up) the description based on the existing comments.

[0063] In addition, when applying Countermeasure 3, if the explanation generated by the generation AI is to be brushed up with existing comments, the brushing up may be performed by the generation AI. Therefore, with reference to FIG. 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 explanation. Source code C161 shown in FIG. 19 represents source code containing existing comments. By deleting the existing comments from this source code C161, source code C162 that does not contain existing comments is generated. Then, a prompt D261 that specifies the source code C162 as the analysis target is input to the generation AI (e.g., the generation AI 500 described above), and the generation AI generates explanation 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, thereby generating an explanatory text D264 edited by the generation AI. The type of generation AI applied in this case is not particularly limited. The format of the prompt D263 may be changed as appropriate depending on the generation AI applied. Furthermore, when editing (brushing up) the explanatory text, the input to the generation AI is not limited to text information such as existing comments, but may also include other types of data other than text information, such as documents and images related to the target source code. In other words, as long as the data is of a type that the generation AI that edits the explanatory text can accept as input, various types of data, not just text information, may be used as input to the generation AI to edit (brush up) the explanatory text.

[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 information regarding the application of the technology according to the present disclosure is summarized below. As described above, when generating the description of a certain method, the information processing apparatus 100 according to an embodiment of the present disclosure uses the description of other methods called from that method, but does not apply the description of the calling method. As a specific example, assume that the description of the method "B.t()" is generated under the circumstances where a call graph is generated such that the methods "A.s()," "B.t()," and "C.u()" are called in this order. In this case, when generating the description of the method "B.t()," the description of the method "C.u()" is used, but the description and code of the calling method "A.s()" are not used. Applying such control makes it possible to prevent the generated description from becoming too complex or voluminous.

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

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

[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 method in the series 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 method in the series, sequentially treating each method in the series as the first method and causing the model to generate a description of the first method.

[0069] With the above-described configuration, it is possible to have the model (generation AI) generate a description of each method by taking into account the call relationships of each method defined in the 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. That is, 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. Note that, while the above-described embodiment mainly describes an example in which a generation AI (model) trained based on machine learning is applied, there are no particular limitations on the method of constructing the components corresponding to the generation AI, as long as the same function can be realized.

[0070] The above-described embodiment is merely an example, and does not necessarily limit the configuration or processing of the present invention. Various modifications and changes may be made without departing from the technical spirit of the present invention. The present invention also includes a program that realizes the functions of the above-described embodiment, and a computer-readable recording medium that stores the program.

[0071] The following configuration also falls within the technical scope of the present disclosure: (1) An information processing device comprising: comment adding means for adding, as a comment, an explanatory statement of a second method called from a first method among a series of methods defined in a series of source code to be analyzed; generation means for inputting the source code of the first method, to which the explanatory statement 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 an explanatory statement of the method, to cause the generation AI to generate an explanatory statement of the first method; and control means for controlling the order in which the comment adding means and the generation means process each of the series of methods, from an end side to a root side of a call graph indicating a call relationship between each of the series of methods, to cause the generation AI to generate an explanatory statement of the first method, with each of the series of methods as the first method in sequence. (2) The information processing device according to (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 according to (1), wherein, when multiple methods are called by calling the second method, the comment adding means combines explanatory text for each of the multiple methods into a single explanatory text and adds the single explanatory text as a comment to the source code of the first method. (4) The information processing device according to (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 relationships between each of the series of methods from which the call graph was generated.(5) The information processing device according to any one of (1) to (4), wherein the comment adding means, 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, adds information indicating that the method called as the second method is a method defined in the second class or the interface to a description of the second method added as a comment to the source code of the first method. (6) The information processing device according to (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 a call relationship between each of the series of methods from which the call graph is generated. (7) The information processing device according to any one of (1) to (6), wherein, when the series of methods includes a recursive call, the control means determines an order in which the comment adding means and the generating means will process methods corresponding to each of the series of nodes in the call graph based on a call graph in which multiple methods that are targets of the recursive call are grouped into one node, and then expands the one node so that each of the multiple methods that are targets of the recursive call is called at least twice, thereby determining an order in which the series of methods will be processed by the comment adding means and the generating means. (8) The information processing device according to any one of (1) to (7), wherein, when an existing comment is included in the source code of the first method, 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 generating 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 to the generation AI, thereby causing the generation AI to generate an explanatory text of the first method.(9) The information processing device according to any one of (1) to (7), wherein the generating means edits the description of the first method generated by the generating AI based on the existing comment. (10) The information processing device according to any one of (1) to (7), wherein the comment adding means, when an existing comment is included in the source code of the first method, adds the description of the second method to the source code as a comment while including the existing comment, and the generating means inputs the source code of the first method, which includes the existing comment and to which the description of the second method has been added as a comment, into the generating AI, thereby causing the generating AI to generate the description 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 into 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 into 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.

[0072] REFERENCE SIGNS LIST 100 Information processing device 101 Call relationship analysis unit 102 Code extraction unit 103 Comment addition processing unit 104 Prompt generation unit 105 Explanation generation unit 106 Storage unit 107 Explanation reflection unit 110 Control unit

Claims

1. An information processing device having: 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 code 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 to 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 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 an explanatory text of the first method in sequence from the end side to the root side of a call graph showing the call relationships between each of the series of methods, with each of the series of methods as the first method.

2. The information processing device according to claim 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 according to claim 1, wherein, when multiple methods are called by calling the second method, the comment adding means combines the explanatory text of each of the multiple methods into a single explanatory text and adds the single explanatory text as a comment to the source code of the first method.

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

5. An information processing device according to any one of claims 1 to 4, wherein the comment adding means adds information indicating that 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, to a description of the second method added as a comment to the source code of the first method.

6. The information processing device according to claim 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 relationships between each of the series of methods from which the call graph was generated.

7. An information processing device as claimed in any one of claims 1 to 6, wherein, when 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 together as one node, and then 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 by expanding the one node so that each of the multiple methods that are the target of the recursive call is called at least twice.

8. An information processing device according to any one of claims 1 to 7, wherein the comment adding means, if the source code of the first method contains an existing comment, 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 claim 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 according to any one of claims 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, including the existing comment; and the generation means inputs the source code of the first method, including 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, 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 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 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 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 an explanatory text of the first method in sequence, 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 relationships 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, 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 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 the methods defined in the input source code and generates an explanatory text of the first method, thereby causing the generation AI to generate an explanatory text 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 an explanatory text of the first method in sequence, from the end side to the root side of a call graph showing the calling relationship between each of the series of methods, with each of the series of methods as the first method.

13. A recording medium having recorded thereon a program for causing a computer to execute the following steps: a comment adding step for adding, as a comment, an explanatory text of a second method called from a first method to the source code of a first method among a series of methods defined in a series of source codes to be analyzed; a generation step 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 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 step for 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 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 calling relationship between each of the series of methods.

Citation Information

Patent Citations

  • Program comprehension supporting method

    JP1998293685A

  • Method and device for generating comment sentence of computer program

    JP2001005650A

  • Software manual generation system in two or more natural languages

    JP2007034813A

  • Specification creating program, device therefor, and method thereof

    JP2009230618A