Comment classification system, comment classification method, and comment classification program
The comment classification system addresses the challenge of efficiently providing code-related knowledge by classifying and displaying comment information, allowing viewers to effectively understand code purposes and modifications.
Patent Information
- Application Number
- JP2023180716
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-10-20
- Publication Date
- 2025-05-02
AI Technical Summary
Existing techniques for generating documentation from code struggle to efficiently provide knowledge related to the code, particularly in distinguishing between summary matters, domain knowledge, and other information, leading to difficulties for viewers in understanding the purpose and modifications of the code.
A comment classification system that detects common, additional, and generated comment information to distinguish between summary matters, domain knowledge, and other information, allowing for controlled display or output of comments to efficiently grasp knowledge related to the code.
Enables viewers to efficiently grasp knowledge related to the code by distinguishing and displaying relevant information based on the purpose of the comment viewer, improving understanding and reducing time waste.
Smart Images

Figure 2025070418000001_ABST
Abstract
Description
[Technical field]
[0001] The present disclosure relates to a technique for classifying comments added to program code. [Background technology]
[0002] Conventionally, code developers and the like add comments to program code (e.g., source code). Comments added to code can take the form of, for example, documentation and inline comments (or block comments). Documentation is written at the beginning of a set of code that plays a certain role (e.g., a set of code that represents a function). Documentation contains a summary of matters related to that set of code. Inline comments are written near the code. Inline comments contain matters related to that code. (Block comments play a similar role to inline comments, except that they are for a partial group of code included in the set of code described above.)
[0003] In recent years, there have been attempts to generate documentation for program codes in a near-automatic manner, without the need for manual effort. Patent Document 1 discloses a prior art technique for generating a document (documentation) in a natural language based on a source program and a data dictionary, etc. [Prior art documents] [Patent documents]
[0004] [Patent Document 1] JP 2018-106582 A Summary of the Invention [Problem to be solved by the invention]
[0005] Comments added to program code (e.g., source code) are intended to enable readers of the comments (who are not necessarily the code's developers) to efficiently grasp knowledge related to the code.
[0006] Here, each reader of the comments may have a different purpose. A reader of a comment who uses the code corresponding to the comment by invoking it (a code user) may have the objective of grasping matters that clearly indicate the function and input / output specifications of the code (i.e., summary matters). Invoking code may include developing new code to invoke the code. When a code user is different from the code developer, etc., it is useful for the code user to be able to efficiently grasp summary matters of the code. There may be cases where a reader of comments who intends to redesign (refactor), modify, or add functionality to code (a person who intends to modify the code) has the objective of understanding the summary of the code. The person who intends to modify the code may be different from the original developer of the code. It is time-consuming for one person to modify code developed by another person. Therefore, it is useful to enable the other person to efficiently understand the summary of the code. A reader of a comment may have the purpose of understanding reference knowledge (e.g., domain knowledge) about the code that the developer of the code or the like has written in the comment (not matters that can be derived from the code itself). The domain knowledge referred to here may be, for example, the purpose or background of the development of the code, precautions regarding bugs in the code, the reason for the existence of the code that is difficult to understand at first glance (e.g., the code was created to avoid bugs in other functions, etc.), the intended target of the code, know-how, supplementary explanations, etc. A person who wants to understand the domain knowledge by reading the comments may be either a user of the code or a person who intends to modify the code. The domain knowledge obtained from the comments may be points to consider when using or modifying the code. Comment readers who have difficulty directly understanding the code itself may want to efficiently grasp summary information about the code or reference knowledge about the code (e.g., domain knowledge) that is not derivable from the code itself.
[0007] On the other hand, comments added to code can have a variety of contents. Comments may contain items that succinctly indicate the code's functionality and input / output specifications (summary items, main items). Comments may also contain reference knowledge of the code (e.g., domain knowledge) as described above (items that cannot be derived from the code itself). Comments may also contain items that can be derived from the code itself but cannot be considered summary items for the code (non-main items, e.g., pre-processing items). In addition, the various items and knowledge mentioned above may be written in a manner that does not clearly distinguish them from each other in the comments. In some cases, the comments added to the code may contain too much information for the purpose of the reader of the comments.
[0008] In the above situation, if the comments added to the code are presented in their original form, it may cause difficulty and waste of time for the reader of the comment. In other words, if the various items and knowledge described above are written in the comment in a manner that does not distinguish them from each other, it may be difficult for the reader of the comment to understand which comment provides the item or knowledge that is in line with the reader's purpose. Or, such understanding may take a long time.
[0009] The prior art disclosed in Patent Document 1 generates documentation (comments) for a source program (code) in a nearly automatic manner. The documentation (comments) generated are considered to be close to a direct translation of the source program (code) (content that faithfully reflects the code). Therefore, the prior art disclosed in Patent Document 1 may have difficulty efficiently providing knowledge related to the source program (code) in line with various objectives that viewers of the documentation (comments) may have. Furthermore, the prior art disclosed in Patent Document 1 does not deal with comments added to a source program (code), but rather deals with documents (comments) that are generated almost automatically. Therefore, the prior art disclosed in Patent Document 1 has little idea of utilizing knowledge explicitly provided by the developer of the source program (code) by writing comments. In other words, the prior art disclosed in Patent Document 1 has little idea of utilizing the above-mentioned reference knowledge of the code (e.g., domain knowledge) (not matters derived from the code itself) or of utilizing what the developer recognized as summary matters (main matters) of the source program (code).
[0010] As mentioned above, in addition to the prior art disclosed in Patent Document 1, there have been attempts to generate documentation for program code in a near-automatic manner without manual intervention. However, in only near-automatic generation of documentation, there is little idea of utilizing reference knowledge of the code (e.g., domain knowledge) (not matters derived from the code itself) or of utilizing what developers have recognized as summary matters (main matters) of the code.
[0011] In light of the above, one of the objectives of the present disclosure may be to enable a reader of a comment attached to code to efficiently grasp knowledge related to the code from the comment that is in line with the reader's purpose. [Means for solving the problem]
[0012] In order to achieve at least one of the above objects, the present disclosure may have the following features, for example. One aspect of the present disclosure is a comment classification system. The comment classification system detects at least one of comment common information, added comment difference information, and generated comment difference information based on added comment information added to code information and generated comment information generated from the code information. Here, the comment common information is made up of information determined to be included in both the added comment information and the generated comment information. The added comment difference information is made up of information determined to be included in the added comment information but not included in the generated comment information. The generated comment difference information is made up of information determined to be included in the generated comment information but not included in the added comment information. The comment classification system controls to display or output a comment for code information in a manner in which at least one piece of information detected among the comment common information, the added comment difference information, and the generated comment difference information is distinguished from the other pieces of information. Effect of the Invention
[0013] As described above, the present disclosure detects at least one of comment common information, added comment difference information, and generated comment difference information based on added comment information added to code information and generated comment information generated from the code information. The present disclosure classifies the comment information by detecting this information. The present disclosure then controls to display or output comments for the code information in a manner in which at least one of the detected pieces of information is distinguished from other pieces of information. A reader of the comment can efficiently grasp knowledge that matches his / her purpose by coming into contact with a display or output in a manner in which the information is distinguished. In this way, the present disclosure enables a reader of a comment added to a code to efficiently grasp knowledge related to the code that matches the reader's purpose from the comment.
[0014] A comment classification method or program that achieves the same thing as the comment classification system described above can also achieve the same effect as the comment classification system. In the form of a program, costs can be reduced in many cases. Programs also make it easier to make design changes to the processing. Other features that the present disclosure may have and the effects corresponding to these features will be disclosed in this specification, the claims, or the drawings. [Brief description of the drawings]
[0015] [Figure 1] 1 illustrates a functional configuration common to several embodiments of the present disclosure. [Diagram 2] 1 illustrates a functional configuration of a first embodiment of the present disclosure. [Diagram 3] 2 shows information handled in the first embodiment of the present disclosure. [Figure 4] 1 shows an overall configuration common to several embodiments of the present disclosure. [Diagram 5] 1 shows a computer architecture. [Figure 6] 2 shows a flowchart of a process according to a first embodiment of the present disclosure. [Figure 7] The source code with additional comments (first example) is shown below. [Figure 8] An additional comment (first example) is shown below. [Figure 9] The (faithful) generated comment (first example) is shown below. [Figure 10] The display output (first example) is shown below. [Figure 11] 1 shows a functional configuration of a second embodiment of the present disclosure. [Figure 12] 2 shows information handled in the second and third embodiments of the present disclosure. [Figure 13] 2 shows information handled in the second and third embodiments of the present disclosure. [Figure 14] 2 shows information handled in the second and third embodiments of the present disclosure. [Figure 15] 13 shows a flowchart of a process according to a second embodiment of the present disclosure. [Figure 16] The source code with additional comments (second example) is shown below. [Figure 17] An additional comment (second example) is shown below. [Figure 18] A faithfully generated comment (second example) is shown below. [Figure 19] 1 shows comment information corresponding to a code sequence having a serial data flow. [Figure 20] 1 shows comment information corresponding to a code sequence having parallel data flow. [Figure 21] A data flow consideration generated comment (second example) is shown below. [Figure 22] The display output (part 1 of the second example) is shown below. [Diagram 23] The display output (part 2 of the second example) is shown below. [Figure 24] 13 illustrates a functional configuration of a third embodiment of the present disclosure. [Diagram 25] 13 shows a flowchart of a process according to a third embodiment of the present disclosure. [Figure 26] 13 shows a variation in which the comment generation function is integrated into the comment classification system. [Figure 27] The display output (additional example 1) is shown below. [Figure 28] The display output (additional example 2) is shown below. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0016] Hereinafter, the embodiments of the present disclosure will be described in detail with reference to the drawings. Note that the embodiments described below do not limit the disclosure related to the claims. In addition, not all of the elements and combinations thereof described in the embodiments are necessarily essential to the solution of the present disclosure. The following description and drawings are examples for explaining the present disclosure, and are omitted and simplified as appropriate for clarity of explanation. The present disclosure can be implemented in various other forms. Unless otherwise limited, each component may be singular or plural. The position, size, shape, range, etc. of each component shown in the drawings may not represent the actual position, size, shape, range, etc. in order to facilitate understanding of the invention. For this reason, the present disclosure is not necessarily limited to the position, size, shape, range, etc. disclosed in the drawings. Each of the systems, devices, or functional units of the present disclosure may be integrated in terms of hardware. Alternatively, the systems, devices, or functional units may be divided into multiple parts that work together to fulfill their roles. Several systems, devices, or functional units may be integrated in terms of hardware. Each of the systems, devices, or functional units may be realized by causing a computer to execute software (programs) (as in FIG. 5). Some of the functions of the system, device, or functional unit may be realized by hardware (e.g., hardwired logic or FPGA), and the remaining functions may be realized by executing software (programs). All of the functions of each of the systems, devices, or functional units may be realized by hardware. Some or all of the processing steps shown in the flowcharts etc. described in this disclosure may be realized by hardware. One or more systems, devices, or functional units of the present disclosure may be realized using one or more hardware resources. For this purpose, each of the systems, devices, or functional units of the present disclosure may be realized virtually. For example, a virtual computer or container technique may be used. The program of the present disclosure may be included in the concept that generally includes software that constitutes a specific information processing system (comment classification system) or its operating method (comment classification method) according to the intended use through the cooperation of software and hardware resources. In other words, the program of the present disclosure is not limited to a specific type or form of program. The program may also be initially recorded in a compressed format. The same reference numbers in the drawings are similar to each other. In the drawings showing a flowchart, rectangular boxes indicate processing steps. In the drawings showing a flowchart, "step" is abbreviated as "S". In the drawings, database is abbreviated as "DB". In the drawings, "data flow" is abbreviated as "FD" and "command" is abbreviated as "CMD". In the drawings, "information" is abbreviated as "i." Furthermore, the display or output modes shown in the drawings are examples and are not limited to these.
[0017] 0. Functional configuration common to several embodiments of the present disclosure 1 shows a functional configuration common to several embodiments of the present disclosure (at least the first, second and third embodiments described below). Note that not all of the functional configurations in FIG. 1 are essential. An embodiment of the present disclosure is a comment classification system 100. The comment classification system 100 receives commented code information 101. The commented code information 101 includes code information 111 and additional comment information 112. The additional comment information 112 is information on comments added to the code information 111. Examples of (source) code with additional comments corresponding to the commented code information 101 are shown in Figs. 7 and 16, which will be described later.
[0018] The comment classification system 100 also receives generated comment information 113. The generated comment information 113 is information generated based on information included in the code information 111, and is information indicating a comment. The generated comment information 113 may be generated by the comment generation system 102. (As will be described later using a modified example of FIG. 26, the comment classification system 100 itself may generate the generated comment information 113 instead of the comment generation system.) The comment generation system 102 may be any system (existing or to be developed in the future) capable of generating information indicating a comment corresponding to input information. As in the first, second and third embodiments described later, the comment generation system 102 may have a model trained to realize a comment generation function. Alternatively, the comment generation system 102 may have a comment generation function different from the model (such as by a dictionary or some rule-based method).
[0019] The comment classification system 100 detects at least one of the comment common information 121, the added comment difference information 122, and the generated comment difference information 123 based on the added comment information 112 and the generated comment information 113. The comment common information 121 consists of information determined to be included in both the added comment information 112 and the generated comment information 113. The added comment difference information 122 consists of information determined to be included in the added comment information 112 but not included in the generated comment information 113. The generated comment difference information 123 consists of information determined to be not included in the added comment information 112 but included in the generated comment information 113. The properties of the information that each of the comment common information 121, the added comment difference information 122, and the created comment difference information 123 may have depend on the added comment information 112 and the created comment information 113. In other words, the properties depend on what kind of comment is added as an added comment corresponding to the added comment information 112, and what kind of comment is generated as a created comment corresponding to the created comment information 113. Details will be described later with reference to Figures 3, 12, 13, and 14.
[0020] The comment classification system 100 treats at least one piece of information detected in the comment common information 121, the added comment difference information 122, and the generated comment difference information 123 as distinguished information 132. The comment classification system 100 controls to display or output the comment in a manner in which the distinguished information 132 is distinguished from the other information 133. As a result, a display or output 103 of the comment for the code information 111 is performed. The display or output 103 of the comment may be performed by a display or output device included in the comment classification system 100, or may be performed by any display or output device that can communicate with the comment classification system 100. Examples of the display or output 103 of the comment are shown in Figures 10, 22, 23, 27, and 28, which will be described later.
[0021] The comment classification system 100 (comment classification method, comment classification program) according to the present disclosure has the above-described functional configuration, and therefore can provide the effects shown in the above-described [Effects of the Invention].
[0022] 1. First embodiment of the present disclosure In all of the first, second and third embodiments of the present disclosure, a comment generation system 102 having a functional unit for generating comments exists outside the comment classification system 100. (Note that in the modified example of FIG. 26, the functional unit for generating comments exists inside the comment classification system 100.) First, among the embodiments in which the comment generation system 102 exists outside the comment classification system 100, a first embodiment having a relatively simple functional configuration will be described below.
[0023] 1. Functional configuration of the first embodiment of the present disclosure Fig. 2 shows the functional configuration of the first embodiment of the present disclosure. Note that not all functional configurations shown in Fig. 2 are essential. In Fig. 2, functional units are shown as solid rectangles, while handled information, commands or display outputs are shown as dotted rectangles. The boundary of the comment classification system 100 is shown as a dashed line. Since the processing of the first embodiment will be described in detail later with reference to the flowchart of Fig. 6 and Figs. 7 to 10, the outline of the functional units, information, commands and display output shown in Fig. 2 will be briefly described here. Also, the same description as in Fig. 1 may not be repeated.
[0024] The comment classification system 100 may have, as functional units, a generation command creation unit 241, a comment generation request unit 242, a reply receiving unit 243, an information detection unit 244, a comment display output control unit 245, and a code display output control unit 246. Functional units constituting the information detection unit 244 may include a comment common information detection unit 251, an added comment difference information detection unit 252, and a generated comment difference information detection unit 253. There may be a comment generation system 102 external to the comment classification system 100. The comment generation system 102 may have a model 299 as a functional part for generating comments. The generation command creation unit 241 generates a generation command 271. The comment generation request unit 242 provides the code information 111 and the generation command 271 to a model 299 in the comment generation system 102. The model 299 generates externally generated comment information 293 based on the code information 111 and the generation command 271. The answer receiving unit 243 receives the externally generated comment information 293 from the comment generation system 102, and treats the externally generated comment information 293 as generated comment information 113. Each of the comment common information detection unit 251, the added comment difference information detection unit 252, and the generated comment difference information detection unit 253 (any one or more of these functional units are operational) detects the comment common information 121, the added comment difference information 122, and the generated comment difference information 123, respectively, based on the added comment information 112 and the generated comment information 113. The comment display output control unit 245 controls the comment display output 231 based on at least one of the added comment information 112, the comment common information 121, the added comment difference information 122, and the generated comment difference information 123. The comment display output 231 includes a differentiated display output 232. The code display output control unit 246 controls the code display output 234 based on the code information 111. The comment display output 231 and the code display output 234 form the whole display output 203.
[0025] 1-2. Examples of information handled in the first embodiment of the present disclosure Fig. 3 shows an example of the relationship between the information included in added comment information 112 and the information included in generated comment information 113. When added comment information 112 and generated comment information 113 have the relationship shown in Fig. 3, the first embodiment of the present disclosure can provide a comment display output 231 that is in line with the purpose of the comment viewer. Note that even if the relationship between the information included in added comment information 112 and the information included in generated comment information 113 is different from that shown in Fig. 3, the first embodiment of the present disclosure can be used.
[0026] 3, the added comment information 112 includes domain knowledge candidate information 302 and code main part information 301. Meanwhile, the generated comment information 113 includes code main part information 301 and code non-main part information 303.
[0027] Both the code main part information 301 and the code non-main part information 303 are information that can be derived from the code information 111. The code main part information 301 is information corresponding to a part (main part) of the code (e.g., source code) corresponding to the code information 111 that succinctly indicates a function realized by the code. In other words, the code main part information 301 can also be said to be information including a summary of the code information 111. The code non-main part information 303 is information corresponding to a part (non-main part) of the code (e.g., source code) corresponding to the code information 111 other than the main part of the code. The code non-main part information 303 may include information corresponding to a part indicating preprocessing, for example.
[0028] The domain knowledge candidate information 302 is information that cannot be derived directly from the code information 111. The domain knowledge candidate information 302 corresponds to what a developer of the code corresponding to the code information 111 has written as reference knowledge (e.g., domain knowledge) of the code described above.
[0029] The example in Figure 3 shows that the code developer wrote comments to the code that included the main part (summary) of the code and candidates for domain knowledge related to the code, but did not write non-main parts of the code (including pre-processing parts, for example). In other words, this is a case where the code developer wrote comments to the code that did not include any description of non-main parts of the code.
[0030] The example of Fig. 3 shows that a comment generating function in the comment generation system 102 (model 299 trained by machine learning in Fig. 2) generates both the main part (summary) and the non-main part (including, for example, the preprocessing part) of the code as comments. That is, in the example of Fig. 3, the comment generation system 102 generates generated comment information 113 that is intended to faithfully reflect the code corresponding to the code information 111. To indicate this, in Fig. 3, the generated comment information 113 is also referred to as faithfully generated comment information 1163 (information handled in the second embodiment described below). Some models trained by recent machine learning have the function of translating from one language to another. An example of such a model (the model may be trained or in the process of training) is a generative artificial intelligence (generative AI) using an encoder and a decoder of a transformer. Such a model is good at performing a translation close to a literal translation or a direct translation from one language to another. Here, if a code (e.g., source code) written in a programming language is input to the model and a comment written in a natural language is output from the model, it is possible to obtain a generated comment close to a literal translation or a direct translation by the model. In other words, as shown in FIG. 3, it is quite possible that the generated comment information 113 becomes something like faithful generated comment information 1163. Note that a functional unit for generating comments other than a model trained by machine learning may be used. For example, it is quite possible to generate generated comment information 113 intended to faithfully reflect the code corresponding to the code information 111 by generating comments based on a dictionary or a rule base.
[0031] 3, the first embodiment of the present disclosure can estimate in-code important part information 301 by detecting comment common information 121. Also, the first embodiment of the present disclosure can estimate domain knowledge candidate information 302 by detecting added comment difference information 122. Furthermore, the first embodiment of the present disclosure can estimate in-code non-important part information 303 by detecting generated comment difference information 123.
[0032] 1-3. Overall configuration for realizing the first, second and third embodiments of the present disclosure 2, the comment classification system 100 according to the first embodiment of the present disclosure is capable of communicating with the comment generation system 102. This also applies to the comment classification system 1100 according to the second embodiment of the present disclosure and the comment classification system 2300 according to the third embodiment of the present disclosure, which will be described later. 4 shows an overall configuration for implementing each of the first, second and third embodiments of the present disclosure. As shown in FIG. 4, the comment classification system 100 (1100, 2300) and the comment generation system 102 may be capable of communicating with each other via a network 408. First, the comment classification system 100 (1100, 2300) provides the code information 111 and the generation command 271 (2471) to the comment generation system 102 via the network 408. If the functional unit that generates comments in the comment generation system 102 is a model 299 trained by machine learning, an application programming interface (API) for providing a command to the model 299 may be used. Next, the comment generation system 102 generates externally generated comment information 293 (2493) based on the code information 111 and the generation command 271 (2471). Then, the comment generation system 102 provides the externally generated comment information 293 (2493) to the comment classification system 100 (1100, 2300) via the network 408. It should be noted that the means for realizing the interconnection between the comment categorization system 100 (1100, 2300) and the comment generation system 102 may be something other than the network 408.
[0033] 1-4. Computer architecture for implementing the first, second and third embodiments of the present disclosure 5 shows a computer architecture for realizing each of the first, second, and third embodiments (and the modified example of FIG. 26) of the present disclosure. To realize the comment classification system 100 (1100, 2300, 2600), some or all of an information processing device 501, a storage device 502, a non-volatile recording medium 503, an external recording medium drive 504, an input device 506, a display or output device 507, a communication device 508, and an external input / output port 509 may be interconnected by an interconnection unit 510. The information processing device 501 may be, for example, a processor. Examples of this processor include a CPU, an MPU, or a GPU. Alternatively, the processor here may be another semiconductor device as long as it is a subject that executes a predetermined process. The information processing device 501 may also be one or more (micro)processors. The storage device 502 may be, for example, a memory. The non-volatile recording medium 503 may be, for example, a non-volatile memory (for example, a flash memory) or a non-volatile disk device. The external recording medium drive 504 may be, for example, a disk drive. The input device 506 may be, for example, a mouse, a keyboard, an imaging device, a sensor, a touch panel, or a pointing device. The display or output device 507 may be, for example, a display, a printer, or a speaker. The communication device 508 may be, for example, a communication device for wired communication or a communication device for wireless communication. The communication device 508 may be a network interface device (NIC) that controls communication with other systems, devices, terminals, or servers according to a predetermined protocol. The interconnection unit 510 may be, for example, a bus or a crossbar switch. The non-volatile recording medium 503 may record a program 520a (for example, a program for realizing the functional configuration according to the present disclosure, such as a comment classification program), various databases 521, and various information 522. The various databases 521 may record information handled in the embodiment of the present disclosure (including the code information 111, various comment information, comment common information 121, added comment difference information 122, and generated comment difference information 123). Alternatively, some or all of the information in the above-mentioned program 520a, various databases 521, or various information 522 may be acquired from outside the system shown in FIG. 5. The external recording medium drive 504 can connect to an external recording medium 505. The external recording medium 505 may be, for example, a portable recording disk (such as a DVD), an IC card, an SD card, a non-volatile memory (such as a flash memory), or a portable hard disk. Note that the external recording medium 505 may transfer and store information similar to the program 520a (for example, a program for realizing the functional configuration according to the present disclosure. A comment classification program), various databases 521, or information in various information 522 to the non-volatile recording medium 503 or the storage device 502. The external recording medium 505 may be used to record programs and data handled in the comment classification system. The external recording medium drive 504 and the external recording medium 505 may be connected to the comment classification system via a network. Information on a program 520a (for example, a program for realizing the functional configuration related to the present disclosure; a comment classification program), various databases 521, or various information 222 may be provided via a communication device 508, an external input / output port 509, or an input device 506, and stored in a non-volatile recording medium 503 or a storage device 502. In order for the architecture of FIG. 5 to function as the comment classification system, each functional unit in the comment classification system, or a part of each functional unit (to execute one or a series of processes (steps)), the program 520a may be loaded into the storage device 502 (for example, from the non-volatile recording medium 503). The program after loading is indicated as 520b in FIG. 5. The information processing device 501 may then execute the program 520b (using information of various databases 521 or various information 522 present in the non-volatile recording medium 503, etc., as necessary). By executing the program 520b, the functions of the comment classification system, each functional unit in the comment classification system, or a part of each functional unit are realized (one or a series of processes (steps) are executed). At this time, various buffers 523 temporarily formed in the storage device 502 may also be used as appropriate.
[0034] 1 of 5. Processing performed by the first embodiment of the present disclosure 6 shows a flowchart of the process performed by the first embodiment of the present disclosure. It is not essential to perform all of the process steps shown below. In addition, process steps other than the process steps shown below may also be performed.
[0035] 6, the comment classification system 100 receives (inputs) the commented code information 101. The commented code information 101 includes code information 111 and additional comment information 112. Fig. 7 shows an example of source code 701 with additional comments corresponding to the commented code information 101. As shown in Fig. 7, the source code with additional comments 701 includes source code 711 corresponding to the code information 111 and additional comments 712 corresponding to the additional comment information 112. Note that the source code shown in Fig. 7 and subsequent figures shows something that looks like a program to the extent that the functions to be realized can be understood, and is not source code in a specific programming language. It goes without saying that when a developer actually develops source code, the source code is created based on some programming language.
[0036] According to source code 711 in FIG. 7, the processing subject of function A0 realizes the following functions upon receiving "char s0" (character type variable s0) as an argument. [1] The main processing unit of function A0 is the non-main part (preprocessing part) “s0 = convert_to_safe_value(s0);” (the process of passing s0 to a conversion function to a safe value and overwriting s0 with the safe value received from the conversion function). [2] The processing entity of function A0 performs the main part, “functionA1(s0);” (the process of passing s0 to function A1 as an argument). The additional comments 712 may include one or more of the following: documentation 722, inline comments 732 (or block comments). The roles of the documentation, inline comments, and block comments have been described above.
[0037] The first embodiment of the present disclosure can be applied to commented source code in which source code, documentation, inline comments, or block comments can be written, as shown in Fig. 7. Commented source code in which source code, documentation, inline comments, or block comments can be written is often created by code developers, etc. Therefore, the commented source code to which the first embodiment of the present disclosure can be applied can be made broad. This also applies to the second and third embodiments and modified examples described below.
[0038] Fig. 8 shows a classification of comments included in the documentation 722 shown in Fig. 7. The documentation 722 may include one or more of a code subject description 851 including a summary of the source code and a domain knowledge candidate 852. The code main part description 851 in Fig. 8 succinctly indicates the function of function A0 (functionA0) indicated by source code 711 in Fig. 7. In the example of Fig. 8, the code main part description 851 indicates the function of "functionA1(s0);" (processing of passing s0 as an argument to function A1), which corresponds to the main part of source code 711. Domain knowledge candidate 852 in Fig. 8 indicates reference knowledge of source code 711, although it cannot be directly derived from source code 711 in Fig. 7. In the example of Fig. 8, domain knowledge candidate 852 explains the technical background of the function A0 and indicates points to note when using function A1. Note that reference knowledge of source code (domain knowledge candidate) may be other than that shown in Fig. 8 and may be written as appropriate by the developer of the code, etc. 8, for convenience, the code main part description 851 and the domain knowledge candidates 852 are clearly separated within the documentation 722. However, as shown in the documentation 722 in FIG. 7, in source code with additional comments actually written by a code developer, etc., separate descriptions are not necessarily written within the documentation 722. Therefore, the first embodiment of the present disclosure distinguishes and detects the code main part description 851 and the domain knowledge candidates 852 included in the documentation 722, and controls the display output of comments using the detected information. Of the components constituting the added comment 712 shown in Fig. 7, only the documentation 722 is shown in Fig. 8. To avoid complicating the explanation, the following explanation (including the explanation of the second embodiment and the following embodiments of the present disclosure) will show the processing and display output control for the documentation of the added comment. However, the first embodiment of the present disclosure (and further the second and third embodiments and modified examples of the present disclosure) can also perform the same processing and display output control for the documentation 722 for inline comments and block comments.
[0039] 6, the generation command creation unit 241 creates a generation command 271. The generation command 271 requests a comment generating function unit (e.g., a model 299 trained by machine learning) in the comment generation system 102 to generate externally generated comment information 293 in which the contents of the code (e.g., source code) corresponding to the code information 111 are described in natural language. The generation command 271 in the first embodiment of the present disclosure may request the generation of externally generated comment information 293 intended to faithfully reflect the contents of the code (e.g., source code) corresponding to the code information 111 (intended to be a so-called "literal translation"). (In that sense, the generation command 271 may be similar to the faithful generation command 2473 in the third embodiment of the present disclosure described later.) Alternatively, if the characteristics of the comment generating functional unit (e.g., model 299) in the comment generation system 102 tend to generate externally generated comment information 293 intended to faithfully reflect the content of the input information (intended to be a so-called "literal translation"), the generation command 271 may simply request the generation of externally generated comment information 293 that describes in natural language the content of the code (e.g., source code) corresponding to the code information 111. In step 603 in FIG. 6, the comment generation request unit 242 provides the code information 111 and the generation command 271 (faithful generation command 2473) to a functional unit (eg, model 299) that generates comments in the comment generation system 102. 6, a comment generating function unit (e.g., model 299) in comment generation system 102 generates externally generated comment information 293 based on code information 111 in accordance with the request contents indicated by generation command 271 (faithful generation command 2473). If externally generated comment information 293 is generated that is intended to faithfully reflect the contents of code (e.g., source code) corresponding to code information 111 (intended to be a so-called "literal translation"), then externally generated comment information 293 may be considered to be similar to faithful externally generated comment information 2463 in the second embodiment of the present disclosure described later. In step 605 of FIG. 6, the answer receiving unit 243 receives the externally generated comment information 293 (faithful externally generated comment information 2463) from the comment generating system 102. 6, the answer receiving unit 243 may treat the externally generated comment information 293 (faithful externally generated comment information 2463) as the generated comment information 113. If the generated comment information 113 is intended to faithfully reflect the content of the code (e.g., source code) corresponding to the code information 111 (intended to be a so-called "literal translation"), the generated comment information 113 may be considered to be similar to the faithful generated comment information 1163 in the second and third embodiments of the present disclosure described later.
[0040] Fig. 9 shows the relationship between source code 711 corresponding to code information 111 and generated comments 913 corresponding to generated comment information 113. An example of a generated comment intended to faithfully reflect the content of source code 711 shown in the lower part of Fig. 9 (intended to be a so-called "literal translation") is generated comment 913 shown in the upper part of Fig. 9. In the source code 711, the part "s0 = convert_to_safe_value(s0);" (a process of passing s0 to a conversion function to a safe value and overwriting s0 with the safe value received from the conversion function) corresponds to a non-main part (pre-processing part), and may be regarded as a non-main part in the code 943. Also, in the source code 711, the part "functionA1(s0);" (a process of passing s0 as an argument to function A1) corresponds to a main part, and may be regarded as a main part in the code 941. The generated comments 913 may include generated comments derived from non-main parts of the code 973 and generated comments derived from main parts of the code 971. The generated comments derived from non-main parts of the code 973 are comments written in natural language indicating the contents of the non-main parts of the code 943. The generated comments derived from main parts of the code 971 are comments written in natural language indicating the contents of the main parts of the code 941. In this way, both the contents of the processing of the main parts and the contents of the processing of the non-main parts indicated by the source code 711 may be reflected in the generated comments 913. 9, for convenience, generated comments 973 derived from non-main parts in code and generated comments 971 derived from main parts in code are clearly divided within generated comments 913. However, depending on the function (training contents in the case of model 299) of a functional unit (e.g., model 299 trained by machine learning) that generates comments in comment generation system 102, the above-mentioned division is not necessarily made in externally generated comment information 293 and generated comment information 113. In other words, generated comments 913 may be in a form that includes both generated comments 973 derived from non-main parts in code and generated comments 971 derived from main parts in code without distinguishing between these comments.
[0041] In step 616 (information detection step) of FIG. 6, the information detection unit 244 detects at least one of the comment common information 121, the added comment difference information 122, and the generated comment difference information 123 based on the added comment information 112 and the generated comment information 113 (faithfully generated comment information 1163). The comment common information detection section 251 in the information detection section 244 may detect comment common information 121 consisting of information included in both the added comment information 112 and the generated comment information 113 (faithfully generated comment information 1163). In the example of Figures 8 and 9, the comment common information detection section 251 may detect that the content of the code main part explanation 851 in the added comment 712 in Figure 8 and the content of the generated comment 971 derived from the code main part in the generated comment 913 in Figure 9 are common to each other, and may treat the information corresponding to the common parts as the comment common information 121. The added comment difference information detection unit 252 in the information detection unit 244 may detect added comment difference information 122 consisting of information that is determined to be included in the added comment information 112 but not included in the generated comment information 113 (faithfully generated comment information 1163). In the example of Figures 8 and 9, the added comment difference information detection unit 252 may determine that a domain knowledge candidate 852 in the added comment 712 in Figure 8 is not included in the generated comment 913 in Figure 9, and may set information corresponding to the domain knowledge candidate 852 as the added comment difference information 122. The generated comment difference information detection unit 253 in the information detection unit 244 may detect generated comment difference information 123 consisting of information that is not included in the added comment information 112 but is determined to be included in the generated comment information 113 (faithful generated comment information 1163). In the example of Figures 8 and 9, the generated comment difference information detection unit 253 may determine that a generated comment 973 derived from a non-main part in code, among the generated comments 913 in Figure 9, is not included in the added comment 712 in Figure 8, and may set information corresponding to the generated comment 973 derived from a non-main part in code as the generated comment difference information 123. It is sufficient to detect at least one of the comment common information 121, the added comment difference information 122, and the generated comment difference information 123. Therefore, in the first embodiment of the present disclosure, it is sufficient that at least one of the comment common information detection unit 251, the added comment difference information detection unit 252, and the generated comment difference information detection unit 253 exists and operates.
[0042] 6 (information detection step), each of the comment common information detection unit 251, the added comment difference information detection unit 252, and the generated comment difference information detection unit 253 may determine, for example, the similarity of words or sentences between an added comment corresponding to the added comment information 112 and a generated comment corresponding to the generated comment information 113. Each of the comment common information detection unit 251, the added comment difference information detection unit 252, and the generated comment difference information detection unit 253 may determine, for example, that words or sentences having a similarity score equal to or greater than a threshold value indicate information of the same content. Also, the setting of the threshold value referred to here may be appropriately adjusted by the administrator or user of the comment classification system 100. Note that the similarity may be taken into consideration in the other embodiments and modified examples of the present disclosure. By detecting common parts or differences in information between the added comment information 112 and the generated comment information 113, taking into account the similarity of words or sentences, a detection process can be realized by the comment common information detection unit 251, the added comment difference information detection unit 252, and the generated comment difference information detection unit 253 that is less susceptible to adverse effects from variations in terminology or sentence expression.
[0043] 6 (comment display output control step), the comment display output control unit 245 controls the comment display output 231 based on at least one of the added comment information 112, the comment common information 121, the added comment difference information 122, and the generated comment difference information 123. The comment display output 231 includes a differentiated display output 232. The differentiated display output 232 corresponds to at least one of the comment common information 121, the added comment difference information 122, and the generated comment difference information 123. Further, in conjunction with step 617, the code display output control unit 246 may control the code display output 234 based on the code information 111. Here, the code display output 234 and the comment display output 231 may be integrated into the whole display output 203. 10 shows an example of the overall display output 203. Fig. 10 shows an overall display output 1003 corresponding to the source code with added comments 701 shown in Fig. 7. The overall display output 1003 includes a code display output 1034 that is an example of the code display output 234, and a comment display output 1031 that is an example of the comment display output 231. The comment display output 1031 includes a differentiated display output 1032 that is an example of the differentiated display output 232. In the example of Fig. 10, the differentiated display output 1032 targets the domain knowledge candidates 852 (see Fig. 8) detected as the added comment difference information 122. Also, in the example of Fig. 10, the differentiated display output 1032 is accompanied by modification by underlining the relevant portion. (Note that Fig. 10 shows a case where an inline comment is also a domain knowledge candidate.)
[0044] Such modification stands out, and therefore the viewer of the whole display output 1003 can efficiently recognize the differentiated display output 1032. In the example of Fig. 10, the domain knowledge candidate 852 is underlined, making the domain knowledge candidate 852 stand out. Therefore, the viewer of the whole display output 1003 can efficiently identify and understand the domain knowledge candidate 852.
[0045] The target of the differentiated display output 1032 is not limited to the comment portion corresponding to the added comment difference information 122 (the domain knowledge candidate 852 in the example of FIG. 8). The mode of the differentiated display output 1032 is not limited to modification by underlining. (For example, the mode of the differentiated display output 1032 may be one in which characters of a conspicuous color or an inconspicuous color are used.) Furthermore, the differentiated display output 1032 may have a purpose other than the purpose of efficiently recognizing the differentiated display output 1032 to the viewer of the whole display output 1003. Such a purpose may be, for example, to make any of the differentiated display outputs 1032 difficult to recognize by the viewer of the whole display output 1003. Some examples of the modes that the differentiated display output can take will be described later with reference to FIG. 22, FIG. 23, FIG. 27, and FIG. 28.
[0046] As described above, in the first embodiment of the present disclosure (and further in the second and third embodiments described below), the comment classification system provides code information and a generation command to the comment generation system 102 having a functional unit for generating comments. Then, the comment classification system receives externally generated comment information from the comment generation system 102. Furthermore, the comment classification system obtains generated comment information based on the received externally generated comment information. In this way, there is technical and economic rationality in using existing or future functional parts for generating comments, and building a comment classification system that has other functional parts. For example, with recent advances in machine learning technology (e.g., developments in generative artificial intelligence (generative AI) using technologies such as Transformer), sentences that can be created by models trained by machine learning (which may be models still in the learning process) are becoming more sophisticated. Therefore, using a model trained by machine learning as a functional unit that generates comments can be a shortcut to realizing highly accurate generated comments.
[0047] 2. Second embodiment of the present disclosure In the above section "1. First embodiment of the present disclosure," the processing of the first embodiment of the present disclosure is explained using the case shown in Fig. 3 in which the added comment information 112 includes the in-code main part information 301 and the domain knowledge candidate information 302, but does not include the in-code non-main part information 303 (or includes it to the extent that it does not cause any problems). (It can also be said that the case shown in Fig. 8 in which the added comment 712 (documentation 722) mainly includes the in-code main part explanation 851 and the domain knowledge candidate 852 is used.) However, the content of the added comment may vary depending on the developer of the code who writes the added comment. In other words, as shown in Figures 12, 13, and 14, the added comment information 112 may include part or all of the in-code non-main part information 303 in addition to the in-code main part information 301 and the domain knowledge candidate information 302. (It can also be said that there may be cases where the added comment 1612 (documentation 1622) shown in Figure 17 includes (part or all of) the in-code non-main part description 1753 in addition to the in-code main part description 1751 and the domain knowledge candidate 1752.) The second and third embodiments of the present disclosure deal with the above-mentioned variations in the content of the added comments. Both the second and third embodiments of the present disclosure are common in that they can handle faithfully generated comment information 1163 and dataflow-considered generated comment information 1164 as generated comment information 1113. Among these, in the second embodiment of the present disclosure, the comment classification system 1100 processes externally generated comment information 293 generated by the comment generating system 102, thereby generating dataflow-considered generated comment information 1164. The second embodiment of the present disclosure will be described below. The overall configuration for realizing the second embodiment of the present disclosure has already been described in section "1-3. Overall configuration for realizing the first, second and third embodiments of the present disclosure." In addition, the computer architecture for realizing the second embodiment of the present disclosure has already been described in section "1-4. Computer architecture for realizing the first, second and third embodiments of the present disclosure."
[0048] 2.1 Functional configuration of the second embodiment of the present disclosure FIG. 11 shows a functional configuration of the second embodiment of the present disclosure. It should be noted that not all of the functional configurations shown in FIG. 11 are essential. As is clear from a comparison of FIG. 2 and FIG. 11, the functional configuration of the second embodiment of the present disclosure and the functional configuration of the first embodiment of the present disclosure have many common parts. Therefore, in the following, the functional configuration of the second embodiment of the present disclosure will be mainly described with respect to points that are different from the functional configuration of the first embodiment of the present disclosure. It should be noted that, since the processing of the second embodiment will be described in detail later with reference to the flowchart of FIG. 15 and FIGS. 16 to 23, here, an overview of the functional units, information, and display output shown in FIG. 11 will be briefly described.
[0049] The comment classification system 1100 according to the second embodiment of the present disclosure has an answer receiving unit 1143 (instead of the answer receiving unit 243). The answer receiving unit 1143 may have a transparency unit 1153 and a data flow consideration processing unit 1154. The comment classification system 1100 may handle generated comment information 1113 (instead of the generated comment information 113). The generated comment information 1113 may be faithful generated comment information 1163 or data flow consideration generated comment information 1164. The transmission unit 1153 may directly treat the externally generated comment information 293 received from the comment generation system 102 as faithfully generated comment information 1163. The faithfully generated comment information 1163 may be intended to faithfully reflect the content of the code (e.g., source code) corresponding to the code information 111 (intended as a so-called "literal translation"). The data flow consideration processing unit 1154 processes the externally generated comment information 293 received from the comment generating system 102, and sets the processed information as data flow consideration generated comment information 1164. Here, the data flow consideration processing unit 1154 may use the code information 111. The data flow consideration processing unit 1154 performs processing to delete or reduce information that is estimated to be the code non-main part information 303 in Figures 12, 13, and 14 from the externally generated comment information 293 (information having the same content as the faithfully generated comment information 1163). The data flow consideration processing unit 1154 handles the processed information as data flow consideration generated comment information 1164. The information detection unit 244 may handle faithfully generated comment information 1163 as the generated comment information 1113, or may handle data flow consideration generated comment information 1164. That is, in each of the above cases, at least one of the comment common information 121, the added comment difference information 122, and the generated comment difference information 123 may be detected.
[0050] The comment classification system 1100 may include a non-major part estimated information detection unit 1147. The non-major part estimated information detection unit 1147 may detect the non-major part estimated information 1127 based on the added comment information 112, the (first) added comment difference information 122 (in the case where the faithfully generated comment information 1163 is handled), and the (second) comment common information 121 (in the case where the data flow consideration generated comment information 1164 is handled). The non-major part estimated information detection unit 1147 may delete the information included in the (first) added comment difference information 122 and the information included in the (second) comment common information 121 from the information included in the added comment information 112. The non-major part estimated information detection unit 1147 may treat the information remaining after the deletion as the non-major part estimated information 1127. The non-major part estimated information 1127 is also shown in FIG. 14. The comment classification system 1100 has a comment display output control unit 1145 (instead of the comment display output control unit 245). The comment display output control unit 1145 may handle non-main part estimation information 1127 in addition to the types of information handled by the comment display output control unit 245. The comment display output 1131 (instead of the comment display output 231) controlled by the comment display output control unit 1145 includes a differentiated display output 1132 (instead of the differentiated display output 232). The differentiated display output 1132 may also reflect the non-main part estimation information 1127.
[0051] 2-2. Examples of information handled in the second and third embodiments of the present disclosure 12 and 13 show examples of the relationship between the information included in the added comment information 112 and the information included in the generated comment information 1113. Of these, Fig. 12 shows a case where the generated comment information 1113 is faithfully generated comment information 1163. Fig. 13 shows a case where the generated comment information 1113 is data flow consideration generated comment information 1164. 12 and 13 (different from the example of FIG. 3), the added comment information 112 includes all or a substantial part (if not all) of the in-code non-main part information 303 (in addition to the in-code main part information 301 and the domain knowledge candidate information 302). Such an example may occur when a code developer or the like loosely selects comments to be added to code (e.g., source code) and writes a wide range of added comments.
[0052] 12, in the case where the second and third embodiments of the present disclosure treat the generated comment information 1113 as the faithfully generated comment information 1163, the first added comment difference information 1222 (the added comment difference information 122) may be treated as information that is estimated to be the domain knowledge candidate information 302. The first added comment difference information 1222 is information that is determined to be included in the added comment information 112 but not included in the faithfully generated comment information 1163.
[0053] 13, in the case where the second and third embodiments of the present disclosure use the generated comment information 1113 as the dataflow consideration generated comment information 1164, the second comment common information 1321 (comment common information 121) may be treated as information that is estimated to be the code main part information 301. The second comment common information 1321 is information that is determined to be included in both the added comment information 112 and the dataflow consideration generated comment information 1164. In the second embodiment of the present disclosure, a data flow consideration processing unit 1154 generates data flow consideration generated comment information 1164 by deleting or reducing information that is estimated to be included in non-main part information 303 in the code from externally generated comment information 293 (which is information with content equivalent to faithfully generated comment information 1163). In a third embodiment of the present disclosure described below, the data flow consideration generated comment information 1164 is derived from the data flow consideration externally generated comment information 2464 obtained from the comment generating system 102.
[0054] Here, the data flow consideration generated comment information 1164 is not treated as it is as the main part information in the code 301, but information that is determined to be included in both the data flow consideration generated comment information 1164 and the additional comment information 112 (second comment common information 1321) is treated as information that is presumed to be the main part information in the code 301. By treating the information in this way, the technical knowledge of the code developer, etc. is reflected in the detection (estimation) of the code main part information 301. In other words, even if the accuracy of the comments generated by the comment generation system 102 is not yet sufficient to use the comments as they are, it is expected that reliable information that is estimated to be the code main part information 301 can be obtained.
[0055] Fig. 14 shows the results of classification of comment information performed by the second and third embodiments of the present disclosure. In the second and third embodiments of the present disclosure, non-main part estimation information 1427 (1127) may be obtained by deleting the information included in the first added comment difference information 1222 shown in Fig. 12 and the information included in the second comment common information 1321 shown in Fig. 13 from the added comment information 112. As described above, even if the additional comment information 112 corresponds to an additional comment written broadly by a developer of the code, the second and third embodiments of the present disclosure can appropriately classify the additional comment information 112 into information estimated to be each of the important part information in the code 301, the domain knowledge candidate information 302, and the non-important part information in the code 303. The accuracy of the above-mentioned comment classification depends on the added comment information 112, which depends on the way the added comment is written by the code developer, etc., and on various generated comment information, which depends on the accuracy of comment generation by the comment generating functional unit (e.g., a model trained by machine learning) and the accuracy of processing by the data flow consideration processing unit 1154. However, even if the accuracy of the above-mentioned comment classification is not perfect, the proportion of domain knowledge candidate information 302 included in the first added comment difference information 1222, the proportion of in-code important part information 301 included in the second comment common information 1321, and the proportion of in-code non-important part information 303 included in the non-important part estimation information 1427 (1127) can be expected to be at a level sufficient for practical use.
[0056] The second and third embodiments of the present disclosure can classify comment information as shown in FIG. 14, and can therefore provide a comment display output 1131 that is in line with the purpose of the comment viewer in even more cases than those described using FIG. 3.
[0057] Furthermore, even if the relationship between the information contained in the added comment information 112 and the information contained in the generated comment information 1113 differs from that shown in Figures 12, 13, and 14, the second and third embodiments of the present disclosure can be used.
[0058] 2-3. Processing performed by the second embodiment of the present disclosure 15 shows a flowchart of the process performed by the second embodiment of the present disclosure. It is not essential to perform all of the process steps shown below. In addition, process steps other than the process steps shown below may also be performed. In the second embodiment of the present disclosure, steps 1501 to 1505 in Fig. 15 may be executed similarly to the steps 601 to 605 in Fig. 6. However, in the following description, the examples in Fig. 16 and Fig. 17 are used as source code with additional comments 1601 corresponding to the commented code information 101. Accordingly, in the following description, the example in Fig. 18 is used as externally generated comments 1893 (faithful externally generated comments) corresponding to the externally generated comment information 293 generated by the comment generating system 102.
[0059] 16 shows an example of source code 1601 with an added comment corresponding to the commented code information 101. As shown in FIG. 16, the source code 1601 with an added comment includes source code 1611 corresponding to the code information 111 and an added comment 1612 corresponding to the added comment information 112. According to source code 1611 in FIG. 16, the processing subject of function B realizes the following functions upon receiving "char account" (character type variable account) as an argument. [1] The processing entity of function B performs the non-main part (pre-processing part) “original_profile_image = load_original_profile_image(account);” (the process of loading the original profile image (original profile image) original_profile_image corresponding to the account). [2] The main processing unit of function B performs the non-main part (pre-processing part) “trimmed_profile_image = trim_profile_image(original_profile_image, account);” (the process of passing the original profile image original_profile_image and account to the function trim_profile_image and receiving the trimmed image trimmed_profile_image from the function trim_profile_image). [3] The processing entity of function B is the main part, “show_profile_image(trimmed_profile_image);” (the process of displaying the trimmed image, trimmed_profike_image, as the profile image). The additional comment 1612 may include one or more of the documentation 1622, the inline comment, and the block comment. However, to avoid complicating the explanation, the following will discuss only the documentation 1622 among the various comments included in the additional comment 1612. Although not mentioned below, the same processing and display output control performed for the documentation 1622 may also be performed for the inline comment or the block comment.
[0060] Fig. 17 shows a classification of comments included in the documentation 1622 shown in Fig. 16. The documentation 1622 may include one or more of an in-code main part description 1751 including a summary of the source code, a domain knowledge candidate 1752, and an in-code non-main part description 1753. (Unlike Fig. 8, an in-code non-main part description is shown in the documentation.) The code main part description 1751 in Fig. 17 succinctly indicates the functionality of function B indicated by source code 1611 in Fig. 16. In the example of Fig. 17, the code main part description 1751 mainly describes the functionality of "show_profile_image(trimmed_profile_image);" (processing for displaying the trimmed image trimmed_profike_image as a profile image), which corresponds to the main part of source code 1611. A domain knowledge candidate 1752 in FIG. 17 indicates reference knowledge regarding the source code 1611, although it cannot be directly derived from the source code 1611 in FIG. 16. In the example of FIG. 17, the domain knowledge candidate 1752 is a content that explains an overview of image shaping performed by the function trim_profile_image called from the function B indicated by the source code 1611. More specifically, the fact that the "shape-processed image (image after shaping)" passed by the function trim_profile_image to the function B is controlled to be shaped into a square or a circle depending on whether the account has a predetermined attribute (commercial paid plan user) is presented as domain knowledge. Note that the reference knowledge of the code (domain knowledge candidate) may be other than that shown in FIG. 17 and may be appropriately described by the developer of the code, etc. A non-essential part description 1753 in the code in Fig. 17 indicates a non-essential part process (pre-processing part) executed in function B indicated by source code 1611 in Fig. 16. In the example of Fig. 17, a non-essential part description 1753 in the code indicates the non-essential part (pre-processing part) of source code 1611, namely, "original_profile_image = load_original_profile_image(account);" (processing of loading an original profile image (original profile image) original_profile_image corresponding to account) and "trimmed_profile_image = trim_profile_image(original_profile_image, account);" (processing of passing the original profile image original_profile_image and account to the function trim_profile_image and receiving the trimmed image trimmed_profile_image from the function trim_profile_image). As in the examples of Figures 16 and 17, when a code developer writes additional comments 1612 without consciously distinguishing between the main and non-main parts (e.g., preprocessing parts) of the processing steps in source code 1611, the additional comments 1612 may contain many of the above-mentioned explanations 1753 of the non-main parts of the code. 17, for convenience, the code main part description 1751, the domain knowledge candidates 1752, and the code non-main part description 1753 are clearly divided within the documentation 1622. However, as shown in the documentation 1622 in FIG. 16, the source code with added comments actually written by the code developer, etc., is not necessarily written in a divided manner. Therefore, the second embodiment (and the third embodiment) of the present disclosure distinguishes between the code main part description 1751, the domain knowledge candidates 1752, and the code non-main part description 1753 included in the documentation 1622, detects (estimates), and displays (estimates), and controls the display output of comments using the detected information.
[0061] FIG. 18 shows the relationship between source code 1611 corresponding to code information 111 and externally generated comment 1893 corresponding to externally generated comment information 293. If externally generated comment information 293 is intended to faithfully reflect the content of code (e.g., source code) corresponding to code information 111 (intended to be a so-called "literal translation"), externally generated comment information 293 may be called faithful externally generated comment information. Here, the content of externally generated comment information 293 and faithfully generated comment information 1163 are equivalent. Therefore, FIG. 18 also shows the relationship between source code 1611 corresponding to code information 111 and faithfully generated comment 1813 corresponding to faithfully generated comment information 1163. An example of an externally generated comment or faithfully generated comment intended to faithfully reflect the content of source code 1611 shown in the lower part of FIG. 18 (intended to be a so-called "literal translation") is externally generated comment 1893 or faithfully generated comment 1813 shown in the upper part of FIG. 18. In the source code 1611, the parts "original_profile_image = load_original_profile_image(account);" (a process for loading the original profile image (original profile image) original_profile_image corresponding to account) and "trimmed_profile_image = trim_profile_image(original_profile_image, account);" (a process for passing the original profile image original_profile_image and account to the function trim_profile_image and receiving the shaped image trimmed_profile_image from the function trim_profile_image) are non-main parts (pre-processing parts), and may be regarded as non-main parts in the code 1843. Also, in the source code 1611, the part "show_profile_image(trimmed_profile_image);" (a process for displaying the shaped image trimmed_profike_image as the profile image) is a main part, and may be regarded as main part in the code 1841. The externally generated comments 1893 or the faithfully generated comments 1813 may include generated comments derived from non-main parts in the code 1873 and generated comments derived from main parts in the code 1871. The generated comments derived from non-main parts in the code 1873 are comments in natural language indicating the contents of the non-main parts in the code 1843. The generated comments derived from main parts in the code 1871 are comments in natural language indicating the contents of the main parts in the code 1841. In this way, both the contents of the processing of the main parts and the contents of the processing of the non-main parts of the source code 1611 may be reflected in the externally generated comments 1893 or the faithfully generated comments 1813. 18, for convenience, generated comments 1873 derived from non-main parts in code and generated comments 1871 derived from main parts in code are clearly distinguished within the externally generated comments 1893 or faithfully generated comments 1813. However, depending on the function (training contents in the case of the model 299) possessed by a functional unit (e.g., a model 299 trained by machine learning) that generates comments in the comment generation system 102, the above-mentioned distinction is not necessarily made in the externally generated comment information 293 or the faithfully generated comment information 1163. In other words, the externally generated comments 1893 or faithfully generated comments 1813 may be in a mode that includes both the generated comments 1873 derived from non-main parts in code and the generated comments 1871 derived from main parts in code without distinguishing between these comments.
[0062] When the comment generation system 102 generates externally generated comment information 293 (externally generated comment 1893) as shown in FIG. 18, and the comment classification system 1100 receives the externally generated comment information 293 (externally generated comment 1893), the processing steps from step 1506 onwards in FIG. 15 are performed. In step 1506 of FIG. 15, the transparency unit 1153 may treat the externally generated comment information 293 received from the comment generation system 102 as faithfully generated comment information 1163.
[0063] 15, the data flow consideration processing unit 1154 may process the externally generated comment information 293 and set the processed information as data flow consideration generated comment information 1164. Here, the data flow consideration processing unit 1154 may use the code information 111. The data flow consideration processing unit 1154 processes the externally generated comment information 293 to delete or reduce information that is estimated to be the in-code non-main part information 303 in FIGS. 12, 13, and 14.
[0064] Fig. 19 shows an example of the relationship between externally generated comment information 293 and comment information generated in consideration of data flow 1164. Fig. 19 shows the relationship between externally generated comment information 293 and comment information generated in consideration of data flow 1164 (comment information generated in consideration of data flow 1964 in Fig. 19) for a code sequence 1911 having a serial data flow among code sequences included in the source code corresponding to the code information 111. In the example of FIG. 19, code sequence 1911 having a serial data flow includes code α, code β, and code γ. Code α may correspond to a function involving reflecting information A to information B. Code β may correspond to a function involving reflecting information B to information C. Code γ may correspond to a function involving reflecting information C to information D. In other words, in the flow of information transmission (data flow) of code sequence 1911, codes α, β, and γ are in a serial relationship. Here, codes α and β may be presumed to correspond to non-main parts (pre-processing parts), and code γ to correspond to the main part. 19, when externally generated comment information 293 is generated with the intention of faithfully reflecting the contents of code sequence 1911, externally generated comment information 293 may include code α corresponding comment information 1921, code β corresponding comment information 1922, and code γ corresponding comment information 1923. As described above, in view of the data flow of code sequence 1911, code α and code β are presumed to be non-main parts (pre-processing parts). Therefore, comment information for succinctly explaining the function of code sequence 1911 in consideration of the data flow may be regarded as code γ corresponding comment information 1923. In other words, code γ corresponding comment information 1923 may be regarded as data flow consideration generated comment information 1964.
[0065] Fig. 20 shows an example of the relationship between externally generated comment information 293 and comment information generated in consideration of data flow 1164. Fig. 20 shows the relationship between externally generated comment information 293 and comment information generated in consideration of data flow 1164 (comment information generated in consideration of data flow 2064 in Fig. 20) for a code string 2011 having a parallel data flow among code strings included in the source code corresponding to the code information 111. In the example of FIG. 20, the code sequence 2011 having parallel data flows includes code δ, code ε, and code ζ. Code δ may correspond to a function involving reflecting information P in information S. Code ε may correspond to a function involving reflecting information Q in information S. Code ζ may correspond to a function involving matching information R to information S. For example, information S may be for holding various data for display output. In other words, the process indicated by code sequence 2011 may be a process in which information P, information Q, and information R are all reflected in information S, and the contents of information S are displayed and output. In the flow of information transmission (data flow) of code sequence 2011, code δ, code ε, and code ζ are in a parallel relationship. Therefore, it may be presumed that code δ, code ε, and code ζ all correspond to the main parts. In the example of FIG. 20, when the externally generated comment information 293 is generated with the intention of faithfully reflecting the contents of the code string 2011, the externally generated comment information 293 may include the code δ corresponding comment information 2021, the code ε corresponding comment information 2022, and the code ζ corresponding comment information 2023. As described above, in view of the data flow of the code string 2011, none of the code δ, the code ε, and the code ζ is presumed to be a non-main part (pre-processing part). Therefore, the comment information for succinctly explaining the function of the code string 2011 in consideration of the data flow may be the code δ corresponding comment information 2021, the code ε corresponding comment information 2022, and the code ζ corresponding comment information 2023. In other words, the code δ corresponding comment information 2021, the code ε corresponding comment information 2022, and the code ζ corresponding comment information 2023 may be the data flow consideration generated comment information 1964.
[0066] 15, the data flow consideration processing unit 1154 may recognize a part of a code string having a serial data flow as shown in Fig. 19 and a part of a code string having a parallel data flow as shown in Fig. 20, which are inherent in the code (e.g., source code) indicated by the code information 111 or the code that can be reproduced from the externally generated comment information 293. The data flow consideration processing unit 1154 may detect (estimate) information to be included in the data flow consideration generated comment information 1164 for each of the recognized code strings having a serial data flow and code strings having a parallel data flow.
[0067] FIG. 21 shows an example of a dataflow consideration generated comment 2164 corresponding to the dataflow consideration generated comment information 1164. FIG. 21 shows a dataflow consideration generated comment 2164 generated for the source code 1611 shown in FIG. 16 (corresponding to the code information 111). The dataflow consideration processing unit 1154 of the second embodiment of the present disclosure generates the dataflow consideration generated comment 2164 shown in the upper part of FIG. 21 (corresponding to the dataflow consideration generated comment information 1164) based on the externally generated comment 1893 shown in the upper part of FIG. 18 (corresponding to the externally generated comment information 293). (Note that in the third embodiment of the present disclosure, the comment generating system 102 generates the dataflow consideration generated comment 2164 based on the source code 1611.) 21, dataflow consideration generated comment information 1164 includes a generated comment 1871 derived from a main part in the code, but does not include a generated comment 1873 derived from a non-main part in the code. When dataflow consideration processing unit 1154 estimates the code of the main part and the code of the non-main part by taking into account the data flow in the code, the estimation result is not required to have perfect accuracy. Therefore, it is permissible for dataflow consideration generated comment information 1164 to include a small amount of information regarding comments in the non-main part in the code.
[0068] 15, the added comment difference information detection unit 252 detects the added comment difference information 122 (first added comment difference information 1222) based on the added comment information 112 and the faithfully generated comment information 1163. The first added comment difference information 1222 is made up of information that is determined to be included in the added comment information 112 but not included in the faithfully generated comment information 1163. In the example of the added comment 1612 (corresponding to the added comment information 112) in FIG. 17 and the example of the faithfully generated comment 1813 (corresponding to the faithfully generated comment information 1163) in FIG. 18, the added comment difference information detection unit 252 may detect information corresponding to the domain knowledge candidate 1752 in FIG. 17 as the first added comment difference information 1222. 15, the comment common information detection unit 251 detects the comment common information 121 (second comment common information 1321) based on the added comment information 112 and the dataflow consideration generated comment information 1164. The second comment common information 1321 is made up of information determined to be included in both the added comment information 112 and the dataflow consideration generated comment information 1164. In the example of the added comment 1612 (corresponding to the added comment information 112) in FIG. 17 and the example of the dataflow consideration generated comment 2164 (corresponding to the dataflow consideration generated comment information 1164) in FIG. 21, the comment common information detection unit 251 may detect information corresponding to the code main part description 1751 in FIG. 17 or information corresponding to the code main part-derived generated comment 1871 in FIG. 21 as the second comment common information 1321. In step 1515 of FIG. 15, the non-important part estimation information detection unit 1147 detects the non-important part estimation information 1127 (or 1427) based on the added comment information 112, the first added comment difference information 1222, and the second comment common information 1321. The non-important part estimation information 1127 (1427) may be information remaining after the information included in the first added comment difference information 1222 and the information included in the second comment common information 1321 are deleted from the information included in the added comment information 112. In the example of the added comment 1612 (corresponding to the added comment information 112) in FIG. 17, the non-important part estimation information detection unit 1147 may detect information corresponding to the comment portion remaining after the domain knowledge candidate 1752 (corresponding to the first added comment difference information 1222) and the in-code main part description 1751 (corresponding to the second comment common information 1321) are deleted from the added comment 1612. As a result, the non-main part inferred information detection unit 1147 may detect information corresponding to the in-code non-main part description 1753 as the non-main part inferred information 1127 (1427). Through the above steps 1513, 1514 and 1515, the added comment information 112 is classified into the second comment common information 1321, the first added comment difference information 1222 and the non-main part estimated information 1127 (1427) as shown in FIG.
[0069] 15, the comment display output control unit 1145 controls the comment display output 1131 based on at least one of the added comment information 112, the second comment common information 1321, the first added comment difference information 1221, and the non-main part estimation information 1127 (1427). Here, the comment display output 1131 includes a differentiated display output 1132. The differentiated display output 1132 corresponds to at least one of the second comment common information 1321, the first added comment difference information 1222, and the non-main part estimation information 1127 (1427). Further, in conjunction with step 1517, the code display output control unit 246 may control the code display output 234 based on the code information 111. Here, the code display output 234 and the comment display output 1131 may be integrated into the whole display output 1103.
[0070] Fig. 22 shows a first example of the overall display output 1103. Fig. 22 shows an overall display output 2203 corresponding to the source code with added comments 1601 shown in Fig. 16. Overall display output 2203 includes code display output 2234, which is an example of code display output 234, and comment display output 2231, which is an example of comment display output 1131. Comment display output 2231 may include differentiated display outputs 2232, 2242, and 2252, which are examples of differentiated display output 1132. The differentiated display output 2232 targets the domain knowledge candidate 1752 (see FIG. 17) corresponding to the information detected as the first added comment difference information 1221. The differentiated display output 2232 is modified by underlining the relevant portion. The differentiated display output 2242 targets the code main part explanation 1751 corresponding to the information detected as the second comment common information 1321. The differentiated display output 2242 is decorated by enclosing the relevant portion in a frame. The differentiated display output 2252 targets the in-code non-important part explanation 1753 corresponding to the information detected as the non-important part estimated information 1127 (1427). The differentiated display output 2252 hides the relevant part or masks it with a predetermined color.
[0071] When the relevant portion is modified by underlining or by surrounding it with a frame, it stands out, and therefore the viewer of the overall display output 2203 can efficiently recognize the differentiated display outputs 2232 and 2242. In the example of Fig. 22, the domain knowledge candidate 1752 is underlined, and the description of the main part of the code 1751 is surrounded by a frame. Therefore, since the domain knowledge candidate 1752 and the description of the main part of the code 1751 stand out, the viewer of the overall display output 2203 can efficiently distinguish and understand the domain knowledge candidate 1752 and the description of the main part of the code 1751.
[0072] On the other hand, since the differentiated display output 2252 hides the relevant portion or masks the relevant portion with a predetermined color, the viewer of the entire display output 2203 can eliminate or reduce the effort spent in recognizing the portion where the differentiated display output 2252 is made. In the example of Fig. 22, the description 1753 of the non-important part in the code is hidden or masked with a predetermined color. Therefore, the viewer of the entire display output 2203 can eliminate or reduce the effort spent in recognizing the description 1753 of the non-important part in the code.
[0073] The mode of the differentiated display output for efficiently recognizing the relevant portion for the viewer of the whole display output 2203 is not limited to the mode of modification by underlining or framing. For example, the mode of the differentiated display output for efficiently recognizing the relevant portion may be a mode in which the color of the text in the relevant portion is made conspicuous (for example, red). Furthermore, the mode of the differentiated display output for eliminating or reducing the effort required for the viewer of the overall display output 2203 to recognize the relevant portion (for example, making the relevant portion less noticeable) is not limited to making the relevant portion invisible or masking the relevant portion with a predetermined color. For example, it may be a mode in which the darkness of the characters in the relevant portion is lightened or the color of the characters in the relevant portion is made less noticeable (for example, light blue, blue, or gray). Furthermore, the type of comment (information) for which a differentiated display output is performed and the mode of the differentiated display output may be combined in any manner.
[0074] Fig. 23 shows a second example of the overall display output 1103. Fig. 23 shows an overall display output 2303 corresponding to the source code with added comments 1601 shown in Fig. 16. The following mainly describes the differences from Fig. 22. In the whole display output 2303 in FIG. 23, the domain knowledge candidate 1752 is displayed in a separate window as shown by a differentiated display output 2362 (instead of the underlining modification as shown in the differentiated display output 2232 in FIG. 22).
[0075] Since the separate window display output stands out, the viewer of the overall display output 2303 can efficiently recognize the differentiated display output 2362.
[0076] When the comment is output and displayed in a separate window, the comment display output control unit 1145 may perform control to leave the comment (domain knowledge candidate 1752 in FIG. 23) that is the subject of the separate window output in the location where it was originally written, or may delete the comment from the location where it was originally written. Moreover, the subject of the separate window display output is not limited to the domain knowledge candidate 1752, but may be any type of comment (information).
[0077] As described above, the second embodiment of the present disclosure enables the comment classification system to treat externally generated comment information received from the comment generation system as faithfully generated comment information, and also to obtain data flow-aware generated comment information from the externally generated comment information. Therefore, when a comment generating functional unit within a comment generation system generates externally generated comment information intended to faithfully reflect the content of the code corresponding to the code information, after the comment classification system receives the externally generated comment information, it can appropriately process the content of the externally generated comment information to obtain the necessary information.
[0078] 3. Third embodiment of the present disclosure The third embodiment of the present disclosure is similar to the second embodiment of the present disclosure in that it deals with fluctuations in the content of the added comments. The third embodiment of the present disclosure is similar to the second embodiment of the present disclosure in that it can handle faithfully generated comment information 1163 and data flow consideration generated comment information 1164 as generated comment information 1113. In the third embodiment of the present disclosure, the comment classification system can receive from the comment generation system each of externally generated comment information that can be handled as faithfully generated comment information 1163 and externally generated comment information that can be handled as data flow consideration generated comment information 1164 by adjusting the content of the generation command provided from the comment classification system to the comment generation system. The third embodiment of the present disclosure will be described below. An example of information handled in the third embodiment of the present disclosure has already been described in the section "2-2. Examples of information handled in the second and third embodiments of the present disclosure". The overall configuration for realizing the third embodiment of the present disclosure has already been described in the section "1-3. Overall configuration for realizing the first, second and third embodiments of the present disclosure". In addition, the computer architecture for realizing the third embodiment of the present disclosure has already been described in the section "1-4. Computer architecture for realizing the first, second and third embodiments of the present disclosure".
[0079] 3.1 Functional configuration of the third embodiment of the present disclosure FIG. 24 shows the functional configuration of the third embodiment of the present disclosure. It should be noted that not all of the functional configurations shown in FIG. 24 are essential. As is clear from a comparison of FIG. 11 and FIG. 24, the functional configuration of the third embodiment of the present disclosure and the functional configuration of the second embodiment of the present disclosure have many common parts. Therefore, in the following, the functional configuration of the third embodiment of the present disclosure that is different from the functional configuration of the second embodiment of the present disclosure will be mainly described. It should be noted that, since the processing of the third embodiment will be described in detail later with reference to the flowchart of FIG. 25, here, the outline of the functional units, information, and commands shown in FIG. 24 will be briefly described. The comment classification system 2300 according to the third embodiment of the present disclosure shown in FIG. 24 may have a generation command creation unit 2441 (instead of the generation command creation unit 241). The generation command creation unit 2441 may have a faithful generation command creation unit 2453 and a data flow consideration generation command creation unit 2454. The faithful generation command creation unit 2453 may generate a faithful generation command 2473. The faithful generation command 2473 may be for requesting the generation of faithful externally generated comment information 2463, which is created with the intention of faithfully reflecting the contents of the code corresponding to the code information 111. The data flow consideration generation command creation unit 2454 may generate a data flow consideration generation command 2474. The data flow consideration generation command 2474 may be for requesting the generation of data flow consideration externally generated comment information 2464, which is created to reflect a part estimated to be the main part of the code (e.g., source code) corresponding to the code information 111, taking into consideration the data flow in the code. The faithful generate commands 2473 and the data flow aware generate commands 2474 may be collectively referred to as generate commands 2471 . The comment classification system 2300 may include a comment generation request unit 2442 (instead of the comment generation request unit 242). The comment generation request unit 2442 may provide the code information 111 and faithful generation commands 2473 to a comment generating function unit (e.g., model 299 trained by machine learning) in the comment generation system 102. The comment generation request unit 2442 may provide the code information 111 and data flow consideration generation commands 2474 to a comment generating function unit (e.g., model 299) in the comment generation system 102. A comment generating function unit (e.g., model 299) in the comment generation system 102 may generate faithful externally generated comment information 2463 when given code information 111 and faithful generation command 2473. Also, a comment generating function unit (e.g., model 299) in the comment generation system 102 may generate dataflow-aware externally generated comment information 2464 when given code information 111 and dataflow-aware generation command 2474. The faithful externally generated comment information 2463 and the data flow considerate externally generated comment information 2464 may be collectively referred to as externally generated comment information 2493 . The comment classification system 2300 may have an answer receiver 243 (similar to that in the first embodiment of the present disclosure). The answer receiver 243 may treat the faithful externally generated comment information 2463 received from the comment generation system 102 as the faithfully generated comment information 1163. The answer receiver 243 may treat the data flow consideration externally generated comment information 2464 received from the comment generation system 102 as the data flow consideration generated comment information 1164. After the faithfully generated comment information 1163 and the data flow consideration generated comment information 1164 are obtained, the processing and display output control aspects of the third embodiment of the present disclosure may be similar to the processing and display output control aspects of the second embodiment of the present disclosure already described.
[0080] 3-2. Processing performed by the third embodiment of the present disclosure 25 shows a flowchart of the process of the third embodiment of the present disclosure. It is not essential to perform all of the process steps shown below. Also, process steps other than the process steps shown below may be performed. In step 2501 of Fig. 25, the comment classification system 2300 receives (inputs) commented code information 101. The commented code information 101 includes code information 111 and added comment information 112. The source code 1611 corresponding to the code information 111 and the added comment 1612 corresponding to the added comment information 112 may be, for example, as shown in the example of Fig. 16. Note that in the example of Fig. 16, the added comment 1612 includes documentation 1622, but the added comment 1612 may also include an inline comment or a block comment. 25, the faithful generation command creation unit 2453 may create a faithful generation command 2473. The faithful generation command 2473 requests a comment generating function unit (e.g., a model 299 trained by machine learning) in the comment generation system 102 to generate faithful externally generated comment information 2463 in which the contents of the code (e.g., source code) corresponding to the code information 111 are described in natural language. The faithful generation command 2473 may be a request to generate faithful externally generated comment information 2463 intended to faithfully reflect the contents of the code, by explicitly indicating the intention (option setting). Alternatively, if, due to the characteristics of the comment generating functional section (e.g., model 299) in comment generation system 102, if no option is set in the generation command, there is a tendency for faithful externally generated comment information 2463 intended to faithfully reflect the content of the input information (intended to be a so-called "literal translation") to be generated, then faithful generation command 2473 may simply request the generation of externally generated comment information 2493 in natural language that indicates the content of the code (e.g., source code) corresponding to code information 111. In step 2503 of FIG. 25, the comment generation request unit 2442 provides the code information 111 and a faithful generation command 2473 to a functional unit (eg, the model 299) that generates a comment in the comment generation system 102. In step 2504 of FIG. 25, a functional unit (e.g., model 299) for generating comments in the comment generation system 102 generates faithful externally generated comment information 2463 based on the code information 111 according to the request contents indicated by the faithful generation command 2473. The faithful externally generated comment information 2463 is generated with the intention of faithfully reflecting the contents of the code (e.g., source code) corresponding to the code information 111 (intended as a so-called "literal translation"). However, since the degree of training of the model 299 varies, it is expected that there will be some difference between the contents expressed by the faithful externally generated comment information 2463 and the contents of the code (e.g., source code) corresponding to the code information 111. For example, for the source code 1611 (corresponding to the code information 111) shown in the lower part of FIG. 18, the faithful externally generated comment 1893 (corresponding to the faithful externally generated comment information 2463) shown in the upper part of FIG. 18 may be generated. In step 2505 of FIG. 25, the reply receiving unit 243 receives faithful externally generated comment information 2463 from the comment generating system 102 . 25, the answer receiving unit 243 may treat the faithful externally generated comment information 2463 as the faithfully generated comment information 1163. Note that since the degree of training of the model 299 varies, it is expected that there will be some difference between the content expressed by the faithfully generated comment information 1163 and the content of the code (e.g., source code) corresponding to the code information 111.
[0081] In step 2507 of FIG. 25, the data flow consideration generation command creation unit 2454 may create a data flow consideration generation command 2474. The data flow consideration generation command 2474 may request a comment generating function unit (e.g., model 299) in the comment generating system 102 to generate data flow consideration externally generated comment information 2464 in which a comment of contents estimated to be a main part of the code (e.g., source code) corresponding to the code information 111 is described in natural language in consideration of a data flow in the code. The data flow consideration generation command 2474 may include a description of contents instructing a comment generating function unit (e.g., model 299) to recognize, for example, a part of a code string having a serial data flow as shown in FIG. 19 and a part of a code string having a parallel data flow as shown in FIG. 20, which are contained in the code (e.g., source code) indicated by the code information 111. In addition, the data flow consideration generation command 2474 may include a description of content that instructs a functional unit that generates comments (e.g., model 299) to detect (estimate) information to be included in the data flow consideration externally generated comment information 2464, for each of the recognized code strings having serial data flow and code strings having parallel data flow. In step 2508 of FIG. 25, the comment generation request unit 2442 provides the code information 111 and the data flow consideration generation command 2474 to a functional unit (eg, the model 299) that generates a comment in the comment generation system 102. In step 2509 of FIG. 25, a functional unit (e.g., model 299) for generating a comment in the comment generating system 102 generates dataflow-considered externally generated comment information 2464 based on the code information 111 in accordance with the request content indicated by the dataflow-considered generation command 2474. The dataflow-considered externally generated comment information 2464 is a comment in natural language that is estimated to be the main part of the code (e.g., source code) corresponding to the code information 111, taking into consideration the dataflow in the code. However, since the training level of the model 299 varies, it is expected that there will be some difference between the content expressed by the dataflow-considered externally generated comment information 2464 and the content of the main part in the code (e.g., source code) corresponding to the code information 111. For example, the dataflow-considered externally generated comment 2194 (corresponding to the dataflow-considered externally generated comment information 2464) shown in the upper part of FIG. 21 may be generated for the source code 1611 (corresponding to the code information 111) shown in the lower part of FIG. 21. In step 2510 of FIG. 25, the answer receiving unit 243 receives the data flow consideration externally generated comment information 2464 from the comment generating system 102. 25, the answer receiving unit 243 may treat the dataflow consideration externally generated comment information 2464 as the dataflow consideration generated comment information 1164. Note that since the training level of the model 299 varies, it is expected that there will be some difference between the content expressed by the dataflow consideration generated comment information 1164 and the content of the main part of the code (e.g., source code) corresponding to the code information 111.
[0082] After the faithfully generated comment information 1163 and the data flow consideration generated comment information 1164 are obtained, in steps 2513, 2514, 2515, and 2517 of FIG. 25, in the third embodiment of the present disclosure, processing steps similar to the processing steps 1513, 1514, 1515, and 2517 of FIG. 15 may be executed.
[0083] As described above, in the third embodiment of the present disclosure, the comment classification system 2300 adjusts the content of the generation command to be given to a comment generating function unit (e.g., model 299 trained by machine learning) in the comment generation system 102. Therefore, when a comment generating function unit (e.g., model 299) capable of receiving the specification of an option when creating a comment and generating an externally generated comment according to the specification of the option is available (from the viewpoint of the comment classification system), the comment classification system does not need to have a function for processing externally generated comment information. In other words, the functional configuration of the comment classification system can be simplified.
[0084] 4.Other (variations) The present disclosure is not limited to the above-described embodiment, but includes various modifications. A part of the configuration or processing of the embodiment may be replaced with the configuration or processing of another conceivable embodiment. The configuration or processing of the embodiment may be added to the configuration or processing of another conceivable embodiment. For example, the present disclosure may have the following modified embodiments.
[0085] (1) A variant in which the comment generation function is built into the comment classification system In the first, second and third embodiments of the present disclosure, the comment classification system itself does not have a functional unit for generating comments. Instead, the comment classification system gives a generation command to a functional unit for generating comments (e.g., a model 299 trained by machine learning) in the comment generation system 102, and obtains externally generated comment information as a response. However, in a variant, the comment classification system may have a functionality for generating comments. Fig. 26 shows a modified example in which the comment classification system has a built-in functional unit for generating comments. As is clear from a comparison of Fig. 11 and Fig. 26, the functional configuration of this modified example has many parts in common with the functional configuration of the second embodiment of the present disclosure. Therefore, the following mainly describes the points of the functional configuration of this modified example that are different from the functional configuration of the second embodiment of the present disclosure. The comment classification system 2600 in this modified example has a built-in function unit for generating comments. The comment generation function unit may be, for example, a model 2699 trained by machine learning. Accordingly, the comment classification system 2600 does not need to have the comment generation request unit 242 that is included in FIG. 11. The comment classification system 2600 may have a generation command creation unit 2641 (instead of the generation command creation unit 241). The generation command creation unit 2641 creates a generation command 2671 to be provided to the model 2699. The generation command 2671 may have contents similar to the faithful generation command 2473 or the data flow consideration generation command 2474 in the third embodiment of the present disclosure. The model 2699 generates generated comment information 2613 for the code information 111 according to the instructions of the generation command 2671 . The comment classification system 2600 may have an adjustment unit 2643 that adjusts the content of the generated comment information 2613. The adjustment unit 2643 may adjust the generated comment information 2613 output from the model 2699 by using information included in the code information 111. The adjustment unit 2643 may be capable of realizing a function similar to the function of the data flow consideration processing unit 1154 in the second embodiment of the present disclosure (a function of processing information so as to become information similar to the data flow consideration generated comment information 1164). Note that the comment classification system 2600 may have only one of the function of the generation command creation unit 2641 to generate a generation command 2671 having instruction contents similar to the data flow consideration generation command 2474 and the function of the adjustment unit 2643 to process information so as to become information similar to the data flow consideration generated comment information 1164. The processing and display output control performed by the modified example after the generated comment information 2613 (which may be information similar to faithfully generated comment information 1163 or information similar to data flow consideration generated comment information 1164) is obtained is the same as in the second and third embodiments of the present disclosure.
[0086] The above modification can increase the speed by eliminating the need to exchange commands and externally generated comment information between the comment classification system and the comment generation system. Also, the above modification reduces the risk of code information 111 and externally generated comment information being intercepted by a third party, making it useful for handling code information 111 that requires confidentiality.
[0087] (2) Example of adding comment display output (comment linkage) In the above embodiment, when realizing a differentiated display output by the comment display output control, each part of the additional comment corresponding to the additional comment information 112 is made to stand out or not stand out. In a modified example, the comment display output may be controlled so that a viewer of the comment display output (including the overall display output) can recognize comments that are related to each other in association with each other. Here, the associated comments may be those that are displayed and output in an eye-catching manner (for example, domain knowledge candidates or explanations of the main parts of the code). FIG. 27 illustrates a first example (first addition example 2703 of the overall display output) in which comments are controlled to be displayed in association with each other. In the first addition example 2703 of the overall display output, there are a plurality of pairs of source code and added comments. For example, an added comment (α) 2712 is added to a source code (α) 2711. Also, an added comment (β) 2742 is added to a source code (β) 2741. Then, any embodiment (or modification) of the present disclosure estimates an in-code main part description (α) 2721, a domain knowledge candidate (α) 2722, and an in-code non-main part description (α) 2723 in the added comment (α) 2712. Similarly, any embodiment (or modification) of the present disclosure estimates an in-code main part description (β) 2751, a domain knowledge candidate (β) 2752, and an in-code non-main part description (β) 2753 in the added comment (β) 2742. Here, there may be several techniques for allowing a viewer of the first additional example 2703 of the overall display output to recognize the association between the domain knowledge candidate (α) 2722 and the domain knowledge candidate (β) 2752. Fig. 27 shows several such techniques. For example, the display or output of the first additional example 2703 may be controlled in such a manner that a hyperlink 2731 to the domain knowledge candidate (β) 2752 is provided near the domain knowledge candidate (α) 2722. The display or output of the first additional example 2703 may be controlled in such a manner that a hyperlink 2761 to the domain knowledge candidate (α) 2722 is provided near the domain knowledge candidate (β) 2752. Alternatively, the display or output of the first additional example 2703 may be controlled in such a manner that, instead of the hyperlink 2731 or together with the hyperlink 2731, a display output of position information of the domain knowledge candidate (β) 2752 is provided near the domain knowledge candidate (α) 2722. The display or output of the first additional example 2703 may be controlled in such a manner that, instead of the hyperlink 2761 or together with the hyperlink 2761, a display output of position information of the domain knowledge candidate (α) 2722 is provided near the domain knowledge candidate (β) 2752. Furthermore, the display or output of the first additional example 2703 may be controlled so as to provide a connecting line display output 2771 linking the domain knowledge candidate (α) 2722 and the domain knowledge candidate (β) 2752, instead of or together with the above hyperlink or location information. 28 shows a second example (second additional example 2803 of whole display output) in which comments are controlled to be displayed and output in association with each other. The second additional example 2803 of whole display output displays and outputs source code and additional comments similar to the first additional example 2703. In the second additional example 2803, the copied text 2852 of the domain knowledge candidate (β) 2752 is made into a separate window in a manner in which the contents of the domain knowledge candidate (β) 2752 are copied or moved. In the second additional example 2803, the copied text 2852 of the domain knowledge candidate (β) 2752 that has become a separate window is displayed or output near the domain knowledge candidate (α) 2722.
[0088] According to the additional example of the overall display output (comment display output) shown above, a viewer of the overall display output (comment display output) can efficiently recognize that comments that are related to each other are associated with each other.
[0089] (3) Modifications to the comment generation system (or comment generation function) In the above description of the embodiment (or the modified example), a model trained mainly by machine learning is shown as the functional unit for generating comments. In a variant, the comment generating function may have a processing entity other than a model trained by machine learning for part or all of the comment generation process. For example, a processing entity using a rule base or a dictionary may be included in the comment generating function. With such modifications, the present disclosure can be realized using a wide range of techniques, without being limited to models trained by machine learning.
[0090] (4) Modification of handling of data flow-considered generated comment information As shown in FIG. 13 , the second and third embodiments of the present disclosure detect information contained in both the data flow consideration generated comment information 1164 and the additional comment information 112 as comment common information 121 (second comment common information 1321), and estimate that this second comment common information 1321 is the main part information 301 in the code. Here, in a modified example, if the generation accuracy of the data flow consideration generated comment information 1164 is sufficiently high, the data flow consideration generated comment information 1164 may be presumed to be the main part information 301 in the code (the second comment common information 1321) as it is. In this modified example, since it is not necessary to execute the processing step 1514 in FIG. 15, an improvement in processing speed is expected.
[0091] (5) Display and output of information not included in additional comment information In the above embodiment, what is included in the comment display output is within the range of the additional comment (712 in FIG. 7, 1612 in FIG. 16) corresponding to the additional comment information 112. In the modified example, information that is not included in the added comment corresponding to the added comment information 112 may also be subject to display output. For example, in the modified example, generated comment difference information 123 (intra-code non-main part information 303) in FIG. 3 may be subject to display output. If a viewer of the overall display output (comment display output) desires to get an overview of non-essential parts (e.g., pre-processing parts) of the code (e.g., source code) corresponding to the code information 111, this modified example can accommodate that desire.
[0092] (6) Combination of the second and third embodiments A modified example combining the second and third embodiments is also possible. In other words, the comment classification system in the modified example may have both a function of adjusting the content of the generation command to be given to the comment generation system and a function of processing the content of the externally generated comment information received from the comment generation system. Such a modification allows for more precise adjustment of the content of the generated comment information.
[0093] The technical matters described in each of the embodiments of the present disclosure and the modified examples of the embodiments described above can be combined as appropriate as long as no technical contradiction occurs.
Claims
1. 1. A comment classification system having a processor and a storage device, comprising: Based on added comment information added to the code information and generated comment information generated from the code information, comment common information consisting of information determined to be included in both the added comment information and the generated comment information; added comment difference information consisting of information that is determined to be included in the added comment information but not included in the generated comment information; Detecting at least one piece of information from generated comment difference information consisting of information that is not included in the added comment information but is determined to be included in the generated comment information; A comment classification system that controls the display or output of comments for the code information in a manner in which at least one of the pieces of information detected among the comment common information, the added comment difference information, and the generated comment difference information is distinguished from the other pieces of information.
2. 2. The comment classification system of claim 1, providing the code information and a generation command to generate externally generated comment information for the code information to a comment generation system; receiving, from the comment generation system, the externally generated comment information generated by the comment generation system; A comment categorization system that obtains the generated comment information based on the externally generated comment information.
3. 3. The comment classification system of claim 2, treating the externally generated comment information as the generated comment information; or A comment classification system that generates the externally generated comment information in which information corresponding to parts of the code corresponding to the code information that are estimated to be non-important in the data flow is deleted or reduced, and treats the generated comment information as the generated comment information.
4. 2. The comment classification system of claim 1, Based on the added comment information and faithfully generated comment information, which is the generated comment information generated with the intention of faithfully reflecting the content of the code corresponding to the code information, detecting first added comment difference information consisting of information determined to be included in the added comment information but not included in the faithfully generated comment information; Based on the added comment information and the generated comment information, which is data flow consideration generated comment information, the data flow consideration generated comment information is generated such that a part of the code corresponding to the code information that is estimated to be a non-important part in terms of a data flow is not reflected or the degree to which the part that is estimated to be a non-important part is reflected in the data flow consideration generated comment information is reduced when the data flow consideration generated comment information is generated, Detecting second comment common information consisting of information determined to be included in both the added comment information and the data flow consideration generated comment information; A comment classification system that detects information contained in the added comment information by deleting information contained in the first added comment difference information and information contained in the second comment common information as non-main part estimated information.
5. 2. The comment classification system of claim 1, the generated comment information is faithfully generated comment information that is generated with the intention of faithfully reflecting the content of the code corresponding to the code information, The comment classification system controls to display or output the added comment difference information in a manner that stands out more than other information as a candidate for information including domain knowledge not included in the code information.
6. 6. The comment classification system of claim 5, When controlling to display or output a comment for the code information, Controlling the display or output of the added comment difference information in a conspicuous color, or Controlling to display or output the added comment difference information by applying noticeable modification to the added comment difference information, or A comment classification system that controls so that the added comment difference information is displayed or output in a window separate from a window in which the code information is displayed or output.
7. 6. The comment classification system of claim 5, When controlling to display or output a comment for the code information, if a part of the added comment difference information is related to another part, Controlling to display or output position information of the comment corresponding to the other part in the vicinity of the comment corresponding to the certain part, or Controlling to display or output in such a manner that a hyperlink to a comment corresponding to the other part is provided near the comment corresponding to the certain part, or Controlling to display or output a connecting line in a manner that connects a comment corresponding to the certain portion and a comment corresponding to the other portion, The comment classification system performs control so that the comment corresponding to the certain portion and the comment corresponding to the other portion are displayed or output close to each other by copying or moving the comment corresponding to the certain portion.
8. 5. The comment classification system of claim 4, Controlling to display or output the non-main part estimation information in a manner that makes the non-main part estimation information less noticeable than other information, A comment classification system, which controls so that the non-main part estimation information is not displayed or output when controlling so as to display or output a comment for the code information.
9. 3. The comment classification system of claim 2, The generation command to be given to the comment generation system is a faithful generation command for instructing generation of the externally generated comment information intended to faithfully reflect the content of a code corresponding to the code information; a data flow consideration generation command for instructing that when the externally generated comment information is generated, a part of the code corresponding to the code information that is estimated to be a non-important part in terms of a data flow is not reflected in the externally generated comment information, or that the degree to which the part estimated to be a non-important part is reflected in the externally generated comment information is reduced; The comment categorization system treats the externally generated comment information as the generated comment information.
10. 2. The comment classification system of claim 1, A comment classification system that generates the generated comment information based on the code information.
11. 2. The comment classification system of claim 1, the code information corresponds to source code, The additional comment information is A comment classification system including at least one of information indicating documentation added for the source code, or information indicating inline comments or block comments added for any code contained in the source code.
12. 2. The comment classification system of claim 1, When detecting at least one of the comment common information, the added comment difference information, and the generated comment difference information based on the added comment information and the generated comment information, determining a word or sentence similarity between an additional comment corresponding to the additional comment information and a generated comment corresponding to the generated comment information; A comment classification system that determines that words or sentences with a similarity score at or above a threshold indicate the same content.
13. 2. The comment classification system of claim 1, The generated comment information is The code information is input to a model trained by machine learning, or A comment classification system in which the code information is input into a model trained by machine learning, and the generated information is further processed to generate new code.
14. 1. A method for classifying comments implemented by a computer having a processor and a storage device, comprising: Based on added comment information added to the code information and generated comment information generated from the code information, comment common information consisting of information determined to be included in both the added comment information and the generated comment information; added comment difference information consisting of information that is determined to be included in the added comment information but not included in the generated comment information; an information detection step of detecting at least one piece of information from generated comment difference information consisting of information that is not included in the added comment information but is determined to be included in the generated comment information; A comment classification method including a comment display output control step of controlling to display or output a comment for the code information in a manner in which at least one piece of information detected among the comment common information, the added comment difference information, and the generated comment difference information is distinguished from other pieces of information.
15. A comment classification program, comprising: The comment classification program is executed on a computer having a processor and a storage device, Based on added comment information added to the code information and generated comment information generated from the code information, comment common information consisting of information determined to be included in both the added comment information and the generated comment information; added comment difference information consisting of information that is determined to be included in the added comment information but not included in the generated comment information; an information detection step of detecting at least one piece of information from generated comment difference information consisting of information that is not included in the added comment information but is determined to be included in the generated comment information; and a comment display output control step of controlling the display or output of a comment for the code information in a manner in which at least one of the pieces of information detected among the comment common information, the added comment difference information, and the generated comment difference information is distinguished from the other pieces of information.
Citation Information
Patent Citations
Document generation device, method of producing document, and program
JP2018106582A