A new software defect location method based on query expansion

Through the query extension method, the method of quickly locate defects in complex software systems using natural language processing and word vector model, the problem of low positioning efficiency of software defects is solved, and the repair efficiency and code quality are improved.

CN114546699BActive Publication Date: 2024-12-20BEIJING UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210173115.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-24
Publication Date
2024-12-20
Estimated Expiration
2042-02-24

AI Technical Summary

Technical Problem

In complex software systems, it is difficult to quickly locate software defects, resulting in low repair efficiency, affecting software quality and development costs.

Method used

Using a query extension method, through natural language processing and word vector model, defect reports are matched with source code methods, semantic similarity, modification of proximity and dependency density are calculated, and the method representation is extended to improve positioning accuracy.

Benefits of technology

It realizes a method of quickly and accurately identifying the defects from massive source code, reduces the workload of developers, and improves the efficiency of software defect repair and code quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114546699B_ABST
    Figure CN114546699B_ABST
Patent Text Reader

Abstract

The present invention discloses a new software defect location method based on query expansion. The method performs natural language processing on the text content of historical defect reports and software source codes, and adopts the above corpus to train a word vector model; obtains the text vector of each method in the source code by combining the word vector with the TF-IDF value of the term; calculates the semantic similarity between the methods, modifies the proximity and the dependency closeness, and obtains the comprehensive correlation between the methods; expands the text vector of the method according to the comprehensive correlation, and obtains the extended representation vector of the method; calculates the text vector of the new defect report, calculates the similarity with the extended representation of all methods respectively, and selects several methods with the highest similarity as the methods corresponding to the defect report; the present invention provides clear defect location information to software developers and project managers, reduces the workload of defect repair personnel in finding defects from the massive methods in the source code, and improves the work efficiency of software defect repair.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a new software defect positioning method based on query expansion, belonging to the technical field of computer software development. Background Art

[0002] Software defects refer to certain problems, errors, or hidden functional defects in computer software or programs that damage the normal operation capability. The existence of defects will cause the software product to fail to meet the needs of users to some extent. Therefore, software defect repair is an important task in the full life cycle management of software systems. The efficiency of software defect repair directly affects the time and financial costs of software development projects, affects the user experience, and may cause significant financial losses or even casualties due to software defects. For software defects exposed during software development, testing or use, quickly and accurately locating the source code files and methods corresponding to the defects is the key to high-quality software defect repair. How to efficiently locate software defects has also become a key issue that has attracted widespread attention from industry and academia.

[0003] In order to improve the efficiency of repairing software defects, software defect tracking systems such as Bugzilla and JIRA are widely used in defect report management during the software development process. When developers encounter problems caused by software defects during software development and testing, or when users encounter problems caused by software defects during the use of software, they submit defect reports to the software defect tracking system. The defect report is verified by the defect verifier, and the verified defect report is assigned to the developer for repair. Based on the information provided in the defect report, the developer locates the specific files and methods that cause the software defect from the software source code and repairs them. After the repaired software defect passes the test by the tester, the defect report status is updated to "Fixed" in the software defect tracking system.

[0004] At present, with the diversification of software system functions and the increasing complexity of the system, the number of source code files and the number of methods contained in the software system are increasing. At the same time, there are intricate calling relationships between the methods of the software system. These problems hinder software developers from quickly and accurately locating the specific location of software defects. In addition, the increasing complexity of software systems also makes software systems more prone to defects. Taking the world-renowned open source software Eclipse as an example, the number of software defect reports received by its software defect warehouse is on the rise.

[0005] Therefore, in order to improve the efficiency of locating defect reports during software development, operation, and maintenance, the present invention provides a set of fine-grained method-level software defect location methods based on query expansion. According to the information in the software defect report, the source code files and methods corresponding to the defect are quickly and accurately located. This helps developers reduce the workload of finding defects from massive source code files and methods, improves the efficiency of software defect repair, and enhances the level of software quality control and quality assurance. Summary of the invention

[0006] In view of the importance of software defect location and the limitations of existing manual methods, the present invention provides a new software defect location method based on query expansion. The purpose of the present invention is to locate the file and method where the defect exists from the software source code according to the defect report content.

