Code repository question and answer method, device, equipment and medium

By extracting and utilizing the full-text information and overview information of the first target file and the second target file in the code repository in the code repository, the complexity and efficiency of the Q&A in the existing technology are solved, and efficient, accurate and comprehensive answer generation is achieved.

CN119128119BActive Publication Date: 2025-03-18BEIJING QIHOOD TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411617410.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2025-03-18
Estimated Expiration
2044-11-13

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively reduce the complexity of code warehouse Q&A, improve the efficiency and accuracy of Q&A, and ensure the comprehensiveness and completeness of answers.

Method used

By obtaining target problem information, extracting the first target file and the second target file in the code warehouse, and generating answers based on the full text information of the first target file and the overview information of the second target file, and realizing fine-grained and coarse-grained information extraction to improve the accuracy and comprehensiveness of the question and answer.

Benefits of technology

It reduces the complexity of code repository Q&A, improves the efficiency and accuracy of Q&A, ensures the comprehensiveness and completeness of answers, and can better answer complex code repository questions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119128119B_ABST
    Figure CN119128119B_ABST
Patent Text Reader

Abstract

The present application discloses a code repository question-and-answer method, apparatus, device, and medium. The method includes: obtaining target question information; extracting a first target file and a second target file in a target code repository according to the target question information, wherein the correlation between the second target file and the target question information is less than the correlation between the first target file and the target question information; generating target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file. The method can reduce the complexity of question-and-answering for code repositories, improve the efficiency and accuracy of question-and-answering for code repositories, and ensure the comprehensiveness and completeness of the target answer information finally generated while being able to automatically and efficiently implement question-and-answering for code repositories, so as to better answer complex code repositories questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a code repository question-and-answer method, device, equipment, and medium. Background Art

[0002] Code is a kind of knowledge asset. In order to give full play to the role of existing code assets, the construction of code bases and applications based on code bases are becoming increasingly important. In the process of software development, developers often need to spend a lot of time looking for codes or answers related to the software functions they want to develop or the software development problems they encounter in the code repository as references. Summary of the invention

[0003] The embodiments of the present application provide a code repository question-and-answer method, apparatus, device, and medium, which not only reduces the complexity of question-and-answering for code repositories, improves the efficiency and accuracy of code repository question-and-answering, but also ensures the comprehensiveness and completeness of the target answer information finally generated while ensuring that the code repository question-and-answering can be automatically and efficiently implemented, so as to better answer complex code repository questions. The above technical solution is as follows:

[0004] In a first aspect, an embodiment of the present application provides a code repository question-and-answer method, the method comprising:

[0005] Obtain target question information; extract a first target file and a second target file in a target code repository according to the target question information; the correlation between the second target file and the target question information is less than the correlation between the first target file and the target question information; generate target answer information corresponding to the target question information according to target full-text information corresponding to the first target file and target overview information corresponding to the second target file.

[0006] In one possible implementation, a first target file and a second target file in a target code repository are extracted according to target problem information, including: extracting the first target file in the target code repository according to the target problem information and a target directory tree corresponding to the target code repository; searching a target code graph corresponding to the target code repository according to a target keyword corresponding to the target problem information to obtain target association graph information; and extracting the second target file in the target code repository according to the target association graph information.

[0007] In one possible implementation, the first target file in the target code repository is extracted according to the target question information and the target directory tree corresponding to the target code repository, including: inputting the target question information, the target directory tree corresponding to the target code repository, and the first question and answer analysis prompt word into the target big model, performing a question and answer correlation analysis on the target question information and the target files in the target directory tree based on the first question and answer analysis prompt word through the target big model to obtain the target question and answer correlation analysis result, and outputting the first target file in the target code repository based on the target question and answer correlation analysis result; wherein the first question and answer analysis prompt word includes the first description information corresponding to the first question and answer analysis task that the target big model needs to perform with respect to the target question information and the target directory tree.

[0008] In one possible implementation, the target question-answer correlation analysis result includes the question-answer correlation between the target question information and each target file in the target directory tree; the first target file includes the specified file involved in the target question information, and / or, the target file in the target directory tree whose corresponding question-answer correlation is greater than the first threshold, and / or, the target file in the target directory tree whose corresponding question-answer correlation is ranked within the first target value.

[0009] In a possible implementation, the target code graph is composed of a plurality of nodes and the relationships between the plurality of nodes, and the nodes are used to represent entity information in the target code repository;

[0010] According to the target keyword corresponding to the target problem information, the target code graph corresponding to the target code repository is searched to obtain target association graph information, including: determining the correlation results between each node in the target code graph and the target keyword corresponding to the target problem information; extracting the target association graph information in the target code graph according to the correlation results; the target association graph information includes target association information corresponding to at least one target association node; the target association node is a node in the target code graph that is related to the target keyword.

[0011] In a possible implementation, extracting a second target file in the target code repository according to target association graph information includes: extracting the second target file in the target code repository according to the target association node when the number of the first target files is greater than or equal to the first target value; the second target file is a target association file corresponding to the target association node.

[0012] In a possible implementation, the correlation result includes the correlation between each node in the target code graph and the target keyword corresponding to the target question information;

[0013] After retrieving the target code graph corresponding to the target code repository according to the target keyword corresponding to the target question information and obtaining the target association graph information, before generating the target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree, the method further includes:

[0014] In the case where the number of the first target files is less than the first target value, the target associated file corresponding to the designated target associated node in the target associated graph information is determined as the first target file; the designated target associated node is used to represent a target associated node in at least one target associated node whose corresponding correlation ranking is within the second target value;

[0015] Extracting a second target file in the target code warehouse according to the target association graph information includes: extracting the second target file in the target code warehouse according to the non-specified target association node in the target association graph information; the second target file is a target association file corresponding to the non-specified target association node.

[0016] In one possible implementation, target answer information corresponding to the target question information is generated based on the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file, including: generating target answer information corresponding to the target question information based on the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree corresponding to the target code repository.

[0017] In one possible implementation, target answer information corresponding to target question information is generated based on target full-text information corresponding to the first target file, target overview information corresponding to the second target file, and target directory tree corresponding to the target code repository, including: inputting the target question information, the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, the target directory tree corresponding to the target code repository, and the second question and answer analysis prompt words into the target big model, performing question and answer analysis on the target question information, the target full-text information, the target overview information, and the target directory tree based on the second question and answer analysis prompt words through the target big model, and outputting the target answer information corresponding to the target question information; wherein the second question and answer analysis prompt words include second description information corresponding to the second question and answer analysis task that the target big model needs to perform for the target question information, the target full-text information, the target overview information, and the target directory tree.

[0018] In one possible implementation, after generating target answer information corresponding to the target question information based on the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file, the method also includes: generating target question recommendation information based on historical question and answer information, the target full-text information and the target overview information; the historical question and answer information includes target answer information and / or target question information.

[0019] In one possible implementation, target question recommendation information is generated based on historical question and answer information, target full-text information and target overview information, including: inputting historical question and answer information, target full-text information, target overview information and question recommendation prompt words into a target big model, and outputting target question recommendation information; wherein the question recommendation prompt words include third description information corresponding to the question recommendation task that the target big model needs to perform with respect to the historical question and answer information, target full-text information and target overview information.

[0020] In a possible implementation, obtaining target problem information includes:

[0021] Obtain user question information; pre-process the user question information to obtain target question information; the pre-processing includes translation processing and / or similarity expansion processing; the target question information includes a target question, a translation question and at least one similar question corresponding to the user question information.

[0022] In a second aspect, an embodiment of the present application provides a code warehouse question and answer device, the code warehouse question and answer device comprising:

[0023] Acquisition module, used to obtain target problem information;

[0024] An extraction module, configured to extract a first target file and a second target file in the target code repository according to the target problem information; the correlation between the second target file and the target problem information is less than the correlation between the first target file and the target problem information;

[0025] The answer generation module is used to generate target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file.

[0026] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;

[0027] The processor is connected to the memory;

[0028] A memory for storing executable program codes;

[0029] The processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method provided by the first aspect of the embodiment of this specification or any possible implementation of the first aspect.

