Retrieval apparatus, retrieval method, and retrieval program

The search device identifies and highlights similarity basis parts in source code, addressing the challenge of determining which parts of a query text are similar to search results, thereby improving code review efficiency.

JP2025115310APending Publication Date: 2025-08-06HITACHI LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2024009794
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-01-25
Publication Date
2025-08-06

AI Technical Summary

Technical Problem

Existing search methods struggle to identify which parts of a query text are similar to multiple similar texts obtained as search results, making it difficult for users to grasp the basis for similarity.

Method used

A search device that includes a search unit to find similar texts, a contribution rate calculation unit to determine the degree of contribution of each part of the query text to similarity, a similarity basis identification unit to identify parts with a predetermined threshold contribution rate, and an output unit to highlight these parts, enabling accurate identification of similarity basis.

Benefits of technology

Enables the identification of similar texts along with their similarity basis, allowing users to efficiently understand and highlight potential similarity portions, enhancing the accuracy of code review by highlighting the reason for similarity in source code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025115310000001_ABST
    Figure 2025115310000001_ABST
Patent Text Reader

Abstract

To identify a text similar to a query text, together with the evidence for the similarity.SOLUTION: A retrieval apparatus includes: a retrieval unit which searches a plurality of search target texts for one or more similar texts similar to an input query text; a contribution rate calculation unit which calculates, for each of the similar texts, a first contribution rate indicating a degree of contribution of each part of the query text to similarity between the similar text and the query text; a similarity evidence identifying unit which identifies, for each of the similar texts, a part having the first contribution rate equal to or larger than a predetermined threshold, as a first similarity evidence portion which is a portion of the query text that substantiates the similarity between the query text and the similar text; and an output unit which outputs the similar texts and the first similarity evidence portion.SELECTED DRAWING: Figure 2
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to a search device, a search method, and a search program. [Background technology]

[0002] In program development, it is important to ensure quality by reviewing source code. If a defect is discovered during the review, it is necessary to search and check for code similar to the defect in the source code. However, manually checking a large amount of source code requires a lot of man-hours and there is a risk that code may be overlooked.

[0003] Patent Document 1 discloses a technique for outputting document segments similar to a queried text document using a word embedding model.

[0004] Furthermore, Patent Document 2 discloses a technique for calculating the influence of individual training data points on predictions made by a machine learning model trained using training data, using SHAP (Shapley Additive exPlanations). [Prior art documents] [Patent documents]

[0005] [Patent Document 1] Special Publication No. 2022-536241 [Patent Document 2] Special Publication No. 2022-552980 Summary of the Invention [Problem to be solved by the invention]

[0006] However, with the above-described technology, when a query text contains multiple parts that could be evidence of similarity, multiple similar texts based on different similarity grounds may be mixed in the search results. As a result, it is difficult to determine which parts of the query text are similar to each of the multiple similar texts obtained as search results. If only parts that could be evidence of similarity are searched for as query text, it is possible to obtain only texts similar to those parts as search results, but it is difficult for a user to grasp which parts could be evidence of similarity before searching.

[0007] The present invention has been made in consideration of the above circumstances, and its purpose is to provide a search device, a search method, and a search program that can identify text similar to a query text together with the basis for that similarity. [Means for solving the problem]

[0008] One aspect of the present invention for solving the above problem is a search device that includes: a search unit having a processor and a memory, and that searches for one or more similar texts that are similar to an input query text from a plurality of search target texts; a contribution rate calculation unit that calculates, for each similar text, a first contribution rate that indicates the degree to which each part of the query text contributes to the similarity between the similar text and the query text; a similarity basis identification unit that identifies, for each similar text, a part of the similar text where the first contribution rate is equal to or greater than a predetermined threshold, as a first similarity basis part that becomes the part of the query text that justifies the similarity between the query text and the similar text; and an output unit that outputs the similar texts and the first similarity basis part. [Effects of the Invention]

[0009] According to the present invention, texts similar to a query text can be identified along with the basis for the similarity. Configurations and effects other than those described above will become apparent from the following description of the embodiments. [Brief explanation of the drawings]