[0007] The technical contents of the present invention are:

[0008] A new software defect location method based on query expansion, the steps of which are:

[0009] 1) Export the submitted historical defect report data from the software defect tracking system, and extract the summary text, description text, and comment text of each defect report.

[0010] 2) Perform natural language processing on the text content of historical defect reports, build a defect report dictionary consisting of each word in the defect report text, and represent the defect report in vector form using a bag of words model.

[0011] 3) Export software source code and code modification submission records from the software project code repository.

[0012] 4) According to the software source code extracted in 3), extract the terms and their frequency contained in each method in the source code, apply natural language processing methods to preprocess them, build a source code dictionary composed of each term in the source code, and represent each method in vector form using a bag of words model.

[0013] 5) Based on the text vectors of each defect report obtained in 2) and the terms contained in each method obtained in 4), a "term-vector (word2vec)" model is trained to obtain the word vector corresponding to each term in the dictionary.

[0014] 6) Based on the terms and word frequencies contained in each method obtained in 4), the TF-IDF value of each term in each method is calculated, and combined with the word vector obtained in 5), the method text is converted into a text vector.

[0015] 7) Based on the text vector corresponding to each method obtained in 5), calculate the semantic similarity between any two algorithms in the source code.

[0016] 8) Based on the code modification submission records obtained in 3), obtain the time of the latest modification of each method in the source code, and use this to calculate the modification proximity between any two algorithms in the source code.

[0017] 9) Based on the software source code obtained in 3), extract the dependencies between the methods, and use this to calculate the dependency density between any two algorithms in the source code.

[0018] 10) Based on the semantic similarity obtained in 7), the modification proximity obtained in 8), and the dependency closeness obtained in 9), for any method, find several other methods with similarities higher than the average level, and use the text vectors of these similar methods to expand the method to obtain an extended representation of the method.

[0019] 11) Extract the latest submitted defect report from the software defect tracking system, apply the same text preprocessing method as in 2), and use the word vector obtained in 5) to convert the defect report into a text vector.

[0020] 12) Calculate the text vector of the newly submitted defect report, calculate the similarity with the extended representations of all methods, and select several methods with the highest similarity as the methods corresponding to the defect report.

[0021] Furthermore, the defect report refers to a description of a problem, error, or hidden functional defect in a computer software or program that disrupts normal operation, submitted to a software project defect report tracking system (such as JRIA, Bugzilla, etc.). The defect report consists of a summary, description, comments, etc.

[0022] Furthermore, natural language processing is performed on the text content of the defect report, including English word segmentation, removal of stop words, removal of program code reserved characters, and stem extraction. Through the above steps, the terms contained in each software defect report are obtained, and all non-repeated terms contained in all defect reports are formed into a dictionary.

[0023] Furthermore, the "bag of words" model refers to a representation of a text composed of words contained in a text content and their corresponding word frequencies.

[0024] Furthermore, the "vector-to-term (word2vec)" model refers to a word embedding model in the field of natural language processing that can preserve the relevance and similarity between words. Its basic structure is a lightweight neural network that maps each term in the text to a vector of a specified length through the training method of predicting the middle word from the context (CBOW) or predicting the context from the middle word (Skip-gram).

[0025] Furthermore, the "TF-IDF value" refers to a statistical method used to evaluate the importance of a term to a text, where TF refers to term frequency and IDF refers to inverse document frequency. The importance of a term in a text increases in direct proportion to the number of times it appears in the text, but decreases in inverse proportion to the frequency of its appearance in the entire corpus.

[0026] Furthermore, in order to more accurately represent the semantics of each method in the source code, this patent combines the IT-IDF method with the word2vec word vector construction method, and the TF-IDF value is used to weight the word vector of each term in the text, thereby obtaining an effective representation of the method semantics.

[0027] Furthermore, the cosine similarity between text vectors is used to calculate the text semantic similarity between the two methods.

[0028] Furthermore, the modification proximity between the two methods is calculated by dividing the time difference of the most recent modification between the two methods by the mean of the time difference of the most recent modification between any two methods, and then normalizing it to the range of [0,1] using the sigmoid function.