[0030] In a fourth aspect, an embodiment of the present specification provides a computer storage medium, which stores multiple instructions, and the instructions are suitable for being loaded by a processor and executing the method provided by the first aspect of the embodiment of the present specification or any possible implementation of the first aspect.

[0031] In one or more embodiments of the present application, the first target file and the second target file in the target code repository are respectively extracted according to the target question information, and the target answer information is generated according to the target full-text information of the first target file that is strongly related to the target question information and the target overview information of the second target file that is weakly related to the target question information. That is, by performing full-text enhancement (i.e., using full-text information) on important files in the target code repository (the first target file that is strongly related to the target question information), and outlining the contents of other relevant files (the second target file that is weakly related to the target question information) (i.e., using overview information), fine-grained extraction of information in the target code repository that is strongly related to the target question information (target full-text information) and coarse-grained extraction of information in the target code repository that is relatively weakly related to the target question information (target overview information) are achieved, and these two types of information with different granularities are used as knowledge to answer the target question information, thereby achieving knowledge enhancement in the process of answering code repository questions, reducing the complexity of question-answering for the code repository, improving the efficiency and accuracy of question-answering for the code repository, and ensuring the comprehensiveness and completeness of the target answer information finally generated while ensuring that the code repository question-answering can be automatically and efficiently achieved, so as to better answer complex code repository questions.

[0032] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A schematic diagram of the architecture of a code repository question-and-answer system provided for an exemplary embodiment of the present application;

[0035] Figure 2 A flowchart of a code repository question-and-answer method provided for an exemplary embodiment of the present application;

[0036] Figure 3 A schematic diagram of the input effect of a target large model corresponding to a question preprocessing prompt word and a first question and answer analysis prompt word provided in an exemplary embodiment of the present application;

[0037] Figure 4 A flowchart of another code repository question-and-answer method provided as an exemplary embodiment of the present application;

[0038] Figure 5 A schematic diagram of the input effect of a target large model corresponding to a second question and answer analysis prompt word provided by an exemplary embodiment of the present application;

[0039] Figure 6 A flowchart of another code repository question-and-answer method provided as an exemplary embodiment of the present application;

[0040] Figure 7 A schematic diagram of the input effect of a target large model corresponding to a question recommendation prompt word provided by an exemplary embodiment of the present application;

[0041] Figure 8 A schematic diagram of the overall implementation process of a code repository question-and-answer method provided by an exemplary embodiment of the present application;

[0042] Fig. 9 A schematic diagram of the structure of a code repository question-and-answer device provided as an exemplary embodiment of the present application;

[0043] Fig.10 A schematic structural diagram of an electronic device provided as an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the features and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0045] The terms "first", "second", "third", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0046] Please refer to the following Figure 1 , which is a schematic diagram of the architecture of a code repository question-answering system provided by an exemplary embodiment of this specification. Figure 1 As shown, the code repository question-answering system may include: a terminal 110 and a server 120. Among them:

[0047] The terminal 110 can interact with the server 120 through the network to receive messages from the server 120 or send messages to the server 120. The terminal 110 can be hardware or software. When the terminal 120 is hardware, it can be various electronic devices, including but not limited to smart watches, smart phones, tablet computers, laptop portable computers and desktop computers. When the terminal 110 is software, it can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules (for example: used to provide distributed services), or it can be implemented as a single software or software module, which is not specifically limited here.

[0048] In an embodiment of the present specification, terminal 110 may be a user terminal corresponding to a user such as a developer who needs to conduct code repository Q&A. When a user wants to ask a question or search for a target code repository, the user may, but is not limited to, input the corresponding target question information into the code repository Q&A software on terminal 110, such as, but not limited to, including the target question text and / or target code to be retrieved related to the target code repository. After acquiring the target question information, terminal 110 may first extract the first target file and the second target file in the target code repository according to the target question information, wherein the correlation between the second target file and the target question information is less than the correlation between the first target file and the target question information; finally, the target answer information corresponding to the target question information is generated according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file.

[0049] Optionally, after the terminal 110 receives the target question information input by the user, it can also directly send the above target question information to the server 120 through the network, so that the server 120 generates and returns the target answer information corresponding to the target question information according to the code repository question and answer method provided in the embodiment of the present application.

[0050] Server 120 can be a server that provides various code repository question and answer services. It should be noted that server 120 can be hardware or software. When server 120 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When server 120 is software, it can be implemented as multiple software or software modules (for example, used to provide distributed services), or it can be implemented as a single software or software module, which is not specifically limited here. Server 120 can be, but is not limited to, a hardware server, a virtual server, a cloud server, etc.

[0051] Specifically, after receiving the target question information sent by the terminal 110 , the server 120 may also perform corresponding code repository question and answer through the code repository question and answer method provided in an embodiment of the present application and return the generated corresponding target answer information to the terminal 110 .

[0052] It can be understood that the code repository question and answer method provided in the embodiment of the present application can be executed by the terminal 110 alone, by the server 120 alone, or by the terminal 110 and the server 120 together, and the embodiment of the present application is not limited to this.

[0053] The network may be a medium providing a communication link between the terminal 110 and the server 120, or the Internet including network devices and transmission media, but is not limited thereto. The transmission media may be a wired link, such as but not limited to coaxial cable, optical fiber, and digital subscriber line (DSL), or a wireless link, such as but not limited to wireless fidelity (WIFI), hypertext transfer protocol, Bluetooth, and mobile device network.

[0054] Understandably, Figure 1 The number of terminals 110 and servers 120 in the code repository question and answer system shown is only an example. In a specific implementation, the code repository question and answer system may include any number of terminals 110 and servers 120.

[0055] Next, combine Figure 1 , taking the server 120 executing the code repository question and answer as an example, the code repository question and answer method provided by an exemplary embodiment of the present application is introduced. For details, please refer to Figure 2, which exemplarily shows a flowchart of a code repository question-and-answer method provided in an embodiment of the present application. Figure 2 As shown in the figure, the code repository question-answering method includes the following steps:

[0056] S201, obtaining target question information.

[0057] Specifically, the target question information may include, but is not limited to, user question information input by the user for the target code repository. The above-mentioned user question information may include, but is not limited to, the target question text related to the target code repository input by the user. The above-mentioned target question text may be in Chinese or in English, and may also include the code that the user wants to retrieve (target code to be retrieved), etc., which is not limited in the embodiment of the present application. The above-mentioned target question text may include the question text raised by the user for the target code repository, and may also include the function question description text and / or attribute question description text corresponding to the code information that the user wants to retrieve for the target code repository, that is, when the user needs to find the code or related information that can realize certain functions or has certain attributes, the corresponding function question description text and / or attribute question description text, i.e., the target question text, may also be input to perform corresponding search questions and answers, which is not limited in the embodiment of the present application. The above-mentioned target code to be retrieved may include, but is not limited to, the code or code fragment that the user currently wants to retrieve for the target code repository, that is, the user may realize the search-type question and answer of the code similar to the target code to be retrieved in the target code repository or the traceability-type question and answer of the target code to be retrieved by inputting the target code to be retrieved that the user currently wants to retrieve.

[0058] In some possible embodiments, when the user has some questions about the target code repository or wants to conduct code repository Q&A, the server 120 can obtain the user question information input by the user and sent by the terminal 110 through the network. In order to ensure the accuracy and comprehensiveness of the code repository Q&A and improve the adaptability and generalization ability of the code repository Q&A, after obtaining the user question information, the user question information can also be pre-processed, but not limited to, to obtain the target question information. The above pre-processing can include, but is not limited to, translation processing and / or similar expansion processing. The above target question information can include, but is not limited to, the target question corresponding to the user question information (i.e., the question input by the user), the translation question (i.e., the question obtained after the translation processing of the question input by the user) and at least one similar question (i.e., the question obtained after the similar expansion processing of the question input by the user), etc.

[0059] Optionally, since most of the contents of the target code repository are stored in English, if the target question in the user question information input by the user is in Chinese (that is, the target question text is a Chinese question), in order to more accurately find content related to the user question information from the target code repository as knowledge to answer the user question information, it is possible but not limited to first translating the target question into an English question (translation question), and then obtaining content related to the user question information in the target code repository through the Chinese question (target question) and English question (translation question) corresponding to the user question information, thereby achieving knowledge enhancement before answering the user's questions for the target code repository, to ensure that the user's questions about the target code repository can be better answered later.

