Knowledge question and answer method, device and equipment for enterprise research and development scene and medium

CN122777652APending Publication Date: 2026-09-18SOUTHERN POWER GRID DIGITAL GRID RESEARCH INSTITUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610857134.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-15
Publication Date
2026-09-18

AI Technical Summary

Technical Problem

然而,这类工具通常仅关注单段代码的语义理解,缺乏对企业私域知识库、本地工程目录以及业务规则的融合能力

Benefits of technology

[0010]The technical solution provided in this application acquires the enterprise's original document data and original code data, and constructs a knowledge fusion index based on these data. It receives user questions, understands the questions, and obtains structured query objects. Based on these structured query objects, it retrieves candidate evidence sets from the knowledge fusion index and historical conversations. The candidate evidence sets are then filtered, and enhanced context is determined based on the filtering results. The enhanced context is input into a large language model to generate intelligent question-answering results. By simultaneously utilizing enterprise business knowledge and code semantic information for joint question answering, the accuracy of knowledge-based question answering, the professionalism of code explanation, and the interpretability and reusability of question-answering results in enterprise R&D scenarios are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122777652A_ABST
    Figure CN122777652A_ABST
Patent Text Reader

Abstract

The application discloses a knowledge question answering method and device for an enterprise research and development scene, equipment and a medium. The method comprises the following steps: acquiring original document data and original code data of an enterprise, and constructing a knowledge fusion index according to the original document data and the original code data; receiving a user question, and performing question understanding on the user question to obtain a structured query object; based on the structured query object, searching from the knowledge fusion index and a historical session to obtain a candidate evidence set; screening the candidate evidence set, and determining an enhanced context based on a screening result; and inputting the enhanced context into a large language model to generate an intelligent question answering result. According to the technical scheme, the accuracy of knowledge question answering, the professionalism of code explanation, and the explainability and reusability of the question answering result in the enterprise research and development scene are improved by simultaneously utilizing enterprise business knowledge and code semantic information for joint question answering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a knowledge question-answering method, apparatus, equipment and medium for enterprise R&D scenarios. Background Technology

[0002] As enterprises continuously improve their IT infrastructure, the knowledge assets accumulated during the R&D process become increasingly abundant. These include document-based knowledge such as technical standards, business specifications, design documents, and maintenance records, as well as code-based knowledge such as source code, comments, and commit records. This knowledge is scattered across different systems, and developers often need to simultaneously consult business documents and understand code logic in their daily work to complete tasks such as feature development, troubleshooting, or system maintenance. However, most existing knowledge management tools focus on document retrieval or code browsing, making it difficult to effectively link business knowledge with code semantics. This forces developers to frequently switch between multiple systems, resulting in low work efficiency.

[0003] On the other hand, code interpretation tools based on large language models have been widely used in recent years, capable of generating functional descriptions or annotations for code snippets. However, these tools typically focus only on the semantic understanding of single code segments, lacking the ability to integrate with enterprise private knowledge bases, local project directories, and business rules. When user questions involve both business specifications and code implementation, general-purpose models often fail to provide accurate and traceable answers. Furthermore, the connection between retrieval and generation in related technologies is relatively loose, lacking a unified reordering and context assembly mechanism for candidate evidence. This results in incomplete or insufficiently relevant context input to the large model, further reducing the accuracy and credibility of the question-answering results. Summary of the Invention

[0004] This application provides a knowledge question answering method, apparatus, device, and medium for enterprise R&D scenarios. This method improves the accuracy of knowledge question answering, the professionalism of code explanation, and the interpretability and reusability of question answering results in enterprise R&D scenarios by simultaneously utilizing enterprise business knowledge and code semantic information for joint question answering.

[0005] According to one aspect of this application, a knowledge question-answering method for enterprise R&D scenarios is provided, the method comprising: Obtain the enterprise's original document data and original code data, and construct a knowledge fusion index based on the original document data and the original code data; Receive user questions, understand the user questions, and obtain structured query objects; Based on the structured query object, a candidate evidence set is obtained by retrieving from the knowledge fusion index and historical sessions; The candidate evidence set is filtered, and the enhanced context is determined based on the filtering results; The enhanced context is input into the large language model to generate intelligent question-answering results.

[0006] According to another aspect of this application, a knowledge question-answering device for enterprise R&D scenarios is provided, characterized in that the device comprises: The index building module is used to obtain the enterprise's original document data and original code data, and to build a knowledge fusion index based on the original document data and the original code data; The problem understanding module is used to receive user problems, understand the user problems, and obtain structured query objects; The hybrid retrieval module is used to retrieve candidate evidence sets from the knowledge fusion index and historical sessions based on the structured query object; An evidence screening module is used to screen the candidate evidence set and determine the enhanced context based on the screening results; The question-answering generation module is used to input the enhanced context into the large language model to generate intelligent question-answering results.

