Source code searching system and source code searching method
The source code search system enhances code retrieval by pairing code information with contextual metadata, addressing the limitation of existing models by providing context-aware search results.
Patent Information
- Application Number
- JP2023080230
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2024-11-27
AI Technical Summary
Existing code search models fail to consider broader contextual information, such as the specific domain or purpose of software development projects, limiting the relevance of search results.
A source code search system that integrates a code information extraction unit and a context information extraction unit to pair code information with contextual metadata, allowing for searches based on both functional and contextual information.
Enables search results that incorporate project-specific context, improving the relevance and efficiency of code retrieval by considering the broader purpose and domain of the code.
Smart Images

Figure 2024164619000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a source code search system and a source code search method. [Background technology]
[0002] Over the past two decades, huge code bases have emerged that are openly accessible on the Web. Reusing source code (hereafter referred to as "code") contained in such code bases greatly improves the efficiency and quality of software development. Semantic code search (hereafter referred to as "code search") is an important technique used to find code that can be reused in a specific situation. Code search is a technique that aims to find code that best matches a given natural language query. A natural language query is an instruction that allows a user to issue a search instruction by, for example, entering a natural language consisting of a question sentence.
[0003] To tackle the task of code search, many deep neural network (DNN)-based models have been proposed, such as those shown in Non-Patent Document 1. These models are constructed to capture the association between queries and code in a vector space. Queries are usually performed by specifying the features of the code that the user wants to retrieve, such as "How can I sort users?"
[0004] In recent years, many benchmarks have been proposed to measure the search performance of these models. The most well-known benchmark is CodeSearchNet (CSN), which is listed in Non-Patent Document 2. CSN contains a learning dataset consisting of a large number of functions collected from a code base. Each function is paired with a comment (a natural language sentence written immediately after the function definition). This comment usually describes the function of the code.
[0005] Pairs of functions and comments are suitable for learning the relationship between code and queries, and have been used to train DNNs. As mentioned above, existing research has focused on searching code based on its functions. [Prior art documents] [Patent documents]
[0006] [Non-Patent Document 1] Zhensu Sun, Yan Liu, Chen Yang, and Yu Qian. Pscs: A path-based neural model for semantic code search. arXiv preprint arXiv:2008.03042, 2020. [Non-Patent Document 2] Husain, Hamel, et al. "Codesearchnet challenge: Evaluating the state of semantic code search." arXiv preprint arXiv:1909.09436 (2019). Summary of the Invention [Problem to be solved by the invention]
[0007] However, in real-world software development, not only the functionality of the code but also the broader context is important. For example, if a developer is part of a specific software development project, the code he or she develops must reflect the specific purpose or domain of the project (e.g., the industrial field in which the program is used, such as a financial system, a customer management system, or a distribution system). Therefore, the developer's query may include context information, such as "How can I sort users in an ad recommendation system?" Existing models could not return search results that take into account the above context information, because only the query and the code were considered during the search.
[0008] The present invention has been made in light of the above-mentioned circumstances, and has an object to make it possible to present search results in code searches that are based not only on the code's functions but also on broader contextual information. [Means for solving the problem]
[0009] The source code search system of the present invention includes a code information extraction unit that inputs reference information into a code base that stores a repository in which program source code is registered, and outputs code information in which supplementary information has been added to source code obtained from the code base, a context information extraction unit that inputs code information into the code base, extracts context information corresponding to the code information from the code base, and outputs the context information together with the code information, and a source code search database that stores code information and context information corresponding to the code information as pairs. Effect of the Invention
[0010] According to the present invention, the source code search system is equipped with a source code search database that stores code information and context information corresponding to the code information as pairs, thereby making it possible to present search results in code searches that are based not only on the code's function but also on a broader range of context information. Problems, configurations and effects other than those described above will become apparent from the following description of the embodiments. [Brief description of the drawings]
[0011] [Figure 1] 1 is a block diagram showing an example of the overall configuration of a source code search system according to a first embodiment of the present invention. [Diagram 2] FIG. 4 is a diagram showing an example of code information according to the first embodiment of the present invention. [Diagram 3] FIG. 2 is a diagram showing an example of an extraction target of character string information according to the first embodiment of the present invention. [Figure 4] FIG. 2 is a diagram showing an example of context information according to the first embodiment of the present invention. [Diagram 5] 3A to 3C are diagrams illustrating examples of a source code search screen and a search result display screen according to the first embodiment of the present invention. [Figure 6] 4 is a flowchart illustrating an example of a method for storing code information and context information according to the first embodiment of the present invention. [Figure 7] 5 is a flowchart showing an example of a code search method according to the first embodiment of the present invention. [Figure 8] 1 is a block diagram showing an example of the hardware configuration of a computer according to a first embodiment of the present invention. [Figure 9] FIG. 11 is a block diagram showing an example of the overall configuration of a source code search system according to a second embodiment of the present invention. [Figure 10] FIG. 11 is a diagram showing an example of rough context information according to the second embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0012] Hereinafter, an embodiment of the present invention will be described with reference to the accompanying drawings. In this specification and the drawings, components having substantially the same functions or configurations are designated by the same reference numerals, and redundant description will be omitted.
[0013] [First embodiment] FIG. 1 is a block diagram showing an example of the overall configuration of a source code search system 1 according to a first embodiment of the present invention.
[0014] The source code search system 1 includes a code information extraction unit MD1, a context information extraction unit MD2, a code and context information database DB1 (an example of a database for source code search), and a search unit MD3. The source code search system 1 is configured, for example, by a cloud server. A user can operate a PC2 to access the source code search system 1 through a web browser. Outside the source code search system 1, a code base DB0 is provided that stores a repository in which program source code is registered. The code base DB0 is an example of a database system that stores a large number of codes.
[0015] The code information extraction unit MD1 inputs reference information to the code base DB0, and outputs code information obtained by adding supplementary information to the source code obtained from the code base DB0. For example, the code information extraction unit MD1 receives an input of a URL (Uniform Resource Locator), which is access information for the code base DB0, and accesses the code base DB0, extracts and outputs multiple pieces of code information D0 from the code base DB0. The supplementary information is information other than the code strings in the code information D0 shown in FIG. 2, which will be described later.
[0016] The code information extraction unit MD1 can also divide the source code acquired from the code base DB0 into specified units (for example, by function), add supplemental information to the divided source code, and output the code information D0. The data structure of the code information D0 is a structure in which supplemental information is added to each piece of information obtained by dividing the code present in the code base DB0 into small, specified units.
[0017] Fig. 2 is a diagram showing an example of code information D0. In the code information D0 shown in Fig. 2, a function is used as the above-mentioned "small-scale unit".
[0018] The code information D0 has the items "code string", "original file", and "number of lines". "Code String" stores the string information of one function. "Original file" is the URL of the file in which the function saved in "Code string" was written. This URL is an example of access information that indicates the storage location of the file in which the function was written. In this case, the URL indicates the storage location of a program file written in Python as the file. "Line number" is the start and end line numbers of the "code string" written in the file the function was written in. "Line number" is expressed in the format [start line number, end line number].
[0019] The code information extraction unit MD1 can identify the string information of a function and the "original file" and "number of lines" that are supplementary information to the string information from the code base DB0 by applying a technology for analyzing source code to each file included in the code base DB0. The technology for analyzing source code is one of the functions of the code information extraction unit MD1, and it makes it possible to divide the source code into functions, which are defined units, by using regular expressions or analyzing the source code using a compiler, for example.
[0020] As described above, the supplemental information is information other than the "code string", that is, information that includes at least one of the "original file" and "number of lines".
[0021] The input to the code information extraction unit MD1 does not have to be a URL, as long as it is information that can specify source code from the repository of the code base DB0. For example, if the original data of the code base DB0 is available, the storage location of the data may be used.
[0022] The context information extraction unit MD2 inputs code information to the code base DB0, extracts context information corresponding to the code information from the code base DB0, and outputs the context information together with the code information. For example, the context information extraction unit MD2 receives code information D0 as input and identifies context information D1 corresponding to the code information D0 from the code base DB0. Then, the context information extraction unit MD2 outputs the identified context information D1 and the code information D0.
[0023] FIG. 3 is a diagram showing an example of a target from which character string information is extracted. Source code (1) in Fig. 3 shows an example of source code written in Java (registered trademark), which is a programming language. This source code represents a function that calculates the sum of variables a and b. The code information extraction unit MD1 extracts the entire text of this source code as character string information of the function.
[0024] Source code (2) in Fig. 3 shows an example of source code written in Python (registered trademark), a programming language. This source code represents a function that calculates the sum of variables a and b. The code information extraction unit MD1 extracts the entire text of this source code as character string information of the function.
[0025] In addition, there is a case where only functions such as those shown in source code (1) and (2) in Fig. 3 are stored as source code in the code base DB0. In this case, the code information extraction unit MD1 outputs the source code acquired from the code base DB0 to the context information extraction unit MD2 without dividing it.
[0026] Source code (3) in Figure 3 shows an example of source code written in Python. This source code uses an if statement to compare the sizes of variables a and b and output the different value, and is not a function. For this reason, the code information extraction unit MD1 does not output this source code as character string information. Note that if an if statement is included in a function defined as shown in source code (1) and (2), the entire function including the if statement can be extracted as character string information.
[0027] Fig. 4 is a diagram showing an example of context information D1. As shown in Fig. 1, the context information D1 is information extracted from the code base DB0 by the context information extraction unit MD2, and is meta-information. The meta-information is information that explains the contents of the code information D0, and is also called metadata.
[0028] The context information D1 has the items "target string," "original file," and "number of lines." The "purpose string" is a string that describes the purpose of the original repository that contained the code. "Original file" is the URL of the original file that contained the "target string." This URL is an example of access information that indicates the storage location of the original file. In this example, the storage location of the README file is indicated by the URL as the original file. "Line number" is the start and end line numbers where the "target string" is written in the file. "Line number" is expressed in the format [start line number, end line number].
[0029] There are various possible methods for the context information extraction unit MD2 to identify the information of the context information D1 from the code base DB0. For example, if the original repository includes a README file, the context information extraction unit MD2 identifies the README file using a string-based rule, such as "readme or the string README is included in the file name."
[0030] Furthermore, the context information extraction unit MD2 extracts a specific number of lines in the identified README file, for example, "lines 1 to 3," as the "purpose character string." The reason for using "lines 1 to 3" as an example is that the first text in a README file often describes the purpose of the repository, the domain (the industrial field in which the program is used), or the contents of the project. In addition to README files, file comments, class comments, etc., which will be described later, can also be extracted as context information.
[0031] The context information extraction unit MD2 can also use file comments as a method of identifying the context information D1. The context information extraction unit MD2 can extract the top-level comment in the original file that contained the code using a technology that analyzes the source code and use it as context information. This is because the top-level comment often describes the purpose of the code in the file. The technology that analyzes the source code is one of the functions of the context information extraction unit MD2.
[0032] The context information extraction unit MD2 can also use class comments as a method for identifying the context information D1. The context information extraction unit MD2 can extract comments written at the top level of the original class in which the code was included, using a technique for analyzing source code, and use the extracted comments as the context information D1. The reason for this is that the top-level comments of a class often describe the purpose of the code in that class.
[0033] The context information extraction unit MD2 pairs the context information D1 extracted from the code base DB0 with the code information D0 input from the code information extraction unit MD1 and stores them in the code and context information database DB1. When the context information extraction unit MD2 extracts different code information D0 from the context information D1, the code information D0 and the context information D1 corresponding to the code information D0 are stored in a one-to-many relationship in the code and context information database DB1.
[0034] The code and context information database DB1 stores code information D0 and context information D1 corresponding to the code information D0 as a pair. The code information D0 and the context information D1 may be stored in a one-to-one relationship or in a many-to-one relationship. When the code information D0 and the context information D1 are stored in a many-to-one relationship, the context information D1 may be the same in all of the multiple pairs stored of a certain context information D1 and the code information D0.
[0035] The search unit MD3 shown in FIG. 1 is an example of a search algorithm started by the PC2 operated by a user. The user inputs a query to the PC2 to specify a code to be searched. For example, the query is input as "How can I sort users in an ad recommendation system." The query may be a command in a sentence composed of a natural language, or may be a command generally used in a database search operation.
[0036] The search unit MD3 searches the code and context information database DB1 for context information D1 corresponding to the query based on the input query, and outputs the searched context information D1 and the code information D0 stored as a pair with the context information D1 as a search result. For example, the search unit MD3 transmits the pair of the code information D0 and the context information D1 searched for in the code and context information database DB1 based on the query received from PC2 to PC2. PC2 displays the pair of the code information D0 and the context information D1 received from the search unit MD3, and the user can check the code information D0.
[0037] FIG. 5 is a diagram showing a display example of the source code search screen W1 and the search result display screen W2.
[0038] First, a source code search screen W1 is displayed on the PC 2. The source code search screen W1 includes a query input section W11, a programming language selection section W12, a search button W13, and a query example display section W14.
[0039] In the query input section W11, a sentence that the user wishes to search is input as a query. The programming language selection unit W12 is used to select the programming language that the source code the user wishes to obtain is written in. Examples of programming languages include Python and Java.
[0040] The search button W13 is a button for inputting an instruction to search the code and context information database DB1 based on a query to the search unit MD3. The search button W13 functions as a trigger for transmitting the query inputted to the query input section W11 to the search unit MD3.
[0041] The query example display section W14 displays a list of examples of queries that are recommended for input. When inputting a query into the query input section W11, the user can select any query from the list of query examples.
[0042] After pressing the search button W13, a search result display screen W2 is displayed on the PC2. The search result display screen W2 has the following items: score, project, context, and code.
[0043] The score item displays the relevance score between the context information D1 and the code information D0. Although not shown, the top n search results based on the relevance score may be displayed as a list on the search result display screen W2 as records having the items of score, project, context, and code.
[0044] The project item displays the name of the project in which the code searched for in the code and context information database DB1 is used. In the context item, the context information D1 (for example, the contents of the target character string item shown in FIG. 3) acquired from the context information D1 that is a pair with the code information D0 is displayed. The code item displays the code information D0 that the search unit MD3 has searched for from the code and context information database DB1. The user can use the code information D0 displayed in the code item.
[0045] <Example of processing performed by the code search system> Next, an example of a method for storing code information and context information and a method for searching code performed by the source code search system 1 will be described with reference to FIGS.
[0046] (How to store code and context information) FIG. 6 is a flow chart illustrating an example of a method for storing code information and context information.
[0047] First, the chord information extraction unit MD1 extracts the chord information D0 from the chord base DB0 (S1). The chord information D0 is output to the context information extraction unit MD2.
[0048] Next, the context information extraction unit MD2 extracts the context information D1 from the code base DB0 based on the code information D0 (S2).
[0049] Finally, the context information extraction unit MD2 stores the code information D0 and the context information D1 as a pair in the code and context information database DB1 (S3). The series of processes shown in FIG. 6 is repeated at a predetermined timing, and the contents of the code and context information database DB1 are updated.
[0050] (How to find the code) FIG. 7 is a flow chart showing an example of a code search method. First, the user inputs a query on the source code search screen W1 shown in FIG. 5 and issues an instruction to start a search (S11).
[0051] Next, the search unit MD3 receives the query from the PC2, and searches the code information D0 from the code and context information database DB1 in accordance with the query (S12).
[0052] Next, the search section MD3 outputs the code contained in the searched code information D0 to the PC2 as the search result (S13).
[0053] Finally, the PC2 displays the code included in the code information D0 on the search result display screen W2 as the search result (S14). The user can use the code displayed on the search result display screen W2 in software development.
[0054] <Example of computer hardware configuration> Next, the hardware configuration of the computer 20 constituting each device of the source code search system 1 will be described. 8 is a block diagram showing an example of a hardware configuration of the computer 20. The computer 20 is an example of hardware used as a computer capable of operating as the source code search system 1 according to this embodiment.
[0055] The computer 20 includes a CPU (Central Processing Unit) 21, a ROM (Read Only Memory) 22, and a RAM (Random Access Memory) 23, each of which is connected to a bus 24. The computer 20 further includes a display device 25, an input device 26, a non-volatile storage 27, and a network interface 28.
[0056] The CPU 21 reads out program code of software for realizing each function according to the present embodiment from the ROM 22, loads it into the RAM 23, and executes it. Variables, parameters, etc. generated during the computation process of the CPU 21 are temporarily written into the RAM 23, and these variables, parameters, etc. are read out as appropriate by the CPU 21. However, a GPU (Graphics Processing Unit) may be used instead of the CPU 21, or the CPU 21 and a GPU may be used together.
[0057] The display device 25 is, for example, a liquid crystal display monitor, and displays to the developer the results of the processing performed by the computer 20. The input device 26 is, for example, a keyboard, a mouse, etc., and enables the developer (for example, a user) to input predetermined operations and give instructions.
[0058] Examples of the nonvolatile storage 27 include a hard disk drive (HDD), a solid state drive (SSD), a flexible disk, an optical disk, a magneto-optical disk, a CD-ROM, a CD-R, a magnetic tape, and a nonvolatile memory. In addition to an operating system (OS) and various parameters, a program for making the computer 20 function is recorded in the nonvolatile storage 27. The ROM 22 and the nonvolatile storage 27 record programs and data necessary for the CPU 21 to operate, and are used as an example of a computer-readable non-transient storage medium that stores a program executed by the computer 20.
[0059] The network interface 28 may be, for example, a network interface card (NIC), and various data may be transmitted and received between devices via a local area network (LAN) or dedicated line connected to a terminal of the NIC.
[0060] In the source code search system 1 according to the first embodiment described above, a code and context information database DB1 is constructed in which code information D0 and context information D1 are stored in a corresponding state. A user can use the code and context information database DB1 and the search unit MD3 to search for source code taking into account the context information D1. This makes it easier for a developer to search for required code from the code base DB0 that stores a large amount of code.
[0061] For example, when a query is input by a user, the search unit MD3 calculates the relevance score of a pair of certain code information D0 and context information D1, and returns the top n search results with the highest relevance scores. The following method can be used to calculate the relevance score between a query and a pair of code information D0 and context information D1. In this method, for example, the search unit MD3 calculates the relevance score between the query and a character string in the code information D0 using a DNN (Deep Neural Network), and also calculates the relevance score between the query and a character string in the context information D1 using the DNN. The search unit MD3 can then take a weighted sum of the two relevance scores.
[0062] A user can obtain a desired code by simply inputting a natural sentence as a query in the query input section W11. Conventionally, code logic was input during code search, but the source code search system 1 allows a user to search for code based on highly abstract information such as the purpose or domain of a project.
[0063] Also, the user can indirectly access the code base DB0 through the source code search screen W1 to obtain the code. This allows a significant reduction in search time compared to the conventional method of accessing the code base DB0 and visually searching for the desired code from among a large number of codes. In addition, the user can reuse the obtained code in development, reducing the time required for development and improving productivity.
[0064] [Second embodiment]
[0065] In the source code search system 1 according to the first embodiment, for example, the first text in the README file describes the purpose of the repository, and the process of extracting the context information D1 from the README file has been described. However, the README file also includes redundant descriptions such as a program installation method and a project usage method in addition to the use purpose and domain of the source code to be extracted as the context information D1. For this reason, there is a risk that the context information extraction unit MD2 according to the first embodiment cannot correctly extract information that can become the context information D1 from the README file. Therefore, in the source code search system 1 according to the second embodiment, as shown in FIG. 9, the context information extraction unit MD2 extracts the rough context information R1 from the code base DB0, and then adds a process of identifying the context information D1 from the rough context information R1. Below, a configuration example and an operation example of the source code search system 1A according to the second embodiment of the present invention will be described.
[0066] FIG. 9 is a block diagram showing an example of the overall configuration of a source code search system 1A according to the second embodiment of the present invention.
[0067] A source code search system 1A according to the second embodiment has the same configuration as the source code search system 1 according to the first embodiment shown in FIG. 1, but differs in the internal configuration of a context information extraction unit MD2. The context information extraction unit MD2 has a function of extracting context information from the code base DB0. This context information extraction unit MD2 includes a text block specification unit MD41 and an intra-text block context information specification unit MD42.
[0068] The text block identification unit MD41 (an example of a rough information identification unit) has the same function as the context information extraction unit MD2 according to the first embodiment, but differs in that it acquires text including the context information D1 from the code base DB0 as the rough context information R1 based on the code information D0. In this case, the text block identification unit MD41 identifies the text including the context information D1 as a text block in a file unit, and outputs the identified text block as the rough context information R1 to the intra-text block context information identification unit MD42. The rough context information R1 is information that roughly identifies the context information D1, and includes a larger range of information than the context information D1. The file unit is, for example, a unit such as a README file. In addition, the "text block" represents "text that is expected to include context information." For example, the entire file, or the entire comment in natural language written at the top of the file is a text block that is used as the rough context information R1.
[0069] The text block context information identification unit MD42 (an example of a context information identification unit) is used to identify the details of the rough context information R1. The text block context information identification unit MD42 identifies the details of the part where the context information D1 is written in the rough context information R1, and outputs the identified details as the context information D1. At this time, the text block context information identification unit MD42 identifies the details from the text block. For example, the text block context information identification unit MD42 identifies only the part of the character string representing the purpose from the "rough purpose character string" included in the rough context information R1 as shown in FIG. 10 described later. For example, a text block of a sentence containing "purpose" and "domain" is identified as a detailed part from the rough context information R1. The text block identified as a detailed part may include not only the sentence containing "purpose" and "domain" but also the sentences before and after the sentence. Information such as the purpose and domain of the project identified from the rough context information R1 is output to the code and context information database DB1 as the context information D1.
[0070] 10 is a diagram showing an example of the rough context information R1. The rough context information R1 has the items of "rough target character string", "original file", and "number of lines".
[0071] The "rough objective string" contains the rough objective of the code as a string, for example, "The objective of this library is to recommend optimal advertisements to users. The specific processing is to first convert the user into a vector using DNN, ..." and is information written at the top of the file. "Original file" is the URL of the original file that contained the "rough target string." This URL is an example of access information that indicates the storage location of the original file. In this example, the storage location of the README file is indicated by the URL as the original file. "Line number" is the start line number and end line number where the "rough target string" is written in the file. "Line number" is expressed in the format [start line number, end line number].
[0072] The context information D1 identified from the rough context information R1 by the text block context information identification unit MD42 is expressed as, for example, "The purpose of this library is to recommend optimal advertisements to users." For this reason, information other than the purpose, such as "Specific processing is to first convert the user into a vector using DNN, ..." is not extracted as the context information D1.
[0073] The text block context information identification unit MD42 extracts the context information D1 from the rough context information R1 using, for example, an information extraction and relationship extraction technique for extracting a specific part from a text. Alternatively, the rough context information R1 may be converted into context information D1 including only a character string related to the objective using an automatic summarization technique. The text block context information identification unit MD42 outputs the character string extracted from the rough context information R1 as context information D1 including the "objective character string" shown in FIG. 4. The pair of the code information D0 and the context information D1 is stored in the code and context information database DB1. The method of code search by the user thereafter is the same as that in the first embodiment, and therefore a detailed description thereof will be omitted.
[0074] In the source code search system 1A according to the second embodiment described above, after the text block identification unit MD41 identifies the rough context information R1 from the code base DB0, the intra-text block context information identification unit MD42 identifies the context information D1. After that, the context information D1 corresponding to the code information D0 is appropriately identified, and the code information D0 and the context information D1 are stored as a pair in the code and context information database DB1. Therefore, when the user inputs a query to the PC2, the code information D0 corresponding to the context information D1 is easily searched for.
[0075] [Variations] The source code search system 1, 1A according to each of the above-described embodiments may be configured inside the PC 2. In this case, pairs of code information D0 and context information D1 are stored in the code and context information database DB1 configured in the PC 2. Therefore, even in an offline environment such as a server room where it is not possible to go online, a user can input a query from the PC 2 to search for code and continue development.
[0076] The source code search system 1, 1A may also be configured to include a code base DB0. In this case, in an existing system that holds source code that is not intended to be made public, the code base DB0 may be used to manage the source code.
[0077] The present invention is not limited to the above-described embodiments, and it goes without saying that various other applications and modifications are possible without departing from the gist of the present invention as set forth in the claims. For example, the above-mentioned embodiments have described the configuration of the device and system in detail and specifically in order to explain the present invention in an easily understandable manner, and are not necessarily limited to those having all of the configurations described. In addition, it is possible to replace a part of the configuration of the embodiment described here with the configuration of another embodiment, and it is also possible to add the configuration of another embodiment to the configuration of one embodiment. In addition, it is also possible to add, delete, or replace a part of the configuration of each embodiment with another configuration. In addition, the control lines and information lines shown are those that are considered necessary for the explanation, and not all control lines and information lines in the product are necessarily shown. In reality, it can be considered that almost all components are connected to each other. [Explanation of symbols]
[0078] 1, 1A... source code search system, D1... context information, DB1... context information database, MD1... code information extraction unit, MD2... context information extraction unit, MD3... search unit, MD41... text block identification unit, MD42... context information identification unit within text block, R1... rough context information, W1... source code search screen, W2... search result display screen
Claims
1. a code information extraction unit that inputs reference information into a code base that stores a repository in which source code of a program is registered, and outputs code information obtained by adding supplemental information to the source code obtained from the code base; a context information extraction unit that inputs the code information into the code base, extracts context information corresponding to the code information from the code base, and outputs the context information together with the code information; a source code search database that stores the code information and the context information corresponding to the code information as a pair; Source code search system.
2. The code information extraction unit divides the source code acquired from the code base into a specified unit, adds the supplemental information to the divided source code, and outputs the code information.
2. The source code search system according to claim 1.
3. The unit of the above definition is per function.
3. The source code search system according to claim 2.
4. The supplemental information is information of the code information other than the code character string.
4. The source code search system according to claim 3.
5. The context information is meta-information 4. The source code search system according to claim 3.
6. When the context information extraction unit extracts the code information that is different from the context information, the code information and the context information corresponding to the code information are stored in a one-to-many relationship in the source code search database.
4. The source code search system according to claim 3.
7. and a search unit that searches the source code search database for the context information corresponding to the query based on an input query, and outputs the searched context information and the code information stored as a pair with the context information as a search result.
7. A source code search system according to claim 2.
8. The context information extraction unit a rough information identification unit that identifies text including the context information from the code base as rough information; a context information specifying unit that specifies in detail a portion in which the context information is written in the rough information and outputs the specified detailed portion as the context information.
8. The source code search system according to claim 7.
9. the rough information identification unit identifies the text including the context information as a text block on a file basis and outputs the text block as the rough information; The context information identification unit identifies the detailed portion from the text block.
9. The source code search system according to claim 8.
10. inputting reference information into a code base that stores a repository in which source code of a program is registered, and outputting code information in which supplemental information is added to the source code obtained from the code base; inputting the code information into the code base, extracting context information corresponding to the code information from the code base, outputting the context information together with the code information, and storing the code information and the context information corresponding to the code information as a pair in a source code search database. How to search source code.