[0060] It can be understood that the above-mentioned translation processing can be to translate the target question in the user's question information from Chinese to English, or to translate the target question from English to Chinese, or to translate the target question from any other language into Chinese or English or other languages ​​related to the target code repository, etc. The specific setting can be made according to the actual code repository question and answer situation, and the embodiment of the present application is not limited to this.

[0061] Optionally, since there are certain limitations in the user's description and expression of the problem, in order to avoid the limitations of the user's questions causing deviations in the code repository question and answer or inaccurate and incomplete answers, after obtaining the user's question information, similar expansion processing can also be performed on the user's question information, for example, but not limited to inputting the target question in the user's question information into a similar language model, and outputting at least one corresponding similar question, the above-mentioned similar language model is trained based on multiple question information corresponding to known similar question information, or, first, the target question in the user's question information is segmented, and then the similar words corresponding to each segmentation of the target question are reorganized to obtain at least one similar question whose similarity to the target question is greater than a preset value, etc., thereby improving the comprehensiveness and accuracy of the knowledge related to the user's question information subsequently obtained according to the target question information, and providing more comprehensive, accurate and powerful knowledge support for the subsequent answering of user question information.

[0062] Optionally, the implementation process of preprocessing the user question information to obtain the target question information may include, but is not limited to: inputting the user question information and the question preprocessing prompt words into the target large model, and outputting the target question information; wherein the question preprocessing prompt words may include, but are not limited to, task description information corresponding to the question preprocessing task that the target large model needs to perform for the user question information; the question preprocessing task may include, but is not limited to, translation tasks and / or similar expansion tasks, etc. The target large model may be, but is not limited to, a large language model (LLM) that has been pre-trained and fine-tuned to perform the question preprocessing task.

[0063] For example, Figure 3 As shown, the user question information "query" and the question preprocessing prompt word 310 can be input into the target large model, and the target large model outputs the target question information corresponding to the user question information "query" according to the above question preprocessing prompt word 310. The question preprocessing prompt word 310 may include, but is not limited to, the task description text "Translate the question into English" corresponding to the translation task that the target large model needs to perform and the task description text "Generate 5 similar questions for the target code warehouse based on the information stored in the target code warehouse" corresponding to the similar expansion task that the target large model needs to perform. If the above user question information "query" is "How to fine-tune the model for retrieval tasks?", the target large model may include, but is not limited to, the task description text "Translate the question into English" corresponding to the translation task that the target large model needs to perform Figure 3 The question preprocessing prompt word 310 and the information stored in the target code repository (repository info) output the English translation of the user's question information "query" "How can l fine-tunea model for retrieval tasks?" and 5 similar questions related to the target code repository.

[0064] Please continue to refer to Figure 2 ,like Figure 2 As shown, in the above S201, after obtaining the target problem information, the code repository problem method further includes:

[0065] S202: extracting a first target file and a second target file in the target code repository according to the target problem information, wherein the correlation between the second target file and the target problem information is smaller than the correlation between the first target file and the target problem information.

[0066] Specifically, the target code warehouse can be a local code warehouse pre-stored in the user terminal or the server specified by the user, or a template code warehouse sent by other terminals or other servers received through the network, or a code warehouse specified in the target question information to be asked, or a code warehouse corresponding to the target application currently being developed, used or tested by the user (developer). The number of the target code warehouse can be one or more, which can be set according to the actual code warehouse question and answer requirements, and the embodiments of the present application are not limited to this. The target code warehouse is used to manage and store the source code of the target software (target application project). The target code warehouse includes multiple target files, and the first target file is a target file in the target code warehouse that has a strong correlation with the target question information, such as but not limited to the target file specified in the target question information or a target file that is relatively important to answering the target question information. The second target file is a target file in the target code warehouse that has a correlation with the target question information or a correlation greater than the second threshold and other than the first target file. That is, the first target file and the second target file belong to different target files in the target code warehouse.

[0067] Optionally, after obtaining the target problem information, the correlation between the target problem information and the target files in the target code repository can be directly calculated first, and then the target files within the first target value with the largest correlation in the target code repository (for example, but not limited to the top 5 with the largest correlation) are determined as the first target files, and the remaining target files in the target code repository with correlations greater than 0 or greater than a second threshold (for example, but not limited to 0.1, 0.5, etc.) are determined as second target files.

[0068] Optionally, after obtaining the target problem information, the target code map corresponding to the target code repository may be obtained first, and then the correlation between each node in the target code map and the target problem information is calculated, and finally the target files corresponding to the nodes with the first target value with the largest correlation in the target code map (for example, but not limited to the top 3 with the largest correlation) are determined as the first target files, and the target files corresponding to the other nodes in the target code map with the remaining correlation greater than 0 or greater than the second threshold (for example, but not limited to 0.1, 0.5, etc.) are determined as the second target files. The above-mentioned target code map is used to characterize the target entities in the target code repository and the relationship between the target entities. The above-mentioned target entities may include, but are not limited to, the first target entities corresponding to each target file in the target code repository (for example, but not limited to the target code entity corresponding to the target code file, the target other entity corresponding to the target other file, etc.), and the second target entity corresponding to the target directory in the target code repository (for example, but not limited to the directory name, file name), the relationship between the above-mentioned first target entities may include, but are not limited to, call relationships (relationships between target code entity relationships), association relationships (relationships between target other entities), and the relationship between the above-mentioned second target entities may include, but are not limited to, inclusion relationships.

[0069] In an embodiment of the present application, the target code map corresponding to the target code warehouse is used to enhance the macro-understanding of the entire target code warehouse during the code warehouse question and answer process, reduce the complexity of the correlation calculation between the target problem information and the target files in the target code warehouse, and improve the extraction efficiency and accuracy of the first target file and the second target file related to the target problem information in the target code warehouse.

[0070] It can be understood that the above-mentioned correlation calculation may include but is not limited to at least one of the following: semantic correlation calculation, vector correlation calculation, and question-answer correlation calculation. The above-mentioned semantic correlation calculation is to calculate the semantic correlation between the two (for example, but not limited to the target question information and each target file in the target code warehouse, the target question information and each node in the target code map, etc.), and the vector correlation calculation is to first vectorize the two (for example, but not limited to the target question information and each target file in the target code warehouse, the target question information and each node in the target code map, etc.), and then calculate the correlation between the two vectors. The embodiments of the present application are not limited to this. Question-answer correlation is used to characterize the correlation corresponding to the answer to the target question information.

[0071] Please continue to refer to Figure 2 ,like Figure 2 As shown, in the above S202, after extracting the first target file and the second target file in the target code repository according to the target problem information, the code repository problem method further includes:

[0072] S203: Generate target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file.

[0073] Specifically, after extracting the first target file and the second target file in the target code repository, the target full-text information corresponding to the first target file can be directly extracted, and the target overview information corresponding to the second target file can be extracted according to the preset rules, and then the target answer information corresponding to the target question information is generated according to the above target full-text information and target overview information, for example, but not limited to inputting the above target full-text information, target overview information and the above target question information into the target large model or the target question and answer model, and outputting the corresponding target answer information. The above target question and answer model can be, but not limited to, trained based on multiple question information with known answer information. The above target large model can be, but not limited to, fine-tuning the pre-trained initial large model based on the question and answer analysis prompt words. The above preset rules can include, but are not limited to, extracting class information and function information in the second target file, or extracting information related to the target question information in the second target file, such as, but not limited to, code segments or text segments related to the target question information.

[0074] The above-mentioned target full-text information may include, but is not limited to, class information, function information, and variable information corresponding to the function call in the first target file, and the above-mentioned target overview information may include, but is not limited to, only class information and function information in the second target file, that is, the target full-text information includes the specific implementation information of each function in the first target file, and the target overview information is only an overview of the second target file, and does not include the specific implementation information (i.e., variable information) of each function in the second target file. The above-mentioned target overview information may also include, but is not limited to, only information related to the target problem information in the second target file, such as, but not limited to, code segments or text segments related to the target problem information. That is, the overview range corresponding to the above-mentioned target overview information can be specifically set according to the actual code repository question and answer requirements, and the embodiments of the present application do not limit this.