[0007] According to another aspect of this application, an electronic device is provided, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the knowledge question-answering method for enterprise R&D scenarios as described in any embodiment of this application.

[0008] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the knowledge question-answering method for enterprise R&D scenarios as described in any embodiment of this application.

[0009] According to another aspect of this application, a computer program product is provided, the computer program product including a computer program that, when executed by a processor, implements the knowledge question-answering method for enterprise R&D scenarios described in any embodiment of this application.

[0010] The technical solution provided in this application acquires the enterprise's original document data and original code data, and constructs a knowledge fusion index based on these data. It receives user questions, understands the questions, and obtains structured query objects. Based on these structured query objects, it retrieves candidate evidence sets from the knowledge fusion index and historical conversations. The candidate evidence sets are then filtered, and enhanced context is determined based on the filtering results. The enhanced context is input into a large language model to generate intelligent question-answering results. By simultaneously utilizing enterprise business knowledge and code semantic information for joint question answering, the accuracy of knowledge-based question answering, the professionalism of code explanation, and the interpretability and reusability of question-answering results in enterprise R&D scenarios are improved.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart of a knowledge question-answering method for enterprise R&D scenarios provided in Embodiment 1 of this application.

[0014] Figure 2 This is a flowchart of a knowledge question-answering method for enterprise R&D scenarios provided in Embodiment 2 of this application.

[0015] Figure 3 This is a schematic diagram of the entire business process of a knowledge question-answering method for enterprise R&D scenarios provided in Embodiment 2 of the present invention.

[0016] Figure 4 This is a schematic diagram of the structure of a knowledge question-and-answer device for enterprise R&D scenarios provided in Embodiment 3 of the present invention.

[0017] Figure 5 This is a schematic diagram of the structure of a device that implements a knowledge question-answering method for enterprise R&D scenarios according to an embodiment of this application. Detailed Implementation

[0018] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0019] It should be noted that the terms "original," "candidate," "target," "rearrangement," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0020] It should also be noted that the acquisition, storage, use, and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations.

[0021] Example 1 Figure 1 This is a flowchart of a knowledge question answering method for enterprise R&D scenarios provided in Embodiment 1 of this application. This embodiment is applicable to knowledge question answering in digital power grid and large enterprise R&D scenarios. The method can be executed by a knowledge question answering device for enterprise R&D scenarios. The knowledge question answering device for enterprise R&D scenarios can be implemented in hardware and / or software. The knowledge question answering device for enterprise R&D scenarios can be configured in a device with data processing capabilities.

[0022] It should be noted that the knowledge-based question-answering method for enterprise R&D scenarios provided in this application can be deployed on the server side or implemented in a distributed manner using an "IDE plugin / web client + server" architecture. The client is responsible for receiving user questions, file selection, and result display; the server is responsible for knowledge processing, code parsing, index construction, retrieval rearrangement, context assembly, model reasoning, and feedback updates.

[0023] like Figure 1 As shown, the method includes the following steps.

[0024] S110. Obtain the enterprise's original document data and original code data, and construct a knowledge fusion index based on the original document data and the original code data.

[0025] Original document data, including technical standards, business specifications, design documents, interface descriptions, FAQs, case studies, and operation and maintenance records.

[0026] Original code data, including source code files, comments, README, commit history, and directory structure.

[0027] In this application, the server can obtain raw document data and raw code data from an enterprise knowledge base, document management system, local project directory, or code repository. Furthermore, the client can also allow users to temporarily reference local files, local directories, or specified code snippets when asking questions.

[0028] A knowledge fusion index is an index structure that can simultaneously support document and code retrieval and has cross-class association capabilities.

[0029] For example, entity and relation extraction can be performed on the original document data to extract entities such as business objects, technical terms, and specification clauses involved in the document and their interrelationships, thus constructing a document knowledge graph; static analysis can be performed on the original code data to extract program entities such as modules, classes, functions, and interfaces in the code and their call and inheritance relationships, thus constructing a code knowledge graph; then, entities in the two knowledge graphs that point to the same business object or technical concept are aligned and linked to form a unified fusion knowledge graph index.

[0030] For example, separate index structures can be established for the original document data and the original code data, while an identifier mapping table can be created between the two. Specifically, a unique identifier is assigned to each document fragment and a unique identifier is assigned to each code unit (such as a file, function, or class); then, through manual annotation, naming matching, or co-occurrence analysis, document identifiers describing the same business function or technical implementation are associated with code identifiers to form a two-way mapping table.

[0031] S120. Receive user questions and perform question understanding on the user questions to obtain structured query objects.

[0032] Specifically, the client receives a natural language question, selected code, specified file, or specified directory from the user and sends it to the server. After receiving the user's question from the client, the server performs a deep understanding of the question and transforms it into a structured query object that can be used for subsequent retrieval.