[0010] [Figure 1] FIG. 2 illustrates an example of a hardware configuration of a search system. [Figure 2] FIG. 2 is a block diagram illustrating an example of a functional configuration of a search system. [Figure 3] FIG. 2 is a process flow diagram illustrating an outline of a process performed in the search system according to the first embodiment. [Figure 4] FIG. 10 is a diagram illustrating an outline of a process for searching for similar chords. [Figure 5] FIG. 10 is a diagram illustrating an outline of a process for identifying similarity grounds. [Figure 6] FIG. 10 is a diagram illustrating an example of a first similar chord search result in the first embodiment. [Figure 7] FIG. 10 is a process flow diagram illustrating an outline of a process performed in a search system according to a second embodiment. [Figure 8] FIG. 10 is a diagram illustrating an example of a second similar chord search result in the second embodiment. DETAILED DESCRIPTION OF THE INVENTION

[0011] Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings. The following description and drawings are examples for explaining the present invention, and some omissions and simplifications have been made as appropriate for clarity of explanation. The present invention can be implemented in various other forms. Unless otherwise specified, each component may be singular or plural. In order to facilitate understanding of the invention, the position, size, shape, range, etc. of each component shown in the drawings may not represent the actual position, size, shape, range, etc. Therefore, the present invention is not necessarily limited to the position, size, shape, range, etc. disclosed in the drawings. In the following explanation, various types of information may be described using expressions such as "table," "list," and "queue," but the various types of information may also be expressed using data structures other than these. To indicate that the information is not dependent on the data structure, "XX table," "XX list," etc. may be referred to as "XX information." When describing identification information, expressions such as "identification information," "identifier," "name," "ID," and "number" are used, but these are interchangeable. When there are multiple components with the same or similar functions, they may be described using the same reference numeral with different subscripts. However, when there is no need to distinguish between these multiple components, the subscripts may be omitted. Furthermore, in the following description, processing performed by executing a program may be described, but the program is executed by a processor (e.g., a CPU or a GPU) to perform the specified processing while appropriately using storage resources (e.g., a memory) and / or interface devices (e.g., a communication port), and therefore the subject of the processing may be the processor. Similarly, the subject of the processing performed by executing a program may be a controller, device, system, computer, or node having a processor. The subject of the processing performed by executing a program may be any computing unit, and may include a dedicated circuit (e.g., an FPGA or an ASIC) that performs a specific processing. A program may be installed on a device such as a computer from a program source. The program source may be, for example, a program distribution server or a computer-readable storage medium. If the program source is a program distribution server, the program distribution server may include a processor and storage resources for storing the program to be distributed, and the processor of the program distribution server may distribute the program to be distributed to other computers. Also, in the following description, two or more programs may be realized as one program, and one program may be realized as two or more programs.

[0012] [First embodiment] First, a search device, a search method, and a search program according to a first embodiment will be described.

[0013] <Search system> FIG. 1 is a diagram illustrating an example of the hardware configuration of a search system 10. The search system 10 (search device) is an information processing device that searches for similar code (e.g., code clones) that resembles a specific code (hereinafter referred to as "query code") included in the source code of a program. A code clone is a part that is semantically similar (e.g., has similar processing) or identical to the query code. Typically, code clones are created in source code by programming through copying and pasting code or by intentionally writing the same processing repeatedly. The search system 10 automatically classifies hit codes (searched similar code) that have the same part in the query code that serves as the basis for similarity, and outputs groups of hit codes with the same basis for similarity in an identifiable manner.

[0014] As an example, the search system 10 includes a processing device 11 such as a CPU (Central Processing Unit), a memory 12 such as a RAM (Random Access Memory) or a ROM (Read Only Memory), a storage device 13 such as an HDD (Hard Disk Drive) or an SSD (Solid State Drive), an input device 14 such as a keyboard, a mouse, or a touch panel, an output device 15 such as a display or a printer, and a communication device 16 consisting of a NIC (Network Interface Card), a wireless communication module, a USB (Universal Serial Interface) module, or a serial communication module.

[0015] In the search system 10, data such as programs used to execute predetermined processes is stored in the storage device 13, for example, and the processing device 11 reads the data into the RAM of the memory 12 and executes it.