[0075] In an embodiment of the present application, the first target file and the second target file in the target code repository are respectively extracted according to the target question information, and the target answer information is generated according to the target full-text information of the first target file that is strongly related to the target question information and the target overview information of the second target file that is weakly related to the target question information. That is, by performing full-text enhancement (that is, using full-text information) on the important files in the target code repository (the first target file that is strongly related to the target question information), and outlining the contents of other relevant files (the second target file that is weakly related to the target question information) (that is, using overview information), fine-grained extraction of information in the target code repository that is strongly related to the target question information (target full-text information) and coarse-grained extraction of information in the target code repository that is relatively weakly related to the target question information (target overview information) are achieved, and these two types of information with different granularities are used as knowledge to answer the target question information, thereby achieving knowledge enhancement in the process of answering code repository questions, reducing the complexity of question-answering for the code repository and improving the efficiency and accuracy of question-answering for the code repository, while ensuring that the question-answering for the code repository can be automatically and efficiently achieved, ensuring the comprehensiveness and completeness of the target answer information finally generated, so as to better answer complex code repository questions.

[0076] Please refer to the following Figure 4 , which exemplarily shows a flow chart of another code repository question-and-answer method provided in an embodiment of the present application. Figure 4 As shown, the code repository question-and-answer method may include the following steps:

[0077] S401, obtaining target question information.

[0078] Specifically, S401 is consistent with S201 and will not be described in detail here.

[0079] S402: extracting a first target file in the target code repository according to the target problem information and the target directory tree corresponding to the target code repository.

[0080] Specifically, the above-mentioned target directory tree (also called target file tree or target directory hierarchical structure) is used to characterize the organizational structure of target files and target folders (target subdirectories) in the target code repository. This structure can be displayed in the form of a tree diagram, which clearly reflects the hierarchy and dependency relationship between the target files in the target code repository. Since the target directory tree corresponding to the target code repository has briefly and clearly described the storage status of each target file in the target code repository, in order to improve the extraction efficiency of the first target file and ensure the strong correlation between the first target file and the target problem information, after obtaining the target problem information, the first target file in the target code repository can be directly extracted according to the target problem information and the target directory tree corresponding to the target code repository. For example, but not limited to, the specified file name and / or target keyword involved in the target problem information can be first extracted, and then the corresponding (or matching) target file name can be searched from the target directory tree corresponding to the target code repository according to the specified file name and / or target keyword, and finally the corresponding first target file can be extracted from the target code repository according to the target file name.

[0081] In an embodiment of the present application, the first target file in the target code warehouse that is strongly related to the user's target problem information can be extracted according to the target directory tree corresponding to the target code warehouse. The global file information corresponding to the target code warehouse is provided concisely and clearly through the target directory tree, thereby reducing the extraction complexity of the first target file and improving the extraction efficiency of the first target file.

[0082] Optionally, in order to ensure the extraction efficiency, extraction accuracy and extraction intelligence of the first target file, the above S402, according to the target question information and the target directory tree corresponding to the target code warehouse, the implementation process of extracting the first target file in the target code warehouse may include but is not limited to: inputting the target question information, the target directory tree corresponding to the target code warehouse and the first question and answer analysis prompt word into the target large model, performing question and answer correlation analysis on the target question information and the target file in the target directory tree based on the first question and answer analysis prompt word through the target large model, obtaining the target question and answer correlation analysis result, and outputting the first target file in the target code warehouse based on the target question and answer correlation analysis result. Among them, the above-mentioned first question and answer analysis prompt word may include but is not limited to the first description information corresponding to the first question and answer analysis task required to be performed by the target large model for the target question information and the target directory tree. The above-mentioned target large model may be but is not limited to a large language model that can perform the above-mentioned first question and answer analysis task after pre-training and fine-tuning. The above-mentioned first description information can be pre-set by the developer according to the actual situation of the code warehouse question and answer, or it can be directly input by the user through the user terminal interface or command line according to his own question and answer needs, and the embodiment of the present application does not limit this.

[0083] In some possible embodiments, the above-mentioned target question-answer correlation analysis results may include, but are not limited to, the question-answer correlation between the target question information and each target file in the target directory tree. The above-mentioned question-answer correlation is used to characterize the correlation corresponding to the answer to the target question information, that is, the target file with a higher question-answer correlation in the target directory tree can more accurately answer the user's target question information, or provide more closely related knowledge (information) for answering the target question information. The above-mentioned first target file may include, but is not limited to, the specified file involved in the above-mentioned target question information (i.e., the target file mentioned in the target question information), and / or, the target file in the target directory tree whose corresponding question-answer correlation is greater than the first threshold value (for example, but not limited to 0.95, 0.9, 0.8, etc.), and / or, the target file in the target directory tree whose corresponding question-answer correlation ranks within the first target value, and the above-mentioned first target value is a positive integer, for example, but not limited to, the 3 or 5 (first target value) target files with the highest ranking in the target directory tree corresponding to the question-answer correlation, which is not limited to the embodiment of the present application. That is, the target big model can extract the specified file (first target file) involved in the target question information in the target code warehouse according to the target directory tree corresponding to the target question information and the target code warehouse, and / or extract the target files whose corresponding question and answer correlation ranking is within the first target value in the target directory tree corresponding to the target code warehouse (for example, but not limited to the 3 or 5 target files with the highest question and answer correlation ranking), or the target files whose corresponding question and answer correlation is greater than the first threshold, etc., according to the question and answer correlation between each target file in the target directory tree and the target question information. The embodiments of the present application are not limited to this.

[0084] Furthermore, the above-mentioned implementation process of performing question and answer correlation analysis on the target question information and the target files in the target directory tree based on the first question and answer analysis prompt word through the target big model may but is not limited to include: the target big model executes the corresponding first question and answer analysis task according to the first description information in the first question and answer analysis prompt word, that is, calculates the question and answer correlation analysis between the target question information and each target file in the target directory tree, and obtains the corresponding target question and answer correlation analysis result.

[0085] For example, Figure 3As shown, the target question information "query", the target directory tree "repoinfo" corresponding to the target code repository, and the first question-answer analysis prompt word 320 can be input into the target macro model, and the target macro model performs question-answer correlation analysis on the target question information "query" and the target files in the target directory tree "repoinfo" according to the first question-answer analysis prompt word 320, and outputs the first target file in the target code repository based on the target question-answer correlation analysis result. The first question-answer analysis prompt word 320 may include, but is not limited to, the task description text of the first question-answer analysis task to be performed by the target macro model, "Tell me which files in the target directory tree are very important to answer the user's question, and list the exact files."

[0086] Please continue to refer to Figure 4 ,like Figure 4 As shown, in the above S401, after obtaining the target question information, the code repository question answering method further includes:

[0087] S403, searching the target code graph corresponding to the target code repository according to the target keyword corresponding to the target problem information to obtain target association graph information.

[0088] Specifically, after obtaining the target question information, the target question information may be firstly subjected to word segmentation processing or keyword extraction processing to obtain the target keyword corresponding to the target question information. Then, according to the target keyword corresponding to the target question information, the target code map corresponding to the target code repository is retrieved to obtain the target association map information. The above-mentioned target code map is used to characterize the target entities in the target code repository and the relationship between the target entities. The above-mentioned target entities may include but are not limited to the first target entities corresponding to the target files in the target code repository (for example, but not limited to the target code entities corresponding to the target code files, the target other entities corresponding to the target other files, etc.), and the second target entities corresponding to the target directories in the target code repository (for example, but not limited to the directory name, the file name). The relationship between the above-mentioned first target entities may include but are not limited to call relationships (relationships between target code entity relationships), association relationships (relationships between target other entities), and the relationship between the second target entities may include but are not limited to inclusion relationships. The above-mentioned retrieval may include but are not limited to the use of the PageRank algorithm, that is, in the target code map retrieval, the nodes in the target code map may be sorted by the PageRank algorithm to reflect their importance or influence (that is, the correlation between each node and the target question information).