[0033] For example, dependency parsing can be performed on user questions to obtain a syntax tree; then, based on a predefined set of rules, core predicates, objects, modifiers, and other components can be extracted from the syntax tree and mapped to preset query fields (such as action type, target object, limiting conditions, scope, etc.); at the same time, the extracted words can be standardized by combining a thesaurus and finally assembled into a structured query object containing multiple fields.

[0034] In some embodiments, optionally, the process of understanding the user's question to obtain a structured query object includes, but is not limited to, the following steps A1-A4: A1. Perform intent recognition on the user's question to determine the intent type.

[0035] Intent types can include pure knowledge-based question answering, pure code explanation, and a mixture of knowledge and code-based question answering.

[0036] For example, a series of rule templates or regular expressions can be written to analyze common question patterns in enterprise R&D scenarios, performing keyword matching and sentence structure analysis on user questions, and determining the intent type based on the matching rules. Questions containing keywords such as "what is," "please explain," and "definition" are classified as knowledge query questions; questions containing keywords such as "why is it written this way" and "the function of this code" are classified as code explanation questions.

[0037] For example, by leveraging the semantic understanding capabilities of large language models, specific prompt templates can be designed to require the large language model to analyze user questions and output intent types.

[0038] A2. Extract the entities from the user question and map the entities to standard terms.

[0039] By performing entity recognition and terminology normalization on user questions, colloquial expressions, abbreviations, device names, and module aliases are uniformly mapped to standard internal terminology to eliminate terminology ambiguity.

[0040] For example, in the company's internal standard terminology, "payment gateway" is the standard name, while user questions may use various expressions such as "payment interface" or "payment channel." The system uses a pre-built thesaurus to directly map "payment interface" in user questions to the standard term "payment gateway."

[0041] A3. Based on the historical sessions, query and rewrite the user questions to complete the contextual information omitted in the user questions.

[0042] Specifically, by combining the history of multiple rounds of dialogue, the objects, scenarios, and constraints that the user omitted in the current question can be supplemented to make the question statement more complete.

[0043] A4. Generate a structured query object based on the intent type, the standard terminology, and the context information.

[0044] Specifically, intent types, standard terms, and contextual information can be encapsulated into structured query objects and used as input for subsequent retrieval steps.

[0045] For example, a template is predefined for each intent type, containing several placeholder fields (such as target object, operation type, limiting conditions, scope, etc.). The standard terms mapped in step A2 are filled into the target object field, and the context information completed in step A3 is filled into the limiting conditions or scope field, finally assembling a structured query object (e.g., JSON format).

[0046] For example, when a user asks "Why does this function handle exceptions this way?", the system will combine the currently selected function, the file it is located in, and the content of the previous conversation to reconstruct a complete query that includes the function name, file path, and business scenario.

[0047] The advantage of the above technical solution is that by using intent recognition, entity mapping, and query rewriting, it transforms ambiguous natural language problems into precise structured query objects, thereby achieving terminology ambiguity elimination and context completion, and improving the accuracy and recall rate of subsequent searches.

[0048] S130. Based on the structured query object, retrieve candidate evidence from the knowledge fusion index and historical sessions to obtain a set of candidate evidence.

[0049] The candidate evidence set is a group of potentially citationable evidence that is aggregated and deduplicated after retrieval and recall in the knowledge fusion index and historical sessions based on the structured query object.

[0050] For example, first use the standard terms / intent types in the query object to hit at least one anchor evidence (such as a hit document paragraph anchor or code object anchor) in the knowledge fusion index and historical sessions. Then, along the pre-stored associations (such as topic keys, attribution relationships, co-occurrence links, etc.), other related entries under the same business topic are diffused and recalled. Finally, the evidence is merged and deduplicated to form a candidate evidence set.

[0051] In some embodiments, optionally, the step of retrieving candidate evidence sets from the knowledge fusion index and historical sessions based on the structured query object includes, but is not limited to, the following steps B1-B2: B1. Based on the structured query object, perform document-side recall and code-side recall within the knowledge fusion index to obtain document-side recall results and code-side recall results, and perform session-side recall from historical sessions to obtain session-side recall results.

[0052] Document-side recall retrieves document data from the knowledge fusion index. Code-side recall retrieves relevant functions, classes, files, and call chain summaries from the code data within the knowledge fusion index. Session-side recall retrieves context related to the current question from historical question-and-answer records, common examples, or recently accessed content.

[0053] B2. Merge the document-side recall results, the code-side recall results, and the session-side recall results to obtain a candidate evidence set.

[0054] Because the three recalls have different targets and sources, their results may contain duplicates, format differences, or complementary information. Therefore, it is necessary to merge the results from the three sources to form a candidate evidence set that can be used for subsequent screening.