[0016] 2 is a block diagram showing an example of the functional configuration of the search system 10. The search system 10 stores programs in a storage device 13 that implement the functions of an input unit 101, a similar code search unit 102, a contribution rate calculation unit 103, a group determination unit 104, a group contribution rate calculation unit 105, a similar basis identification unit 106, and an output unit 107. The search system 10 implements the functions of the input unit 101, the similar code search unit 102, the contribution rate calculation unit 103, the group determination unit 104, the group contribution rate calculation unit 105, the similar basis identification unit 106, and the output unit 107 by having the processing device 11 read the programs stored in the storage device 13 into the memory 12 and execute them. The programs that implement the functions of the input unit 101, the similar code search unit 102, the contribution rate calculation unit 103, the group determination unit 104, the group contribution rate calculation unit 105, the similar basis identification unit 106, and the output unit 107 can be recorded on a portable or fixed recording medium and distributed, for example. The search system 10 also stores in the storage device 13 search target code 111, which is source code to be searched, and a similarity score calculation model 112, which will be described later.

[0017] The input unit 101 receives input of a query code 200 (query text) from a user U.

[0018] The similar code search unit 102 (search unit) executes a search process to search for one or more similar codes (similar texts) similar to the query code 200 from multiple search target codes 111 using a similarity score calculation model 112 described later.

[0019] The contribution rate calculation unit 103 executes a contribution rate calculation process to calculate, for each similar code, a contribution rate (first contribution rate) that indicates the degree to which each line of the query code 200 contributes to the similarity (similarity score) between the similar code and the query code 200, for example, by SHAP or the like. The first contribution rate is, for example, a Shapley value that indicates the degree of influence on the similarity score using each line of the query code 200 as a feature. For example, when calculating the first contribution rate for the nth (n is a positive integer) line of the query code 200, the contribution rate calculation unit 103 inputs the query code 200 from which the nth line has been deleted and the hit code into the similarity score calculation model 112 to calculate the similarity score of each hit code, and compares the calculated similarity score with the similarity score calculated by the similar code search unit 102 to calculate the first contribution rate.

[0020] The group determination unit 104 generates a vector for each similar code using the calculated contribution rate of each line of the query code 200 as a feature (vector component), and clusters the generated vectors to generate vector groups. That is, the group determination unit 104 groups the similar codes based on the similarity of the generated vectors.

[0021] The group contribution rate calculation unit 105 calculates the average value (average contribution rate) of the contribution rates of each line of the query code 200 for each group.

[0022] The similar basis identification unit 106 executes a similar basis identification process to identify a row having an average contribution rate equal to or greater than a predetermined threshold value α as a similar basis row of the group. The similar basis row corresponds to a “first similar basis part” of the query code 200 that provides a basis for the similarity between the query code 200 and the similar code.

[0023] The output unit 107 executes an output process to output, for each group, the query code 200 in which the similar basis lines are made identifiable (for example, highlighted), and the similar codes sorted in order of similarity score as the first similar code search result 300.

[0024] <Processing Overview> Next, the processing performed by the search system 10 will be described.

[0025] 3 is a processing flow diagram illustrating an outline of processing performed by the search system 10 in the first embodiment. The processing shown in this diagram is executed, for example, when a query code 200 is input to the search system 10 by a user.

[0026] First, the input unit 101 receives input of a query code 200 from the user U (S101).

[0027] Next, the similar code search unit 102 searches the search target code 111 for similar codes that have a high similarity score to the query code 200 as hit codes (S102).

[0028] 4 is a diagram illustrating an outline of the process of searching for similar code. First, the similar code search unit 102 inputs the input query code 200 and search target code 111 into the similarity score calculation model 112, and obtains a similarity score 320 that indicates the similarity of each search target code 111 to the query code 200.

[0029] The similarity score calculation model 112 is a trained model (e.g., Large Language Models (LLM)) that has been trained in advance on the source code of a program similar to the program of the query code 200 (e.g., a program of a similar or related past project). The similarity score calculation model 112 receives the query code 200 and the search target code 111 as input, and outputs a similarity score for each search target code 111 with respect to the query code 200. For example, the similarity score calculation model 112 converts the code or a word contained in the code into a distributed representation vector (embedding vector (embedded representation)), and outputs the cosine similarity of the embedding vector (e.g., word embedding vector) as the similarity score.