[0089] Optionally, the target code graph is composed of a plurality of nodes and the relationship between the plurality of nodes, and the nodes are used to characterize the entity information in the target code repository; the entity information may include, but is not limited to, the name, type, content, and other information corresponding to the target entity. The implementation process of retrieving the target code graph corresponding to the target code repository according to the target keyword corresponding to the target question information to obtain the target association graph information may include, but is not limited to: first determining the correlation result between each node in the target code graph and the target keyword corresponding to the target question information; then, extracting the target association graph information in the target code graph according to the correlation result, the target association graph information may include, but is not limited to, target association information corresponding to at least one target association node, the target association node may include, but is not limited to, a node related to the target keyword in the target code graph, and the target association information may include, but is not limited to, entity information corresponding to the target association node and a target file (i.e., target association file) corresponding to the target association node. That is, the correlation result may include, but is not limited to, indicating whether each node in the target code graph is related to the target keyword corresponding to the target question information, or including the correlation between each node in the target code graph and the target keyword corresponding to the target question information. The above-mentioned target association nodes can also be, but are not limited to, nodes in the target code map whose corresponding correlation is greater than a second threshold value (for example, but not limited to 0.1, 0.2, 0.3, etc.), or nodes in the target code map whose corresponding correlation ranking is within the second target value, such as but not limited to the 10 or 20 or 8 nodes with the highest correlation ranking, thereby excluding nodes that are not relevant to the target question information at all or have extremely small correlations that are almost negligible, and are of no help in answering the target question information, thereby excluding interference with the code repository question and answer process, and further improving the efficiency of the code repository question and answer.

[0090] It can be understood that the target keyword corresponding to the above-mentioned target question information may include one or more, and the above-mentioned correlation result can be used to characterize the correlation between each node in the target code map and each target keyword corresponding to the target question information, and can also be used to characterize the overall correlation between each node in the target code map and multiple target keywords corresponding to the target question information, and the embodiment of the present application does not limit this. The determination process of the above-mentioned overall correlation can be, but not limited to: first determine the correlation between each node in the target code map and each target keyword corresponding to the target question information, and then weight the corresponding correlations between each node in the target code map and multiple target keywords (i.e., multiple correlations corresponding to each node) according to the weight ratio of the target keyword in the target question information. Fusion, to obtain the overall correlation between each node in the target code map and multiple target keywords corresponding to the target question information. The above-mentioned weight ratio can be, but not limited to, characterizing the importance of the target keyword in the target question information, which can be, but not limited to, determined according to the frequency of the target keyword appearing in the target question information and / or the semantic relevance with the target question information, etc., and can also be manually set by the user, etc., and can be set according to actual needs, and the embodiment of the present application does not limit this.

[0091] S404: extract a second target file in the target code repository according to the target association graph information.

[0092] Specifically, the second target file in the target code repository may be directly extracted according to the target associated file corresponding to each target associated node in the target associated graph information, that is, the target file corresponding to the target associated node in the target code repository may be extracted.

[0093] In an embodiment of the present application, the target code graph corresponding to the target code warehouse can be retrieved according to the target keyword corresponding to the target question information, and the second target file in the target code warehouse that is weakly related to the user's target question information relative to the first target file can be extracted according to the retrieved target association graph information. The target code graph corresponding to the target code warehouse is used to enhance the macro-understanding of the entire target code warehouse in the code warehouse question and answer process, and the nodes in the target code graph are used to determine the second target file related to the target question information, which greatly eliminates the interference of the content in each target file of the target code warehouse that is irrelevant to the target question information on the correlation calculation, reduces the complexity of the correlation calculation between the target question information and each target file in the target code warehouse, speeds up the extraction of file information related to the target question information in the target code warehouse, and improves the extraction efficiency and accuracy of the second target file in the target code warehouse.

[0094] At the same time, the first target file directly related (strongly related) to the user's target question information in the target code warehouse is extracted directly according to the target directory tree corresponding to the target code warehouse, that is, the target file mentioned in the target question information, and the second target file related to the user's target question information in the target code warehouse is extracted according to the target code map corresponding to the target code warehouse. This not only reduces the extraction complexity of the first target file and improves the extraction efficiency of the first target file, ensuring that the extracted first target file is a target file that is more important for answering the target question information, but also enhances the macro-understanding of the entire target code warehouse during the code warehouse question and answer process through the target code map, ensuring that the second target file related to the target question information in the target code warehouse can be found comprehensively and accurately.

[0095] Optionally, the above-mentioned implementation process of extracting the second target file in the target code warehouse according to the target association graph information may include but is not limited to: when the number of first target files is greater than or equal to the first target value, it means that sufficient first target files that are strongly related to the target question information have been found as knowledge support for answering the target question information, and there is no need to supplement the first target files. Then, the second target file in the target code warehouse can be directly extracted according to the target association node, and the above-mentioned second target file is the target association file corresponding to the target association node.

[0096] In some possible embodiments, the above correlation results may include, but are not limited to, the correlation between each node in the target code map and the target keyword corresponding to the target question information. After the target code map corresponding to the target code warehouse is retrieved according to the target keyword corresponding to the target question information to obtain the target association map information, the code warehouse question answering method may also include, but is not limited to: when the number of first target files is less than the first target value, it means that according to the target directory tree corresponding to the target code warehouse, there are not enough first target files strongly related to the target question information as the knowledge support for answering the target question information, and some additional first target files are needed, then the target association file corresponding to the designated target association node in the target association map information may be determined as the first target file, and the designated target association node may be used to characterize the target association node whose corresponding correlation ranking is within the second target value in at least one target association node, or may be used to characterize the target association node whose corresponding correlation is greater than the first threshold value in at least one target association node, etc., and the embodiment of the present application does not limit this; the second target value may be a pre-set value, or may be the difference between the first target value and the number of first target files extracted according to the target directory tree corresponding to the target code warehouse, etc., and the embodiment of the present application does not limit this. After determining the target associated file corresponding to the designated target associated node in the target associated graph information as the first target file, extract the second target file in the target code repository according to the non-designated target associated node in the target associated graph information, that is, extract the target associated file corresponding to the target associated nodes other than the designated target associated node (that is, the non-designated target associated node) in the target associated graph information. The second target file is the target associated file corresponding to the non-designated target associated node.

[0097] S405 , generating target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree.

[0098] Optionally, after extracting the first target file and the second target file in the target code repository, the first target file may be read but not limited to, and the target full-text information in the first target file may be extracted using file parsing technology (such as but not limited to XML parser, JSON parser, etc., which may be set according to the actual file format); and the second target file may be parsed to extract the target overview information corresponding to the second target file, and the target overview information may include but not limited to the summary of the second target file, key point summary or high-level overview or entity information of the target associated node involved in the second target file, etc., which are crucial for subsequent question analysis and answer generation. Then, the target question information is identified using natural language processing technology, and the target question in the target question information is mapped to the specific part or knowledge point of the target full-text information and the target overview information through semantic analysis, keyword matching or question classification. Finally, according to the problem mapping result and the target directory tree corresponding to the target code repository, the target full-text information and the target overview information are converted into the target answer information corresponding to the target question information using a summary generation algorithm, a text generation model (such as a GPT series model) or a rule template. The server may also, but is not limited to, send the target answer information to the client in a suitable format (such as, but not limited to, text, chart, link, etc.) for the user of the client to review.

[0099] Optionally, after extracting the first target file and the second target file in the target code repository, the target question information, the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, the target directory tree corresponding to the target code repository, and the second question-answer analysis prompt word can also be directly input into the target large model, but is not limited to, the target question information, the target full-text information, the target overview information, and the target directory tree are analyzed by the target large model based on the second question-answer analysis prompt word, and the target answer information corresponding to the target question information is output. Among them, the above-mentioned second question-answer analysis prompt word can include, but is not limited to, including the second description information corresponding to the second question-answer analysis task that the target large model needs to perform for the target question information, the target full-text information, the target overview information, and the target directory tree. The above-mentioned target large model can be, but is not limited to, a large language model that can perform the above-mentioned second question-answer analysis task after pre-training and fine-tuning. The above-mentioned second description information can be pre-set by the developer according to the actual situation of the code repository question and answer, or it can be obtained by the user directly through the user terminal interface or command line input according to his own question and answer needs, and the embodiment of the present application does not limit this.