[0029] Furthermore, the Abstract Syntax Tree method is used to extract the dependencies between methods from the software source code, construct a method dependency graph, and calculate the dependency density between two methods according to the length of the calling path between the two methods.

[0030] Furthermore, for each method, a weighted sum is performed based on its semantic similarity, modification proximity, and dependency closeness with other methods to obtain the comprehensive correlation between the method and any other method. The average comprehensive correlation between all method pairs can be obtained by averaging the comprehensive correlation between them.

[0031] Furthermore, for each method, other methods with a comprehensive relevance higher than the average comprehensive relevance are selected, and the method is expanded by weighted summing of the text vectors of these methods through similarity.

[0032] Furthermore, for the newly submitted defect report, after converting it into a vector representation, the similarity is calculated with the expanded vector representation of all methods using cosine similarity. The method with higher similarity is more likely to be the source code location corresponding to the defect report.

[0033] The core content of the present invention is described below.

[0034] The overall framework of the method of the present invention is shown in the accompanying drawings. Specifically, a new software defect location method based on query expansion, the steps of which are:

[0035] 1. Build a historical dataset of defect reports and construct word vectors.

[0036] The purpose of this phase is to extract historical defect report data from the defect report tracking system. First, extract historical defect report data from the system, including the summary text, description text, and comment text of each defect report. Second, perform text preprocessing on the historical defect report text data to build a defect report corpus for training the word2vec model.

[0037] The specific steps are as follows:

[0038] (1) Export historical defect reports

[0039] According to the software defect tracking system (JRIA, Bugzilla, etc.) selected by the software development project, the existing software defect reports are exported from it, including the summary text, description text, and comment text of each defect report. All defect reports in the software defect tracking system form a defect report set B = {br1, br2, ..., br m}, where br i represents a defect report, and m represents the total number of historical defect reports in the defect tracking system.

[0040] (2) Defect report text preprocessing 1 - word segmentation

[0041] For English defect reports, all the words in the text are converted to lowercase letters, and the sentences are segmented using spaces and punctuation marks to obtain the words contained in each defect report. For Chinese defect reports, Chinese word segmentation tools such as Jieba word segmentation and pkuseg are used to divide the defect reports into words.

[0042] (3) Defect report text preprocessing 2 - Removing stop words

[0043] For English defect reports, we use 100 text stop words from the USPTO patent full text and image database and the reserved keywords in the development language corresponding to the additional software to form a stop word list, and remove the stop words contained in the defect report. For Chinese defect reports, we replace the text stop words with Chinese text stop words, such as the Harbin Institute of Technology stop word list, Baidu stop word list, etc.

[0044] (4) Defect report text preprocessing 3 - extracting stems

[0045] For the terms contained in the English defect report, the stem of each term is extracted through the Porter algorithm to avoid ambiguity caused by word form changes. For Chinese defect reports, this step is not required. Defect report after text preprocessing i The bag-of-words form is

[0046] 2. Extraction and representation of methods in source code

[0047] The purpose of this stage is to extract all the source code of the software system, parse the source code, extract all the methods contained in the source code, and the calling relationships between the methods. And through natural language processing technology, the text content of each method is converted into a vector representation.

[0048] (1) Extract source code

[0049] Extract the latest version of the software source code from the code repository of the software project. Depending on the type of code repository, use tools such as Git, SVN, etc. to download the code from the code repository to your local computer.

[0050] (2) Analyze the methods and dependencies in the source code

[0051] Use the Abstract Syntax Tree to parse the source code and obtain the text content of each method and the dependency graph between methods from the source code.

[0052] (3) Obtain source code modification records

[0053] Use code version management tools such as Git, CVS, etc. to obtain the modification submission history of the source code

[0054] (4) Obtain the text corpus for each method in the source code

[0055] The text content of each method is converted to lowercase synonymously. According to the language type of the source code (such as Java, etc.), the reserved keywords in the corresponding programming language are removed from the method text of the source code. Then, the Porter algorithm is used to extract the stem of each word in the method to avoid ambiguity caused by word form conversion. i Represented as bag of words

[0056] (5) Integrate code text corpus and bug report text corpus to train word vector model