[0030] The similar code search unit 102 extracts the top N (N is a positive integer) search target codes 111 with the highest similarity scores 320 output from the similarity score calculation model 112 as hit codes 310.

[0031] However, when the query code 200 has multiple parts (parts A and B in the illustrated example) that serve as the basis for similarity, it is not possible to determine which part of the query code 200 each hit code 310 is similar to from only the similarity score 320. For example, in the illustrated example, the hit codes 311 and 313 are similar to part B of the query code 200, and the hit code 312 is similar to part A of the query code, but this cannot be determined from the similarity score 320. Therefore, the search results by the similar code search unit 102 will contain a mixture of multiple hit codes 310 with different grounds for similarity (similar parts).

[0032] Therefore, in the subsequent process, the search system 10 identifies the basis for similarity of the query code 200 for each of the searched hit codes 310 .

[0033] FIG. 5 is a diagram illustrating an outline of the process of identifying similarity grounds.

[0034] First, the contribution rate calculation unit 103 calculates the contribution rate of each hit code 310 to the increase in the similarity score for each line of the query code 200 (S103).

[0035] Specifically, the contribution rate calculation unit 103 uses the query code 200, multiple hit codes 310, and the similarity score calculation model 112 to calculate the contribution rate of each line of the query code 200 to the increase in the similarity score for each hit code 310, for example, using SHAP or the like.

[0036] Table 500 shown in FIG. 5 is data representing the calculation results by the contribution rate calculation unit 103, and stores the contribution rate of each hit code 310 (code 1 to code N) to the increase in the similarity score for each row (row 1 to row M) of query code 200.

[0037] Next, the group determination unit 104 generates a vector for each hit code 310 using the calculated contribution rate of each line of the query code 200 as a feature, and clusters the generated vectors (S104). That is, the group determination unit 104 groups each hit code 310 based on the similarity of the generated vectors. Note that one hit code 310 may be included in multiple groups.

[0038] In the example shown in FIG. 5, the group determination unit 104 classifies the vectors having the contribution rate as the feature into three groups, group 1 to group 3.

[0039] Next, the group contribution rate calculation unit 105 calculates the average value (average contribution rate) of the contribution rates of each line of the query code for each group (S105).

[0040] Table 600 shown in FIG. 5 is data representing the calculation results by group contribution rate calculation unit 105, and stores the average contribution rate for each row (1st row to Mth row) of query code 200 for each group (group 1 to group 3).

[0041] Next, the similar basis specification unit 106 specifies rows whose average contribution rate is equal to or greater than a predetermined threshold α (for example, 0.2) as similar basis rows of the query code 200 for that group (S106).

[0042] In the example shown in FIG. 5, the similar basis identification unit 106 identifies the similar basis rows of group 1 as the second and third rows, the similar basis rows of group 2 as the first and second rows, and the similar basis row of group 3 as the Mth row.

[0043] Next, the output unit 107 outputs the hit code 310 and the similar basis line for each group (S107), and then ends the process. For example, the output unit 107 displays the first similar code search result 300.

[0044] (First similar code search result) 6 is a diagram showing an example of a first similar code search result 300 in the first embodiment. The first similar code search result 300 is a display screen including, for each group, an area 810 that highlights (emphasizes) similar basis lines (portions) of the query code 200, an area 820 that displays a list of hit codes 310 included in the group in descending order of similarity score, and an area 830 that displays the similarity score of each hit code 310. Note that highlighting includes changing the display color, changing the font size, changing the background color, adding a mark, etc.

[0045] In the illustrated example, the output unit 107 highlights the similar basis line (part) P1 of the query code 200 for group 1, and displays the hit code 311 (similarity score "0.83") and the hit code 313 (similarity score "0.71") included in group 1 in descending order of similarity score from top to bottom. Also, the output unit 107 highlights the similar basis line (part) P2 of the query code 200 for group 2, and displays the hit code 312 (similarity score "0.94") and the hit code 313 (similarity score "0.77") included in group 2 in descending order of similarity score from top to bottom.