[0100] For example, Figure 5As shown, the target question information "query", the target full-text information "relcontent" corresponding to the first target file, the target overview information "repocontent" corresponding to the second target file, the target directory tree "repotree" corresponding to the target code repository, and the second question and answer analysis prompt word 510 are input into the target large model, and the target question information "query", the target full-text information "relcontent", the target overview information "repocontent" and the target directory tree "repotree" are analyzed by the target large model based on the second question and answer analysis prompt word 510, and the target answer information corresponding to the target question information is output. The second question and answer analysis prompt word 510 may include, but is not limited to, the task description text corresponding to the second question and answer analysis task that the target large model needs to perform: "You are a professional AI programming assistant who can provide information query, dialogue communication, code question and answer and other services, and are good at programming, thinking, and analyzing code and documents. Answer user questions professionally based on the code repository description, directory structure, related code, and related documents."

[0101] Alternatively, if Figure 5 As described above, in order to improve the accuracy of the target big model question and answer, the target question information "query", the target full-text information "relcontent" corresponding to the first target file, the target overview information "repocontent" corresponding to the second target file, the target directory tree "repotree" corresponding to the target code repository, the code repository description information "repodescription", the related document "doccontent" and the second question and answer analysis prompt word 510 etc. can also be input into the target big model, and the target big model outputs the target answer information corresponding to the target question information based on the above information. The above-mentioned code repository description information "repodescription" may include but is not limited to the name, attributes, content overview and other descriptive information of the target code repository, and the above-mentioned related document "doccontent" may include but is not limited to the related documents retrieved from other code repositories or other documents through the target question vector corresponding to the target question information, such as but not limited to official documents, api interface documents, etc. At the same time, users can also use Figure 5The variable optional control 520 shown realizes the adjustment of the input data of the target big model, that is, the user can select one or more variables from the target question information "query", the target full-text information "relcontent" corresponding to the first target file, the target overview information "repocontent" corresponding to the second target file, the target directory tree "repotree" corresponding to the target code repository, the code repository description information "repodescription" and the related document "doccontent" according to actual needs to participate in the code repository question and answer using the target big model, thereby improving the flexibility of the code repository question and answer to a certain extent.

[0102] In the embodiment of the present application, on the one hand, by only selecting the information of the first target file and the second target file related to the target question information as the knowledge support for answering the target question information, the interference of other files in the target code library that are not related to the target question information is eliminated, and by only using the target full-text information of the first target file, the second target file participates in the question and answer of the code warehouse in an overview manner, and further eliminates the interference of the information irrelevant to the target question in the second target file that has relatively weak relevance to the target question information, and avoids the problem that a large amount of information irrelevant to the target question information is used as the knowledge support for answering the target question information, which affects the accuracy and efficiency of the code warehouse question and answer; on the other hand, by taking the target directory tree of the target code warehouse as knowledge, combining the target full-text information of the first target file and the target overview information of the second target file, two types of information with different granularities, to answer the target question in the target question information, not only the target directory tree provides the required global information for the code warehouse question and answer, so that it can more quickly and clearly understand the file status stored in the target code warehouse, and improve the efficiency of the code warehouse question and answer, but also the above two types of information with different granularities can be more accurately associated to improve the accuracy, professionalism and fluency of the target answer information.

[0103] Please refer to the following Figure 6 , which exemplarily shows a flow chart of another code repository question-and-answer method provided in an embodiment of the present application. Figure 6 As shown, the code repository question-and-answer method may include the following steps:

[0104] S601, obtaining target question information.

[0105] Specifically, S601 is consistent with S201 and will not be described in detail here.

[0106] S602: extract a first target file and a second target file in the target code repository according to the target problem information, wherein the correlation between the second target file and the target problem information is smaller than the correlation between the first target file and the target problem information.

[0107] Specifically, S602 is consistent with S202 and will not be repeated here.

[0108] S603: Generate target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file.

[0109] Specifically, S603 is consistent with S203 and will not be repeated here.

[0110] S604, generating target question recommendation information according to historical question and answer information, target full-text information and target overview information.

[0111] Optionally, after obtaining the target answer information, the target answer information and target question information can be used as historical question and answer information, and natural language processing technology can be used to generate target question recommendation information based on the historical question and answer information, as well as the corresponding target full-text information and target overview information, that is, to identify potential knowledge gaps or aspects that the user may be interested in, and ultimately generate a series of inspiring question recommendations that are closely related to the target question information or the target code repository. In addition to the target answer information and target question information, the historical question and answer information may also include other historical question information of the user corresponding to the target question information and other corresponding historical answer information, which is not limited in the embodiments of the present application.

[0112] Optionally, the historical question and answer information, the target full text information, the target overview information and the question recommendation prompt words can also be directly input into the target macro model to output the target question recommendation information. The question recommendation prompt words can include, but are not limited to, the third description information corresponding to the question recommendation task that the target macro model needs to perform for the historical question and answer information, the target full text information and the target overview information.

[0113] For example, Figure 7 As shown, the historical question and answer information "histories", the relevant information "repoinfo" corresponding to each question and answer pair in the historical question and answer information (i.e., the target full text information, the target overview information), and the question recommendation prompt 710 can be input into the target large model to output the target question recommendation information. The question recommendation prompt 710 may include, but is not limited to, the task description text corresponding to the question recommendation task required to be performed by the target large model, "Please help me predict the three most likely questions that humans will ask about the target code repository. Answer specific questions in Chinese, with each question within 50 words. The output must be a JSON format array that conforms to the specified pattern: ["question 1", "question 2", "question 3"]".

[0114] In an embodiment of the present application, after obtaining the target answer information corresponding to the target question information, corresponding target question recommendation information can be generated based on the historical question and answer information, the target full-text information and the target overview information, so as to realize the recommendation of follow-up questions after the code repository question and answer, and recommend questions that the user may need to ask or is interested in, thereby improving the reliability and ease of use of the code repository question and answer, reducing the professional requirements of the questioner, making the code repository question and answer more practical and adaptable, and improving the question and answer experience of users such as developers who need to conduct code repository question and answer.

[0115] Please refer to the following Figure 8 , which exemplarily shows a schematic diagram of the overall implementation process of a code repository question-and-answer method provided in an embodiment of the present application. Figure 8 As shown, the code warehouse question-answering method may include: after obtaining the user question (target question), the user question (target question) may be translated and similarly expanded to obtain the corresponding translation question and at least one similar question (the specific implementation process refers to the description of S201 above, which will not be repeated here). Then, according to the target question information including the user question (target question), the translation question and the similar question and the target directory tree corresponding to the target code warehouse, the first target file in the target code warehouse is extracted (the specific implementation process refers to the description of S402 above, which will not be repeated here); and the target keyword corresponding to the above target question information is extracted, and the target code map corresponding to the target code warehouse is retrieved and sorted according to the target keyword corresponding to the target question information, so as to obtain the relevant files related to the target question information in the target code warehouse. When the number of the first target files is 0 or does not reach the first target value, the first few files with the largest correlation among the relevant files obtained by retrieval and sorting can be determined as the first target files, and then the remaining relevant files can be determined as the second target files; when the number of the first target files is greater than 0 or reaches the first target value, the relevant files obtained by retrieval and sorting can be directly determined as the second target files. Then, the target full-text information of the first target file is obtained, and the target overview information corresponding to the second target file is obtained according to the target code map, and the target answer information corresponding to the user's question (target question) is generated according to the above target full-text information and target overview information. At the same time, the generated target answer information and its corresponding target question information can also be determined as historical question and answer information, and target question recommendation information can be generated according to the historical question and answer information and the corresponding question and answer knowledge (target full-text information and target overview information).

[0116] Please refer to the following Fig. 9 , which is a schematic diagram of the structure of a code repository question-answering device provided by an exemplary embodiment of the present application. Fig. 9 As shown, the code warehouse question-answering device 900 includes:

[0117] An acquisition module 910 is used to acquire target question information;

[0118] An extraction module 920 is used to extract a first target file and a second target file in the target code repository according to the target problem information; the correlation between the second target file and the target problem information is less than the correlation between the first target file and the target problem information;