[0057] The processed defect report text corpus and method text corpus are input into the word-vector (word2vec) model to train the word vector corresponding to each word in the corpus. j Can be converted into the corresponding L-dimensional word vector v j =(v j,1 ,v j,2 ,...,v j,L ). The trained word vectors are used to convert all method text contents in the source code into vector representations and to convert newly submitted defect reports into vector representations.

[0058] (6) Calculation method for the TF-IDF value of each term

[0059] The TF-IDF value takes into account the j In a method m i The frequency of its occurrence in , and its frequency in all methods, gives the term w j In method m i The degree of importance in the calculation method is:

[0060] tfidf(w j )=tf(w j )×idf(w j )

[0061] Among them, tf(w j ) is the term w j In m i Term Frequency, idf(w j ) is the term w j The calculation method of the inverse document frequency index in the entire corpus is:

[0062]

[0063]

[0064] in, Represents the term w j In the text bow i The frequency of occurrence in Indicates that it contains the term w j The number of methods in the current software source code, |M| represents the total number of methods contained in the current software source code. According to the above formula, each method m can be calculated i Text of bow i Each term w in j Importance evaluation tfidf(w j ).

[0065] (7) Representing method text as a vector

[0066] First, according to each method m obtained in (3) i Bag of words And the word vector obtained in (4), each word w i,j Replace with vector v i,j , and then get

[0067] Then according to the method m obtained in (5) i The TF-IDF value of each term in bow i Each word vector in is weighted to obtain

[0068] Next, according to bow i The weighted word vector in the method m takes the maximum value in each dimension. i Represented as an L-dimensional vector

[0069] 3. Method extension

[0070] The purpose of this stage is to calculate the semantic similarity, modification proximity, and dependency closeness between methods, and to combine the above three similarities to obtain the comprehensive correlation between any two methods in the source code. i , select other methods with higher comprehensive correlation, expand the text vector of this method, and solve the sparsity problem of the representation vector of the method.

[0071] (1) Calculation of semantic similarity between methods

[0072] Method m i and m k The semantic similarity between i ,m k ) is the cosine similarity between their corresponding text vectors

[0073] (2) Modification proximity between calculation methods

[0074] Extract method m from the code version management tool i The last modification time of i , then method m i and m k The difference between the last modification time and the last modification time is |t i -t k |, their modified proximity tp(m i ,m k )for:

[0075]

[0076] Where N is the total number of methods contained in the source code, It represents the mean of the difference between the latest modification time of any two methods. The sigmoid function is used to normalize the similarity to the range of (0,1).

[0077] (3) Dependence between calculation methods

[0078] According to the dependency graph between methods obtained by using the abstract syntax tree, we can get any two methods m i and m k The shortest call path length lp(m i ,m k ). Then method m i and m k The dependence density between them cd(m i ,m k )for:

[0079]

[0080] Among them, if method m i and m k There is a dependency relationship between them, then δ(m i ,m k )=1, if there is no dependency between the two, then δ(m i ,m k )=0,cd(m i ,m k )=0. It is the mean of the shortest calling paths between any two methods.

[0081] (4) Comprehensive correlation between calculation methods

[0082] According to the method m obtained in (1) to (3) i and m kThe semantic similarity between i ,m k ), modify the proximity tp(m i ,m k ), dependence density cd(m i ,m k ), and the comprehensive correlation between the two methods can be obtained by weighted summation:

[0083] ac(m i ,m k )=α×ss(m i ,m k )+β×tp(m i ,m k )+γ×cd(m i ,m k )

[0084] Among them, α, β, and γ are weight parameters of the three types of similarity.

[0085] (5) Expand the text vector of the method

[0086] According to the comprehensive correlation between any two methods obtained in (4), the average comprehensive correlation between any two methods can be obtained as follows: For each method m i , select the text vector doc of other methods with comprehensive relevance higher than the average similarity k And the comprehensive correlation ac(m i ,m k ) is used to expand the method, and the expanded method is Where K is the number of methods whose comprehensive correlation is greater than the average similarity.

[0087] 4. Defect method level location