[0055] Specifically, the same knowledge fragment or code unit may be simultaneously detected by multiple retrieval paths (e.g., a document fragment is detected by both document-side retrieval and historical references in session-side retrieval). In such cases, deduplication is performed based on the unique identifier of the evidence to avoid duplicate entries in the candidate evidence set. The original formats of the three retrieval results may differ (e.g., document-side retrieval results are document fragments and their metadata, code-side retrieval results are structured descriptions of code semantic units, and session-side retrieval results are historical question-and-answer records). The system uniformly converts these into the internal representation format of the candidate evidence, which includes at least the evidence content, source type, and location information. During the merging process, candidate evidence can also be initially ranked according to the preset priority or recall confidence of each path, placing high-quality evidence at the top.

[0056] In some embodiments, optionally, before performing document-side retrieval and code-side retrieval respectively within the knowledge fusion index based on the structured query object to obtain document-side retrieval results and code-side retrieval results, and performing session-side retrieval from historical sessions to obtain session-side retrieval results, the method further includes: determining retrieval weights for document-side retrieval, code-side retrieval, and session-side retrieval based on the structured query object.

[0057] Retrieval weight refers to the adjustment coefficient calculated or obtained by looking up a table based on the structured query object, which is used to control the resource quota of each of the three recall paths.

[0058] Specifically, when a structured query object contains file paths or code snippets, the weight of code-side recall is increased; when a structured query object contains enterprise terminology, standard clauses, or business rules, the weight of document-side recall is increased; and when a structured query object contains queries specifying a file, code snippet, or local directory, the weight of session-side recall is increased. Through weight adjustments, the search results are made more closely aligned with the user's actual needs.

[0059] The advantage of the above technical solution is that by using multi-path parallel recall and merging, it achieves comprehensive coverage of evidence across types and sources, avoids information omissions caused by a single retrieval source, and provides sufficient candidate evidence for the subsequent generation of high-quality and traceable question-and-answer results.

[0060] S140. Filter the candidate evidence set and determine the enhanced context based on the filtering results.

[0061] After obtaining the candidate evidence set, which contains candidate evidence from different sources and of varying quality, directly inputting it all into a large language model would result in excessively long contexts and increased noise interference, affecting the accuracy and efficiency of the generated results. Therefore, further screening and optimization of the candidate evidence set are necessary to select the most relevant and reliable candidate evidence for assembling enhanced contexts.

[0062] Enhanced context includes at least: 1) user questions and necessary session history; 2) relevant document fragments and their source identifiers; 3) summaries of relevant code semantic units; 4) structured information such as function signatures, class names, file paths, and call relationships; and 5) output format constraints, such as requiring the generation of an answer structure of "functional description + key logic + corresponding basis". This setup ensures that the information input to the large model includes both enterprise knowledge and code semantic basis.

[0063] For example, the sources of candidate evidence can be balanced to ensure that the enhanced context includes evidence from different sources, avoiding the dominance of a single source. For instance, minimum or maximum proportions for each type of source can be set, and source balancing adjustments can be made based on the re-ranking results to make the final selected target evidence more reasonable in terms of source distribution.

[0064] In some embodiments, optionally, the process of filtering the candidate evidence set and determining the enhancement context based on the filtering results includes, but is not limited to, the following steps C1-C3: C1. Determine the multi-dimensional indicators for each candidate piece of evidence in the candidate evidence set; wherein, the multi-dimensional indicators include at least one of semantic relevance, keyword matching degree, source authority, time freshness, code path matching degree, and function position matching degree.

[0065] Semantic relevance refers to the degree of semantic matching between the evidence content and the user's question. Keyword matching measures whether the evidence contains key terms from the user's question. Source authority measures the reliability and authority of the evidence source; for example, a specification document is superior to personal notes. Time freshness measures the timeliness of the evidence; newer evidence is generally more valuable. Code path matching measures whether the code path of the evidence is consistent with the path involved in the user's question. Function location matching measures whether the function location involved in the evidence matches the code location that the user is interested in. Multi-dimensional metrics may also include historical click feedback.

[0066] C2. Based on the multi-dimensional indicators of each candidate piece of evidence, the candidate evidence set is reordered to obtain a reordered evidence set.

[0067] Specifically, a re-ranking model or rule-based scoring mechanism can be used to comprehensively score multi-dimensional indicators to obtain a score for each candidate piece of evidence. The candidate evidence is then ranked from highest to lowest score to obtain a re-ranked evidence set.

[0068] C3. Select at least one candidate piece of evidence from the rearranged evidence set as the target evidence, and obtain the enhanced context based on at least one of the target pieces of evidence.

[0069] Specifically, the top N candidate pieces of evidence can be selected from the rearranged evidence set as target evidence and assembled into enhanced context.

[0070] The advantage of the above technical solution is that by comprehensively evaluating and re-ranking multi-dimensional indicators, the most reliable evidence is accurately selected from the candidate evidence and assembled into an enhanced context containing source and location information, which significantly improves the information quality and traceability of the input large model, thereby improving the accuracy and credibility of the question answering results.

[0071] S150. Input the enhanced context into the large language model to generate intelligent question answering results.