[0046] This allows the user to check hit codes by dividing them into groups with the same similar basis row of the query code 200. In other words, the user can easily understand the similarity basis of which part (similar basis row) of the query code 200 each hit code is similar to.

[0047] As described above, the search system 10 of this embodiment includes a similar code search unit 102 that searches for one or more similar texts (similar codes) that are similar to a query text (query code) from multiple search target texts (search target codes); a contribution rate calculation unit 103 that calculates, for each similar text, a first contribution rate that represents the degree to which each part of the query text contributes to the similarity between the similar text and the query text; a similarity basis identification unit 106 that identifies, for each similar text, a part whose first contribution rate is equal to or greater than a predetermined threshold as a first similarity basis part that becomes a part of the query text that justifies the similarity between the query text and the similar text; and an output unit 107 that outputs the similar text and the first similarity basis part.

[0048] That is, the search system of this embodiment can extract and output potential similarity basis portions in the query text for each similar text, thereby identifying similar texts that are similar to the query text along with their similarity basis portions.

[0049] Furthermore, the search system 10 of this embodiment generates a vector for each similar text using the first contribution rate of each part of the query text as a feature, clusters the generated vectors to generate groups, calculates an average contribution rate, which is the average value of the first contribution rates for each part of the query text, identifies the part with an average contribution rate equal to or greater than a threshold as the first similar basis part of the group, and outputs the similar text and the first similar basis part for each group.

[0050] That is, the search system 10 of this embodiment can automatically classify (group) similar texts that have the same portion of the query text that serves as the basis for similarity, and output the texts by grouping them according to the basis for similarity. That is, the search system 10 outputs groups of similar code that have the same basis for similarity so that they can be identified along with the basis for similarity. This allows the user to check similar texts that have the same basis for similarity all at once.

[0051] Furthermore, the search system 10 of this embodiment highlights the first similarity basis portion in the query text in association with the similar text for each group.

[0052] This allows the user to easily understand similar texts that have the same basis for similarity and the basis for similarity.

[0053] Furthermore, the search system 10 of this embodiment calculates the similarity between the query text and the search target text based on the word embedding vector of the text.

[0054] This makes it possible to calculate the similarity between the query text and the search target text with higher accuracy.

[0055] In addition, the query text and the search target text in this embodiment are source codes.

[0056] This allows us to search for code similar to the query code along with the reason for the similarity from the search target code. For example, during code review, we can efficiently identify query code with a bug (fault, etc.) and code with similar bugs.

[0057] In addition, the search system 10 of this embodiment calculates, for each similar code, a first contribution rate that represents the degree to which each line of the query code contributes to the similarity between the similar code and the query code, and for each similar code, identifies a line whose first contribution rate is equal to or greater than a predetermined threshold as the first similarity basis part.

[0058] By calculating the first contribution rate for each line of the query code in this manner, it is possible to identify similarity basis parts of the query code for each similar code with higher granularity.

[0059] [Second embodiment] Next, a search device, a search method, and a search program according to the second embodiment will be described. In the first embodiment, only similar basis lines in the query code 200 are identified, but in this embodiment, similar basis lines in the hit code 310 are also identified. The configuration of the search system 10 in this embodiment is the same as in the first embodiment, and therefore a description thereof will be omitted.

[0060] <Processing Overview> 7 is a processing flow diagram illustrating an outline of processing performed by the search system 10 in the second embodiment. The processing shown in this diagram is executed, for example, when a query code 200 is input to the search system 10 by a user.

[0061] The processes of S201 to S206 are the same as the processes of S101 to S106 in the first embodiment, and therefore the description thereof will be omitted.