[0088] The purpose of this stage is to locate the methods in which the defect may appear based on the defect report newly submitted to the software defect tracking system. By converting the text content in the newly submitted defect report into a text vector, and then calculating the correlation between the two with the expanded vector representation of each method, and arranging them in descending order according to the correlation, the most likely method location corresponding to the defect in the source code is given.

[0089] (1) Extracting text content from new defect reports

[0090] Extract three types of text information from the defect tracking system: summary text, description text, and comment text of the newly submitted defect report.

[0091] (2) Perform natural language processing on the text content of new defect reports

[0092] The same steps as the historical defect reports are used to perform natural language processing on the newly submitted defect reports, including word segmentation, stop word removal, and stem extraction (the same as (2), (3) and (4) in 1), and then the newly submitted defect reports are br new Convert to bag-of-words representation

[0093] (3) Convert the new defect report into a vector representation

[0094] Use the word vector trained in 2.(5) above to convert the defect report text content into a word vector representation Take the maximum value for each dimension of the word vector Represent the text content of the bug report as an L-dimensional vector doc new .

[0095] (4) Find the similarity between the new defect report and each method

[0096] Use cosine similarity to calculate the representation vector of the new defect report doc new The expanded representation vector of each bug report The correlation

[0097] (5) Provide method locations where new defect reports may appear

[0098] According to the correlation between the defect report and all methods obtained in (4), they are sorted in descending order. The higher the ranking of the method, the more likely it is that it is the source code location corresponding to the defect.

[0099] Compared with the prior art, the present invention has the following positive effects:

[0100] First, the present invention is a fine-grained defect location technology, which further refines the granularity of defect location from the file level to the method level. For large software projects, each file often contains multiple methods. Compared with traditional file and defect location technology, the present invention locates defects on specific methods, provides software developers and project managers with clearer location information, reduces the workload of defect repair personnel to check a large number of methods one by one from a large number of files, and improves the efficiency of software defect repair. At the same time, locating specific methods helps project developers to improve the code structure, sort out the complex dependencies and calling relationships between methods, and improve the overall quality level of the code. Second, the present invention overcomes the vector sparsity problem caused by the small amount of effective text content of a single method by screening other closely related methods. At the same time, the semantic similarity, modification proximity and dependency closeness between different methods are considered, and the correlation between source codes is considered from multiple dimensions. BRIEF DESCRIPTION OF THE DRAWINGS

[0101] Figure 1 This is a framework diagram of a software defect report repair method of the present invention. DETAILED DESCRIPTION

[0102] The method is further described below through specific implementation methods.

[0103] 1. Extract and process historical defect report data

[0104] Specifically, it includes the following two steps.

[0105] (1) Extracting historical defect report data

[0106] Connect to the defect tracking system of the software project to obtain historical defect report data. Generally, the description information of each defect report includes summary, description, predefined fields, developer comments, etc.

[0107] This method extracts three types of text information from the defect tracking system: the summary, description, and developer comments of the defect report. According to different types of defect tracking systems, the required text information can be directly exported to the database using the corresponding export function. The exported text data is mainly used to build a corpus, train a word vector model, obtain word vectors suitable for software defect location scenarios, and then convert newly submitted software defect reports into numerical vector representations.

[0108] (2) Preprocessing defect report data

[0109] Perform natural language processing on the text data of the defect report, including word segmentation, stop word removal, and stem extraction (English). In the word segmentation stage, for English defect reports, after converting all English letters to lowercase letters, spaces and punctuation marks can be used directly for word segmentation. For Chinese defect reports, Chinese-specific word segmentation tools such as Jieba should be used. In the stop word removal stage, for the application scenario of defect report positioning, in addition to the typical stop word dictionary commonly used in text processing, the reserved keywords of the corresponding development language need to be added to the stop word dictionary according to the development language type of the software project, and removed according to the custom stop word dictionary. In the stem extraction stage, for English defect reports, the Porter algorithm is used to extract stems, and this step is not required for Chinese defect reports.

[0110] 2. Extracting and processing method data

[0111] Specifically, it includes the following 4 steps

[0112] (1) Extraction method