[0072] A large language model can also be a general-purpose large language model, a large code model, an enterprise private deployment model, or a model fine-tuned for a specific domain.

[0073] Specifically, the answer template for intelligent question answering can be determined based on the intent type of the user's question, and then the large language model's response to the enhanced context can be filled into the answer template.

[0074] For example, if the user's question is a knowledge-based question-and-answer scenario, the large model outputs a natural language answer to the question, along with the source of the knowledge; if the user's question is a code explanation scenario, it outputs a description of the function's functionality, key logic, parameter meanings, call relationships, or module usage; if the user's question is a mixed question-and-answer scenario, it provides both business knowledge explanations and code implementation explanations, along with an explanation of the correspondence between the two.

[0075] To avoid generating answers without evidence, the server can also set answer constraint rules. For example, when the retrieved evidence is insufficient or the model confidence level is below a threshold, a "insufficient evidence" message can be returned, or the question can be transferred to a manual processing queue.

[0076] The client displays the results to the user. For knowledge-based question-and-answer results, it can display the answer text, the cited knowledge sources, the document name, and the paragraph position; for code explanation results, it can display the function name, class name, file path, code snippet summary, call relationship, and explanation text; for mixed question-and-answer results, it can display both the "knowledge basis" and "code basis" areas simultaneously.

[0077] The client also supports users to continue asking follow-up questions, forming multiple rounds of conversation; and supports one-click copying, inserting comments, generating document summaries, or exporting explanation results.

[0078] Users can accept, correct, rate, or supplement the Q&A results. The server updates knowledge priority, index weight, and prompt templates based on feedback; incremental processing is performed on new documents, modified code files, and manually corrected results, rebuilding only the affected knowledge units and code semantic units to avoid full rebuilding and improve system update efficiency.

[0079] This invention provides a knowledge-based question-answering method for enterprise R&D scenarios. The method acquires the enterprise's original document data and original code data, and constructs a knowledge fusion index based on these data. It receives user questions, understands the questions, and obtains structured query objects. Based on the structured query objects, it retrieves candidate evidence sets from the knowledge fusion index and historical conversations. The candidate evidence sets are then filtered, and enhanced context is determined based on the filtering results. The enhanced context is input into a large language model to generate intelligent question-answering results. By simultaneously utilizing enterprise business knowledge and code semantic information for joint question answering, the accuracy of knowledge-based question answering, the professionalism of code explanation, and the interpretability and reusability of the question-answering results in enterprise R&D scenarios are improved.

[0080] Example 2 Figure 2 This is a flowchart of a knowledge question answering method for enterprise R&D scenarios provided in Embodiment 2 of this application. This embodiment is based on the above embodiment and is optimized, specifically by optimizing the construction process of the knowledge fusion index.

[0081] like Figure 2 As shown, the method includes the following steps.

[0082] S210. Obtain the enterprise's original document data and original code data.

[0083] S220. The original document data is processed in a structured manner to obtain a set of document knowledge units.

[0084] Specifically, document data can be formatted, content extracted, paragraph segmented, heading level identified, key entity extracted, and metadata labeled to form multiple document knowledge units.

[0085] Each document knowledge unit should include at least the following fields: knowledge content, document title, chapter position, source identifier, update time, and business topic tags.

[0086] It should be noted that for non-plain text content such as tables, lists, and image descriptions, text extraction can be performed first, followed by segmentation into indexable fragments.

[0087] S230. Perform semantic parsing on the original code data to obtain a set of code semantic units.

[0088] Specifically, lexical and syntactic analysis can be performed on code files to obtain an abstract syntax tree; further, function definitions, class definitions, parameters, return values, call relationships, import relationships, comments, file paths, and directory hierarchy information can be extracted; and control flow graphs (CFGs) or dependency graphs can be generated when needed to express code execution paths and cross-file relationships.

[0089] Subsequently, the original code data is segmented into code semantic units at the function, class, file, or module level, and structured description information is generated for each code semantic unit, such as: function name, file, input and output, function summary, caller, callee, related comments, and recent change information.

[0090] S240. Construct a knowledge fusion index based on the document knowledge unit set and the code semantic unit set.

[0091] For example, both document knowledge units and code semantic units can be viewed as nodes in a graph, and the various relationships between units (such as belonging to the same business theme, being referenced by the same requirement document, or having a corresponding name) can be viewed as edges, thus constructing a unified graph index. This graph index allows traversal from any node along the edges to other related types of nodes.

[0092] For example, all document knowledge units and code semantic units can be first categorized by business theme, and documents and code belonging to the same business theme can be grouped into the same theme partition. Within each business theme partition, retrieval sub-indexes can be built on both the document side and the code side, and the correspondence between documents and code within the partition can be recorded.

[0093] In some embodiments, optionally, the step of constructing a knowledge fusion index based on the document knowledge unit set and the code semantic unit set includes, but is not limited to, the following steps S241-S243: S241. Construct a document vector index based on the document knowledge unit set, and construct a code vector index based on the code semantic unit set.