[0119] The answer generation module 930 is used to generate target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file.

[0120] In a possible implementation, the extraction module 920 includes:

[0121] A first extraction unit, configured to extract a first target file in the target code repository according to the target problem information and a target directory tree corresponding to the target code repository;

[0122] A graph retrieval unit, configured to retrieve a target code graph corresponding to a target code repository according to a target keyword corresponding to the target problem information, and obtain target associated graph information;

[0123] The second extraction unit is used to extract a second target file in the target code repository according to the target association graph information; the correlation between the second target file and the target problem information is less than the correlation between the first target file and the target problem information.

[0124] In one possible implementation, the first extraction unit is specifically used to: input the target question information, the target directory tree corresponding to the target code repository, and the first question and answer analysis prompt word into the target big model, perform a question and answer correlation analysis on the target question information and the target file in the target directory tree based on the first question and answer analysis prompt word through the target big model, obtain the target question and answer correlation analysis result, and output the first target file in the target code repository based on the target question and answer correlation analysis result; the first question and answer analysis prompt word includes the first descriptive information corresponding to the first question and answer analysis task that the target big model needs to execute for the target question information and the target directory tree.

[0125] In one possible implementation, the target question-answer correlation analysis result includes the question-answer correlation between the target question information and each target file in the target directory tree; the first target file includes the specified file involved in the target question information, and / or, the target file in the target directory tree whose corresponding question-answer correlation is greater than the first threshold, and / or, the target file in the target directory tree whose corresponding question-answer correlation is ranked within the first target value.

[0126] In a possible implementation, the target code graph is composed of multiple nodes and the relationships between the multiple nodes, and the nodes are used to represent the entity information in the target code repository; the graph retrieval unit is specifically used to: determine the correlation results between each node in the target code graph and the target keyword corresponding to the target problem information; extract the target association graph information in the target code graph according to the correlation results; the target association graph information includes target association information corresponding to at least one target association node; the target association node is a node in the target code graph related to the target keyword.

[0127] In a possible implementation, the second extraction unit is specifically used to: when the number of first target files is greater than or equal to the first target value, extract the second target file in the target code repository according to the target association node, and the second target file is the target association file corresponding to the target association node.

[0128] In a possible implementation, the correlation result includes the correlation between each node in the target code graph and the target keyword corresponding to the target question information; the code warehouse question-answering device 900 also includes:

[0129] A determination module, configured to determine, when the number of the first target files is less than the first target value, a target associated file corresponding to a designated target associated node in the target associated graph information as the first target file; the designated target associated node is used to represent a target associated node in at least one target associated node whose corresponding correlation ranking is within the second target value;

[0130] The second extraction unit is specifically used to: extract the second target file in the target code repository according to the non-specified target association node in the target association graph information; the second target file is the target association file corresponding to the non-specified target association node.

[0131] In one possible implementation, the answer generation module 950 is specifically used to generate target answer information corresponding to the target question information based on the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree corresponding to the target code repository.

[0132] In one possible implementation, the answer generation module 950 is specifically used to: input the target question information, the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, the target directory tree corresponding to the target code repository, and the second question and answer analysis prompt words into the target big model, perform question and answer analysis on the target question information, the target full-text information, the target overview information, and the target directory tree based on the second question and answer analysis prompt words through the target big model, and output the target answer information corresponding to the target question information; wherein the second question and answer analysis prompt words include the second description information corresponding to the second question and answer analysis task that the target big model needs to perform for the target question information, the target full-text information, the target overview information, and the target directory tree.

[0133] In a possible implementation, the code repository question-answering device 900 further includes:

[0134] The question recommendation module is used to generate target question recommendation information based on historical question and answer information, target full-text information and target overview information; the historical question and answer information includes target answer information and / or target question information.

[0135] In one possible implementation, the question recommendation module is specifically used to: input historical question and answer information, target full-text information, target overview information and question recommendation prompt words into the target large model, and output target question recommendation information; the question recommendation prompt words include third descriptive information corresponding to the question recommendation task that the target large model needs to perform for the historical question and answer information, target full-text information and target overview information.

[0136] In one possible implementation, the acquisition module 910 is specifically used to: obtain user question information; preprocess the user question information to obtain target question information; the preprocessing includes translation processing and / or similarity expansion processing; the target question information includes the target question, the translated question and at least one similar question corresponding to the user question information.

[0137] The division of each module in the code warehouse question and answer device is only for illustration. In other embodiments, the code warehouse question and answer device can be divided into different modules as needed to complete all or part of the functions of the code warehouse question and answer device. The implementation of each module in the code warehouse question and answer device provided in the embodiments of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the code warehouse question and answer method described in the embodiments of this specification are implemented.

[0138] See next Fig.10 , which is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. Fig.10As shown, the electronic device 1000 may include: at least one processor 1010 , at least one communication bus 1020 , a user interface 1030 , at least one network interface 1040 , and a memory 1050 .

[0139] The communication bus 1020 may be used to realize the connection and communication between various components.

[0140] The user interface 1030 may include a display screen (Display) and a camera (Camera), and the optional user interface 1030 may also include a standard wired interface and a wireless interface.

[0141] The network interface 1040 may optionally include a Bluetooth module, a near field communication module, a wireless fidelity module, etc.

[0142] Among them, the processor 1010 may include one or more processing cores. The processor 1010 uses various interfaces and lines to connect various parts within the entire electronic device 1000, and executes various functions and processes data of the routing electronic device 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1050, and calling data stored in the memory 1050. Optionally, the processor 1010 can be implemented in at least one hardware form of digital signal processing, field programmable gate array, and programmable logic array. The processor 1010 can integrate one or a combination of processors, image processors, and modems. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used to handle wireless communications. It can be understood that the modem may not be integrated into the processor 1010, but may be implemented separately through a chip.

[0143] Among them, the memory 1050 may include a random access memory or a read-only memory. Optionally, the memory 1050 includes a non-transitory computer-readable medium. The memory 1050 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1050 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as an answer generation function, a graph retrieval function, a code repository question and answer function, etc.), instructions for implementing various method embodiments, etc.; the data storage area may store data involved in the above various method embodiments, etc. The memory 1050 may optionally be at least one storage device located away from the aforementioned processor 1010. As Fig.10 As shown, the memory 1050 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.

[0144] In some possible embodiments, the electronic device 1000 may be the aforementioned Fig. 9 In the code repository question and answer device 900 shown, the processor 1010 can be used to call the program instructions stored in the memory 1050, and specifically perform the following operations: obtain target question information; extract the first target file and the second target file in the target code repository according to the target question information; the correlation between the second target file and the target question information is less than the correlation between the first target file and the target question information; generate target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file.

[0145] In some possible embodiments, when the processor 1010 executes the extraction of the first target file and the second target file in the target code warehouse according to the target problem information, it is specifically used to execute: extracting the first target file in the target code warehouse according to the target problem information and the target directory tree corresponding to the target code warehouse; searching the target code graph corresponding to the target code warehouse according to the target keyword corresponding to the target problem information to obtain the target association graph information; extracting the second target file in the target code warehouse according to the target association graph information.

[0146] In some possible embodiments, when the processor 1010 executes to extract the first target file in the target code repository based on the target question information and the target directory tree corresponding to the target code repository, it is specifically used to execute: inputting the target question information, the target directory tree corresponding to the target code repository, and the first question and answer analysis prompt word into the target big model, performing a question and answer correlation analysis on the target question information and the target file in the target directory tree based on the first question and answer analysis prompt word through the target big model to obtain the target question and answer correlation analysis result, and outputting the first target file in the target code repository based on the target question and answer correlation analysis result; wherein the first question and answer analysis prompt word includes the first description information corresponding to the first question and answer analysis task that the target big model needs to execute with respect to the target question information and the target directory tree.

[0147] In some possible embodiments, the target question-answer correlation analysis result includes the question-answer correlation between the target question information and each target file in the target directory tree;

[0148] The first target file includes the specified file involved in the target question information, and / or the target file in the target directory tree whose corresponding question-answer correlation is greater than the first threshold, and / or the target file in the target directory tree whose corresponding question-answer correlation is ranked within the first target value.