[0113] First, extract all the source code of the project from the code management warehouse of the software development project. Then use the abstract syntax tree tool to analyze the project source code, extract each method in the source code, and obtain the dependency relationship between different methods to form a code dependency graph. In addition, export the modification history of the source code through project version management tools such as Git and CVS, and parse it to obtain the latest modification time of each method.

[0114] (2) Method processing

[0115] First, the text content of the method is preprocessed, including word segmentation, stop word removal, and word stem extraction. In the word segmentation stage, after all English letters are converted to lowercase letters, spaces and punctuation marks can be used directly for word segmentation. In the stop word removal stage, for the application scenario of defect report positioning, in addition to the typical stop word dictionary commonly used in text processing, it is necessary to add the reserved keywords of the corresponding development language to the stop word dictionary according to the development language type of the software project, and remove them according to the custom stop word dictionary. In the stem extraction stage, the current mainstream programming languages ​​are all English codes, and the Porter algorithm is used to extract stems.

[0116] (3) Constructing word vectors

[0117] The preprocessed defect report text corpus and method text corpus are used to train the word vector model (word2vec), and an L-dimensional word vector is constructed for each word in the corpus for subsequent text vectorization representation.

[0118] (4) Vectorized Representation of Method Text

[0119] For the text content of each method, firstly, the terms in the text content are converted into corresponding word vectors according to the word vectors trained in (3). Secondly, the TF-IDF value of each term in the text of each method is calculated, and the corresponding word vector is weighted according to the TF-IDF value. Finally, according to each dimension of the word vector, the maximum value of all terms in this dimension is taken, and the method is represented as an L-dimensional vector.

[0120] 3. Method extension

[0121] Specifically, it includes the following 5 steps:

[0122] (1) Calculate semantic similarity

[0123] According to the L-dimensional text vector of each method obtained above, the semantic similarity between any two methods is obtained by cosine similarity calculation.

[0124] (2) Calculate modification proximity

[0125] According to the latest modification time of each method extracted from the code version control system, the modification proximity between any two methods is calculated.

[0126] (3) Calculate the degree of dependency

[0127] According to the method dependency graph extracted from the source code using the abstract syntax tree, the shortest calling path between any two methods is found. And according to the shortest calling path and the average shortest calling path between the two methods, the dependency closeness between the two methods is obtained (if there is no dependency relationship between the two methods, the dependency closeness value is 0).

[0128] (4) Calculation of comprehensive correlation

[0129] According to the semantic similarity, modification proximity, and dependency closeness calculated above, a weighted sum is calculated to obtain the comprehensive correlation between any two methods.

[0130] (5) Representation vector of the extended method

[0131] First, based on the aforementioned comprehensive correlation, the average comprehensive correlation between any two methods can be calculated. Then, for each method, according to its comprehensive correlation with all other methods, several other algorithms with a comprehensive correlation greater than the average are selected to expand the method. Secondly, based on the comprehensive correlation and the text representation vector of the method, a weighted sum is performed to obtain the expanded method representation vector.

[0132] 4. New defect report method-level positioning

[0133] Specifically, it includes the following two steps

[0134] (1) Extracting new defect report data

[0135] Extract the summary, description, and comment text information of the latest defect report from the defect report tracking system, and convert the defect report text content into a numerical vector representation based on the word vector constructed above.

[0136] (2) Positioning defect report

[0137] The cosine similarity between the defect report vector and all the expanded method representation vectors is calculated respectively, and the similarities are arranged in descending order. The higher the ranking, the more likely it is that the method where the defect occurs.

[0138] The above content has described in detail a method for locating new software defects based on query expansion of the present invention, but it is obvious that the specific implementation of the present invention is not limited thereto. For those skilled in the art, various obvious changes made to it without departing from the spirit of the present invention and the scope of the claims are within the protection scope of the present invention.

Claims