[0094] Specifically, text / summaries in document knowledge units can be extracted or encoded into vectors to build a document vector index; and fields such as summary / signature / comment in code semantic units can be encoded into vectors to build a code vector index.

[0095] S242. Construct a full-text search index based on the text content in the document knowledge unit set and the metadata in the code semantic unit set.

[0096] Specifically, the text content of document knowledge units can be segmented / terminated to build or update inverted indexes; and the metadata / searchable text fields (such as qualified names, annotation keywords, interface names, error codes, directory path words) of code semantic units can be terminated and written into the same or parallel full-text search index structure.

[0097] S243. Establish relationships between document knowledge units and code semantic units under the same business theme, and build a related index.

[0098] Specifically, for document knowledge units and code semantic units under the same business theme, establish a relationship mapping table or graph structure index according to the association between function—class—file—directory—document theme.

[0099] For example, link the contents of documents such as "interface specifications", "algorithm descriptions", and "device object descriptions" with the corresponding functions, classes, and modules; at the same time, record the code path and the knowledge source path to facilitate providing traceable evidence when answering questions later.

[0100] The advantage of the above technical solution is that it builds document / code vector indexes, full-text search indexes, and related indexes on the local machine, respectively. This allows subsequent searches to simultaneously utilize semantic similarity and keyword matching for accurate matching, and to supplement evidence across domains along the relationship, thereby improving the comprehensiveness and traceability of subsequent searches.

[0101] S250. Receive user questions and perform question understanding on the user questions to obtain structured query objects.

[0102] S260. Based on the structured query object, retrieve candidate evidence from the knowledge fusion index and historical sessions to obtain a set of candidate evidence.

[0103] S270. Filter the candidate evidence set and determine the enhanced context based on the filtering results.

[0104] S280. Input the enhanced context into the large language model to generate intelligent question answering results.

[0105] This embodiment provides a knowledge-based question-answering method for enterprise R&D scenarios. This method constructs document knowledge units and code semantic units and encapsulates them into a queryable fusion index, enabling subsequent retrieval to achieve the association and recall of business knowledge and code semantics, as well as the location and traceability of results, thereby improving the accuracy of question-answering and the credibility of evidence.

[0106] Based on the above embodiments, the complete business process of the knowledge question answering method for enterprise R&D scenarios is explained. Figure 3 This is a schematic diagram of the entire business process of a knowledge question-answering method for enterprise R&D scenarios provided in Embodiment 2 of the present invention.

[0107] like Figure 3 As shown, the knowledge question answering method for enterprise R&D scenarios is divided into four parts: user terminal / IDE or Web, knowledge fusion platform, retrieval and semantic understanding engine, and output and feedback update.

[0108] The user interface / IDE or web portal serves as the interaction point. Specifically, the user inputs a question / selects code or specifies a file directory and submits it; after receiving the request, the system queries the search results (history or cache); finally, it outputs the results to the user, who can then choose to continue asking questions / provide feedback or confirm acceptance based on the output.

[0109] The knowledge fusion platform serves as the data preprocessing layer, responsible for transforming unstructured raw data into searchable structured knowledge and identifying the intent type of user questions. Specifically, it collects multi-source data (such as documents, knowledge bases, local code, directories, etc.); performs structured processing on the multi-source data (such as document segmentation, entity extraction, metadata annotation, etc.); performs code semantic parsing (such as AST / CFG / function class summarization / dependencies, etc.); and constructs a fusion index (including full-text indexing, vector indexing, and association mapping). Furthermore, it receives user questions and identifies the context, determining whether they are knowledge-based question answering, code explanation, or a hybrid question answering approach.

[0110] The retrieval and semantic understanding engine forms the core reasoning layer, responsible for understanding user intent and accurately retrieving information from the knowledge base. Specifically, for user questions, it performs question understanding and query rewriting (such as terminology normalization, entity recognition, and conversation completion); based on the structured query object of the user question, it performs hybrid retrieval (including document retrieval, code semantic retrieval, and historical retrieval) to obtain a candidate evidence set; it reorders and assembles the context of the candidate evidence set (including evidence filtering, path location, and source assembly) to obtain enhanced context; it determines whether the enhanced context evidence is sufficient and its relevance reaches a threshold; if so, it is input into the large model to generate an answer (including knowledge basis, code explanation, and location information).

[0111] The output and feedback are updated to the results display layer. Specifically, if the enhanced contextual evidence is insufficient or the relevance does not reach the threshold, an insufficient evidence prompt is returned or the case is transferred to manual processing; if the answer is generated by the large model, the results are displayed and feedback is recorded to update the knowledge and index.

[0112] The knowledge fusion platform solves the problem of the disconnect between code and natural language, the retrieval and semantic understanding engine enables accurate context-aware question answering, and the human-machine collaboration mechanism ensures the quality of processing high-difficulty questions.