[0062] Following S206, the contribution rate calculation unit 103 uses the query code 200, the multiple hit codes 310, and the similarity score calculation model 112 to calculate a second contribution rate for each hit code 310, for example, by SHAP or the like, which represents the degree to which each line of the hit code 310 contributes to an increase in the similarity (similarity score) between the similar code and the query code 200 (S207). The second contribution rate is, for example, a Shapley value representing the degree of influence on the similarity score using each line of the hit code 310 as a feature. For example, when calculating the second contribution rate for the (n)th line of the hit code 310, the contribution rate calculation unit 103 inputs the query code 200 and the hit code 310 from which the (n)th line has been deleted into the similarity score calculation model 112 to calculate the similarity score of the hit code 310, and compares the calculated similarity score with the similarity score calculated by the similar code search unit 102 to calculate the second contribution rate.

[0063] Next, the similarity basis identification unit 106 identifies, for each hit code 310, a line whose second contribution rate is equal to or greater than a predetermined threshold β (for example, 0.2), as a similarity basis line of the hit code 310 (S208). The similarity basis line of the hit code 310 corresponds to a "second similarity basis part," which is a part of the hit code 310 that provides evidence of the similarity between the query code 200 and the hit code 310.

[0064] Next, the output unit 107 outputs, for each group, the hit code 310, the similar basis row of the hit code 310, and the similar basis row of the query code 200 (S209). For example, the output unit 107 displays the second similar code search result 900. Then, the process ends.

[0065] (Second similar code search result) 8 is a diagram showing an example of a second similar code search result 900 in the second embodiment. In the second similar code search result 900 shown in this figure, the output unit 107 highlights (emphasizes) the similar basis line (portion) for each hit code. Other display contents of the second similar code search result 900 are the same as those of the first similar code search result 300 in the first embodiment, and therefore description thereof will be omitted.

[0066] In the illustrated example, the output unit 107 highlights the similar basis line P11 of the hit code 311, highlights the similar basis line P12 of the hit code 312, and highlights the similar basis line P13 of the hit code 313.

[0067] This allows the user to easily understand which part (similar basis row) in each hit code is similar to the query code 200.

[0068] As described above, the search system 10 of this embodiment calculates, for each similar text, a second contribution rate that represents the degree to which each part of the similar text contributes to the similarity between the similar text and the query text, and for each similar text, identifies the part where the second contribution rate is equal to or greater than a predetermined threshold as a second similarity basis part, which is the part of the similar text that justifies the similarity between the query text and the similar text, and outputs the similar text, the first similarity basis part, and the second similarity basis part.

[0069] That is, the search system 10 of this embodiment can identify and output similarity basis portions in the similar text for each similar text, thereby making it possible to easily identify portions in the similar text that are similar to the query text.

[0070] The present invention is not limited to the above-described embodiments, and can be implemented using any components within the scope of the present invention. The above-described embodiments and modifications are merely examples, and the present invention is not limited to these contents as long as the characteristics of the invention are not impaired. Furthermore, although various embodiments and modifications have been described above, the present invention is not limited to these contents. Other aspects conceivable within the scope of the technical idea of the present invention are also included within the scope of the present invention.

[0071] For example, part of the hardware provided in each device of this embodiment may be provided in another device.

[0072] Furthermore, each program of each search system 10 may be provided in another device, a program may consist of multiple programs, or multiple programs may be integrated into one program.

[0073] In addition, in the above-described embodiment, the search system 10 is described as searching for the source code of a program, but this is not limited to this, and the search target may also be other text information, such as log information of a computer system.

[0074] Furthermore, in the above-described embodiment, the similar basis identification unit 106 identifies a row whose average contribution rate is equal to or greater than a threshold value α or a row whose contribution rate is equal to or greater than a threshold value β as a similar basis row. However, if a predetermined condition is satisfied, a portion of multiple rows, including the rows between one similar basis row and the next similar basis row, may be identified as a similar basis portion. For example, if the average contribution rate of the first, third, and fourth rows is equal to or greater than the threshold value α, the similar basis identification unit 106 may identify the portion of the first to fourth rows, including the second row, as a similar basis portion. Examples of the predetermined condition include the number of rows between one similar basis row and the next similar basis row being equal to or less than a predetermined number (e.g., one row), or the average contribution rate or contribution rate of the rows between one similar basis row and the next similar basis row being equal to or greater than a predetermined threshold value γ that is smaller than the threshold value α or threshold value β. When the similar basis portion is identified by the similar basis identification unit 106, the output unit 107 may highlight the similar basis portion.