1. A new software defect location method based on query expansion, characterized in that: The method comprises the following steps: 1) Export the submitted historical defect report data from the software defect tracking system, and extract the summary text, description text, and comment text of each defect report; 2) Perform natural language processing on the text content of historical defect reports, construct a defect report dictionary consisting of each word in the defect report text, and represent the defect report in vector form using the bag-of-words model; 3) Export software source code and code modification submission records from the software project code repository; 4) According to the software source code extracted in 3), extract the terms and their frequency contained in each method in the source code, apply natural language processing methods to pre-process them, build a source code dictionary composed of each term in the source code, and represent each method in a vector form using a bag-of-words model; 5) training a "term-vector" model based on the text vectors of each defect report obtained in 2) and the terms contained in each method obtained in 4), and obtaining the word vector corresponding to each term in the dictionary; 6) According to the terms and word frequencies contained in each method obtained in 4), the TF-IDF value of each term in each method is calculated, and combined with the word vector obtained in 5), the method text is converted into a text vector; 7) Based on the text vector corresponding to each method obtained in 6), calculate the semantic similarity between any two algorithms in the source code; 8) According to the code modification submission record obtained in 3), obtain the latest modification time of each method in the source code, And use this to calculate the modification proximity between any two algorithms in the source code; 9) According to the software source code obtained in 3), the dependency relationship between the methods is extracted, and the dependency density between any two algorithms in the source code is calculated based on the dependency relationship; 10) According to the semantic similarity obtained in 7), the modification proximity obtained in 8), and the dependency closeness obtained in 9), for any method, find several other methods with similarity higher than the average level, and use the text vectors of similar algorithms to expand the method to obtain an expanded representation of the method; 11) Extract the latest defect report submitted from the software defect tracking system, apply the same text preprocessing method as in 2), and use the word vector obtained in 5) to convert the defect report into a text vector; 12) Calculate the text vector of the newly submitted defect report, calculate the similarity with the extended representations of all methods, and select several methods with the highest similarity as the methods corresponding to the defect report; The modification proximity between two methods is calculated by dividing the time difference between the last modification of the two methods by the mean of the time difference between the last modification of any two methods, and then normalizing it to the range of [0,1] using the sigmoid function; The abstract syntax tree method is used to extract the dependency relationship between methods from the software source code, build a method dependency graph, and calculate the dependency density between two methods based on the length of the calling path between the two methods; For each method, a weighted sum is performed based on its semantic similarity, modification proximity, and dependency closeness with other methods to obtain the comprehensive correlation between the method and any other method; the average comprehensive correlation between all method pairs is calculated to obtain the average comprehensive correlation between the methods; For each method, other methods with a comprehensive relevance higher than the average comprehensive relevance are selected, and the method is expanded by weighted summing of the text vectors of these methods by similarity; For newly submitted defect reports, they are converted into vector representations and then compared with the expanded vector representations of all methods using cosine similarity to obtain similarity. The method with higher similarity is more likely to be the source code location corresponding to the defect report.

2. The method for locating new software defects based on query expansion according to claim 1, characterized in that: The defect report refers to a description of a problem, error, or hidden functional defect in a computer software or program that disrupts normal operating capabilities and is submitted to the software project defect report tracking system. The defect report consists of a summary, description, and comments.

3. The method for locating new software defects based on query expansion according to claim 1, characterized in that: The text content of the defect report is processed by natural language processing, including English word segmentation, removal of stop words, removal of program code reserved characters, and stem extraction. The above steps are used to obtain the terms contained in each software defect report, and all non-repeated terms contained in all defect reports are combined into a dictionary.

4. The method for locating new software defects based on query expansion according to claim 1, characterized in that: The bag-of-words model refers to a representation of a text composed of terms contained in the text content and their corresponding word frequencies.

5. The method for locating new software defects based on query expansion according to claim 1, characterized in that: The "term-vector" model refers to a word embedding model in the field of natural language processing that can retain the association and similarity between words; the basic structure of the word embedding model is a lightweight neural network that maps each term in the text to a vector of a specified length by predicting intermediate words through context, or by training intermediate words to predict context.

6. The method for locating new software defects based on query expansion according to claim 1, characterized in that: The TF-IDF value refers to a statistical method for evaluating the importance of a term to a text, where TF refers to term frequency and IDF refers to inverse document frequency. The importance of a term in the text increases in direct proportion to the number of times it appears in the text, but decreases in inverse proportion to the frequency of its appearance in the entire corpus.

7. The method for locating new software defects based on query expansion according to claim 1, characterized in that: The cosine similarity between text vectors is used to calculate the text semantic similarity between the two methods.