[0113] Example 3 Figure 4 This is a schematic diagram of the structure of a knowledge question-answering device for enterprise R&D scenarios provided in Embodiment 3 of the present invention. Figure 4 As shown, the device includes: The index building module 310 is used to obtain the enterprise's original document data and original code data, and to build a knowledge fusion index based on the original document data and the original code data; The problem understanding module 320 is used to receive user problems, understand the user problems, and obtain structured query objects; The hybrid retrieval module 330 is used to retrieve candidate evidence sets from the knowledge fusion index and historical sessions based on the structured query object; The evidence screening module 340 is used to screen the candidate evidence set and determine the enhanced context based on the screening results; The question-answering generation module 350 is used to input the enhanced context into the large language model to generate intelligent question-answering results.

[0114] This invention provides a knowledge-based question-answering device for enterprise R&D scenarios. The device acquires the enterprise's original document data and original code data, and constructs a knowledge fusion index based on these data. It receives user questions, understands the questions, and obtains structured query objects. Based on these structured query objects, it retrieves candidate evidence sets from the knowledge fusion index and historical conversations. It then filters the candidate evidence sets and determines enhanced context based on the filtering results. Finally, it inputs the enhanced context into a large language model to generate intelligent question-answering results. This technical solution improves the accuracy of knowledge-based question answering, the professionalism of code explanation, and the interpretability and reusability of question-answering results in enterprise R&D scenarios by simultaneously utilizing enterprise business knowledge and code semantic information for joint question answering.

[0115] Furthermore, the index construction module 310 includes: The document data processing unit is used to perform structured processing on the original document data to obtain a set of document knowledge units; A code data processing unit is used to perform semantic parsing on the original code data to obtain a set of code semantic units; The knowledge index construction unit is used to construct a knowledge fusion index based on the document knowledge unit set and the code semantic unit set.

[0116] Furthermore, the knowledge index construction unit includes: A vector index construction subunit is used to construct a document vector index based on the document knowledge unit set, and to construct a code vector index based on the code semantic unit set; The full-text search index construction subunit is used to construct a full-text search index based on the text content in the document knowledge unit set and the metadata in the code semantic unit set. The associated index building sub-unit is used to establish relationships between document knowledge units and code semantic units under the same business theme, and to build an associated index.

[0117] Furthermore, the problem understanding module 320 includes: An intent type determination unit is used to identify the intent of the user question in order to determine the intent type. An entity standardization mapping unit is used to extract entities from the user question and map the entities to standard terms. The context completion unit is used to query and rewrite the user question based on the historical session in order to complete the context information omitted in the user question; The question structure generation unit is used to generate structured query objects based on the intent type, the standard terms, and the context information.

[0118] Furthermore, the hybrid retrieval module 330 includes: The retrieval and recall unit is used to perform document-side recall and code-side recall respectively within the knowledge fusion index based on the structured query object, to obtain document-side recall results and code-side recall results, and to perform session-side recall from historical sessions to obtain session-side recall results. The recall result merging unit is used to merge the document-side recall result, the code-side recall result, and the session-side recall result to obtain a candidate evidence set.

[0119] Furthermore, the hybrid retrieval module 330 also includes: The retrieval weight determination unit is used to determine retrieval weights based on the structured query object for document-side retrieval, code-side retrieval, and session-side retrieval, respectively.

[0120] Furthermore, the evidence screening module 340 includes: A multi-dimensional indicator determination unit is used to determine the multi-dimensional indicators of each candidate piece of evidence in the candidate evidence set; wherein, the multi-dimensional indicators include at least one of semantic relevance, keyword matching degree, source authority, time freshness, code path matching degree, and function position matching degree; The candidate evidence set rearrangement unit is used to rearrange the candidate evidence set according to the multi-dimensional indicators of each candidate evidence to obtain a rearranged evidence set. An enhanced context generation unit is used to select at least one candidate piece of evidence as target evidence from the rearranged evidence set, and to obtain an enhanced context based on at least one of the target pieces of evidence.

[0121] The knowledge question-answering device for enterprise R&D scenarios provided in the embodiments of the present invention can execute the knowledge question-answering method for enterprise R&D scenarios provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0122] Example 4 Figure 5 A schematic diagram of the structure of a device 10 that can be used to implement embodiments of this application is shown. The device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0123] like Figure 5 As shown, device 10 includes at least one processor 11 and a memory, such as read-only memory (ROM) 12, random access memory (RAM) 13, etc., communicatively connected to at least one processor 11. The memory stores computer programs executable by at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from storage unit 18. The RAM 13 may also store various programs and data required for the operation of device 10. The processor 11, ROM 12, and RAM 13 are interconnected via bus 14. Input / output (I / O) interface 15 is also connected to bus 14.

[0124] Multiple components in device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0125] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing unit (CPU), graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as knowledge question answering methods for enterprise R&D scenarios.