[0075] Furthermore, in the above-described embodiment, the hit codes are grouped, but this is not limiting. For each hit code, a line of the query code 200 whose contribution rate is equal to or greater than the threshold value α may be identified as a similar basis line without grouping. In this case, the output unit 107 may display a list of the hit codes together with the similar basis lines of the query code 200 without grouping them. [Explanation of symbols]

[0076] 10 Search System 101 Input section 102 Similar Code Search Section 103 Contribution Rate Calculation Unit 104 Group Decision Department 105 Group Contribution Rate Calculation Unit 106 Similarity basis identification unit 107 Output section

Claims

1. a processor and a memory; a search unit that searches a plurality of search target texts for one or more similar texts that are similar to an input query text; a contribution rate calculation unit that calculates, for each similar text, a first contribution rate that indicates a degree to which each part of the query text contributes to a similarity between the similar text and the query text; a similarity basis identification unit that identifies, for each similar text, a portion where the first contribution rate is equal to or greater than a predetermined threshold, as a first similarity basis portion that is a portion of the query text that provides evidence of similarity between the query text and the similar text; an output unit that outputs the similar text and the first similarity basis portion; A search device comprising:

2. a group determination unit that generates a vector for each similar text using the first contribution rate of each part of the query text as a feature, and clusters the generated vectors for each similar text to generate groups of the vectors; a group contribution rate calculation unit that calculates, for each group, an average contribution rate that is an average value of the first contribution rates for each part of the query text; Equipped with the similarity basis identification unit identifies a portion where the average contribution rate is equal to or greater than the threshold as the first similarity basis portion of the group; the output unit outputs the similar text and the first similarity basis part for each of the groups. The search device according to claim 1 .

3. the output unit highlights the first similarity basis portion of the query text in association with the similar text for each of the groups. The search device according to claim 2 .

4. the contribution rate calculation unit calculates, for each similar text, a second contribution rate representing a degree to which each portion of the similar text contributes to a similarity between the similar text and the query text; the similarity basis identification unit identifies, for each similar text, a portion where the second contribution rate is equal to or greater than a predetermined threshold, as a second similarity basis portion that is a portion of the similar text that provides evidence of similarity between the query text and the similar text; the output unit outputs the similar text, the first similarity basis portion, and the second similarity basis portion. The search device according to claim 1 .

5. the search unit calculates the similarity between the query text and the search target text based on a word embedding vector of the text; The search device according to claim 1 .

6. the query text and the search target text are source code; The search device according to claim 1 .

7. the contribution rate calculation unit calculates, for each similar text, a first contribution rate representing a degree to which each line of the query text contributes to a similarity between the similar text and the query text; the similarity basis identification unit identifies, for each similar text, a line in which the first contribution rate is equal to or greater than a predetermined threshold as the first similarity basis portion; The search device according to claim 6.

8. The information processing device a search process for searching one or more similar texts similar to the input query text from a plurality of search target texts; a contribution rate calculation process for calculating, for each similar text, a first contribution rate representing a degree to which each part of the query text contributes to a similarity between the similar text and the query text; a similarity basis identification process for identifying, for each similar text, a portion of the similar text where the first contribution rate is equal to or greater than a predetermined threshold, as a first similarity basis portion that is a portion of the query text that provides evidence of similarity between the query text and the similar text; an output process for outputting the similar text and the first similarity basis portion; The search method to perform.

9. In the information processing device, a search process for searching one or more similar texts similar to the input query text from a plurality of search target texts; a contribution rate calculation process for calculating, for each similar text, a first contribution rate representing a degree to which each part of the query text contributes to a similarity between the similar text and the query text; a similarity basis identification process for identifying, for each similar text, a portion of the similar text where the first contribution rate is equal to or greater than a predetermined threshold, as a first similarity basis portion that is a portion of the query text that provides evidence of similarity between the query text and the similar text; an output process for outputting the similar text and the first similarity basis portion; A search program that executes the following.

Citation Information

Patent Citations

  • Context-Aware Data Mining

    JP2022536241A

  • Systems and methods for machine learning interpretability

    JP2022552980A