[0149] In some possible embodiments, the target code graph is composed of multiple nodes and the relationships between the multiple nodes, and the nodes are used to represent the entity information in the target code warehouse; the processor 1010 executes the search for the target code graph corresponding to the target code warehouse according to the target keyword corresponding to the target problem information, and when the target association graph information is obtained, it is specifically used to execute: determine the correlation results between each node in the target code graph and the target keyword corresponding to the target problem information; extract the target association graph information in the target code graph according to the correlation results; the target association graph information includes target association information corresponding to at least one target association node; the target association node is a node in the target code graph related to the target keyword.

[0150] In some possible embodiments, when the processor 1010 executes to extract the second target file in the target code warehouse according to the target association graph information, it is specifically used to execute: when the number of the first target files is greater than or equal to the first target value, extract the second target file in the target code warehouse according to the target association node; the second target file is the target association file corresponding to the target association node.

[0151] In some possible embodiments, the correlation result includes the correlation between each node in the target code map and the target keyword corresponding to the target question information; the processor 1010 executes a retrieval of the target code map corresponding to the target code repository according to the target keyword corresponding to the target question information, and before generating the target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree, it is also used to execute: when the number of first target files is less than the first target value, the target associated file corresponding to the designated target associated node in the target associated map information is determined as the first target file; the designated target associated node is used to represent the target associated node in at least one target associated node whose corresponding correlation ranking is within the second target value.

[0152] When processor 1010 executes extraction of the second target file in the target code warehouse according to the target association graph information, it is specifically used to execute: extracting the second target file in the target code warehouse according to the non-specified target association node in the target association graph information; the second target file is the target association file corresponding to the non-specified target association node.

[0153] In some possible embodiments, when the processor 1010 generates target answer information corresponding to the target question information based on the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file, it is specifically used to execute: generating target answer information corresponding to the target question information based on the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree corresponding to the target code repository.

[0154] In some possible embodiments, when the processor 1010 generates target answer information corresponding to the target question information based on the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree corresponding to the target code repository, it is specifically used to execute: inputting the target question information, the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, the target directory tree corresponding to the target code repository, and the second question and answer analysis prompt words into the target big model, performing question and answer analysis on the target question information, the target full-text information, the target overview information, and the target directory tree based on the second question and answer analysis prompt words through the target big model, and outputting the target answer information corresponding to the target question information; the second question and answer analysis prompt words include second description information corresponding to the second question and answer analysis task that the target big model needs to perform for the target question information, the target full-text information, the target overview information, and the target directory tree.

[0155] In some possible embodiments, after the processor 1010 generates target answer information corresponding to the target question information based on the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file, it is also used to execute: generating target question recommendation information based on historical question and answer information, the target full-text information and the target overview information; the historical question and answer information includes target answer information and / or target question information.

[0156] In some possible embodiments, when the processor 1010 generates target question recommendation information based on historical question and answer information, target full-text information and target overview information, it is specifically used to execute: inputting historical question and answer information, target full-text information, target overview information and question recommendation prompt words into the target big model, and outputting the target question recommendation information; wherein the question recommendation prompt words include the third description information corresponding to the question recommendation task that the target big model needs to perform with respect to the historical question and answer information, target full-text information and target overview information.

[0157] In some possible embodiments, when the processor 1010 executes the acquisition of target question information, it is specifically used to execute: acquiring user question information; preprocessing the user question information to obtain target question information; the preprocessing includes translation processing and / or similarity expansion processing; the target question information includes the target question, the translated question and at least one similar question corresponding to the user question information.

[0158] The embodiment of the present application also provides a computer storage medium, which stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes one or more steps in any method. If the various components of the code warehouse question-and-answer device are implemented in the form of software functional units and sold or used as independent products, they can be stored in the storage medium.

[0159] In an embodiment, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from a website site, a computer, a server, or a data center to another website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.

[0160] Those skilled in the art can understand that all or part of the processes in the embodiment method can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of each method. The aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes. In the absence of conflict, the technical features in this embodiment and the implementation scheme can be combined arbitrarily.

[0161] The above embodiments are merely preferred embodiments of the present application and are not intended to limit the scope of the present application. Without departing from the design spirit of the present application, various modifications and improvements made to the technical solutions of the present application by ordinary technicians in this field should fall within the protection scope of the claims of the present application.

Claims

1. A code repository question-answering method, characterized in that: The method comprises: Get target problem information; Extracting a first target file and a second target file in the target code repository according to the target problem information; the correlation between the second target file and the target problem information is smaller than the correlation between the first target file and the target problem information; Generate target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file; The step of extracting the first target file and the second target file in the target code repository according to the target problem information includes: Extracting a first target file in the target code repository according to the target problem information and a target directory tree corresponding to the target code repository; According to the target keyword corresponding to the target problem information, the target code graph corresponding to the target code repository is searched to obtain target association graph information; A second target file in the target code repository is extracted according to the target association graph information.

2. The method according to claim 1, characterized in that The target code graph is composed of a plurality of nodes and the relationships between the plurality of nodes, and the nodes are used to represent entity information in the target code repository; The step of searching the target code graph corresponding to the target code repository according to the target keyword corresponding to the target problem information to obtain target association graph information includes: Determine the correlation result between each node in the target code graph and the target keyword corresponding to the target question information; The target association graph information in the target code graph is extracted according to the correlation result; the target association graph information includes target association information corresponding to at least one target association node; the target association node is a node in the target code graph related to the target keyword.

3. The method according to claim 2, characterized in that The correlation result includes the correlation between each node in the target code graph and the target keyword corresponding to the target question information; After retrieving the target code graph corresponding to the target code repository according to the target keyword corresponding to the target question information to obtain the target association graph information, before generating the target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree, the method further includes: In the case where the number of the first target files is less than the first target value, the target associated file corresponding to the designated target associated node in the target associated graph information is determined as the first target file; the designated target associated node is used to represent the target associated node in the at least one target associated node corresponding to the correlation ranking within the second target value; The step of extracting the second target file in the target code repository according to the target association graph information includes: A second target file in the target code repository is extracted according to the non-designated target association node in the target association graph information; the second target file is a target association file corresponding to the non-designated target association node.

4. The method according to claim 1, characterized in that: The generating target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file includes: Target answer information corresponding to the target question information is generated according to the target full-text information corresponding to the first target file, the target overview information corresponding to the second target file, and the target directory tree corresponding to the target code repository.

5. The method according to claim 1, characterized in that After generating the target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file, the method further includes: Generate target question recommendation information according to the historical question and answer information, the target full-text information and the target overview information; the historical question and answer information includes the target answer information and / or the target question information.

6. The method according to any one of claims 1 to 5, characterized in that: The obtaining of target problem information includes: Get user question information; The user question information is preprocessed to obtain target question information; the preprocessing includes translation processing and / or similarity expansion processing; the target question information includes a target question, a translation question and at least one similar question corresponding to the user question information.

7. A code warehouse question-answering device, characterized in that: The code warehouse question-answering device comprises: Acquisition module, used to obtain target problem information; an extraction module, configured to extract a first target file and a second target file in a target code repository according to the target problem information; the correlation between the second target file and the target problem information is smaller than the correlation between the first target file and the target problem information; An answer generation module, used to generate target answer information corresponding to the target question information according to the target full-text information corresponding to the first target file and the target overview information corresponding to the second target file; The extraction module comprises: A first extraction unit, configured to extract a first target file in the target code repository according to the target problem information and a target directory tree corresponding to the target code repository; A graph retrieval unit, configured to retrieve a target code graph corresponding to the target code repository according to a target keyword corresponding to the target problem information, to obtain target associated graph information; The second extraction unit is used to extract the second target file in the target code repository according to the target association graph information.

8. An electronic device, characterized in that: include: processor and memory; wherein, The processor is connected to the memory; the memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method steps as described in any one of claims 1-6.

9. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, which are suitable for being loaded by a processor and executing the method steps according to any one of claims 1-6.

Citation Information

Patent Citations

  • Text matching method and device, storage medium and electronic equipment

    CN114548314A

  • Construction of ontologies dependent on utterance trees

    CN117015772A