[0126] In some embodiments, the knowledge-based question-answering method for enterprise R&D scenarios can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the knowledge-based question-answering method for enterprise R&D scenarios described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the knowledge-based question-answering method for enterprise R&D scenarios by any other suitable means (e.g., by means of firmware).

[0127] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0128] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0129] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0130] To provide interaction with a user, the systems and techniques described herein can be implemented on a device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0131] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0132] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0133] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication unit 19, or installed from storage unit 18, or installed from ROM 12. When the computer program is executed by processor 11, it performs the functions defined in the methods of the embodiments of the present invention.

[0134] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.

[0135] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A knowledge-based question-answering method for enterprise R&D scenarios, characterized in that, include: Obtain the enterprise's original document data and original code data, and construct a knowledge fusion index based on the original document data and the original code data; Receive user questions, understand the user questions, and obtain structured query objects; Based on the structured query object, a candidate evidence set is obtained by retrieving from the knowledge fusion index and historical sessions; The candidate evidence set is filtered, and the enhanced context is determined based on the filtering results; The enhanced context is input into the large language model to generate intelligent question-answering results.

2. The knowledge question-answering method for enterprise R&D scenarios according to claim 1, characterized in that, The construction of the knowledge fusion index based on the original document data and the original code data includes: The original document data is processed in a structured manner to obtain a set of document knowledge units; The original code data is semantically parsed to obtain a set of code semantic units; A knowledge fusion index is constructed based on the document knowledge unit set and the code semantic unit set.

3. The knowledge question-answering method for enterprise R&D scenarios according to claim 2, characterized in that, The step of constructing a knowledge fusion index based on the document knowledge unit set and the code semantic unit set includes: A document vector index is constructed based on the document knowledge unit set, and a code vector index is constructed based on the code semantic unit set; A full-text search index is constructed based on the text content in the document knowledge unit set and the metadata in the code semantic unit set; Establish relationships between document knowledge units and code semantic units under the same business theme, and build a related index.

4. The knowledge question-answering method for enterprise R&D scenarios according to claim 1, characterized in that, The process of understanding the user's question to obtain a structured query object includes: The user's question is subjected to intent recognition to determine the intent type; Extract entities from the user question and map the entities to standard terms; Based on the historical sessions, the user questions are queried and rewritten to complete the contextual information omitted in the user questions; A structured query object is generated based on the intent type, the standard terminology, and the context information.

5. The knowledge question-answering method for enterprise R&D scenarios according to claim 1, characterized in that, The process involves retrieving candidate evidence sets from the knowledge fusion index and historical sessions based on the structured query object, including: Based on the structured query object, document-side retrieval and code-side retrieval are performed respectively within the knowledge fusion index to obtain document-side retrieval results and code-side retrieval results, and session-side retrieval is performed from historical sessions to obtain session-side retrieval results. The document-side recall results, the code-side recall results, and the session-side recall results are merged to obtain a candidate evidence set.

6. The knowledge question-answering method for enterprise R&D scenarios according to claim 5, characterized in that, Before performing document-side retrieval and code-side retrieval respectively within the knowledge fusion index based on the structured query object to obtain document-side retrieval results and code-side retrieval results, and performing session-side retrieval from historical sessions to obtain session-side retrieval results, the method further includes: Based on the structured query object, retrieval weights are determined for document-side recall, code-side recall, and session-side recall, respectively.

7. The knowledge question-answering method for enterprise R&D scenarios according to claim 1, characterized in that, The step of filtering the candidate evidence set and determining the enhanced context based on the filtering results includes: Determine the multi-dimensional indicators for each candidate piece of evidence in the candidate evidence set; wherein the multi-dimensional indicators include at least one of semantic relevance, keyword matching degree, source authority, time freshness, code path matching degree, and function position matching degree. Based on the multi-dimensional indicators of each candidate piece of evidence, the candidate evidence set is reordered to obtain a reordered evidence set; At least one candidate piece of evidence is selected as the target evidence from the rearranged evidence set, and an enhanced context is obtained based on at least one of the target pieces of evidence.

8. A knowledge-based question-and-answer device for enterprise R&D scenarios, characterized in that, The device includes: The index building module is used to obtain the enterprise's original document data and original code data, and to build a knowledge fusion index based on the original document data and the original code data; The problem understanding module is used to receive user problems, understand the user problems, and obtain structured query objects; The hybrid retrieval module is used to retrieve candidate evidence sets from the knowledge fusion index and historical sessions based on the structured query object; An evidence screening module is used to screen the candidate evidence set and determine the enhanced context based on the screening results; The question-answering generation module is used to input the enhanced context into the large language model to generate intelligent question-answering results.

9. An electronic device, characterized in that, The device includes: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the knowledge question-answering method for enterprise R&D scenarios as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the knowledge question-answering method for enterprise R&D scenarios as described in any one of claims 1-7.