Question and answer method fusing enterprise-level heterogeneous knowledge base and computer readable storage medium
By using data segmentation and hybrid retrieval technology on heterogeneous enterprise platforms, the problem of information silos in enterprise question-and-answer systems has been solved, enabling efficient, accurate, and timely question-and-answer services across platforms.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-15
- Publication Date
- 2026-04-10
AI Technical Summary
Existing enterprise question-and-answer systems cannot effectively integrate and synchronize knowledge from multiple heterogeneous platforms, resulting in low query efficiency and easy omission of key information. They also lack dynamic synchronization mechanisms, causing question-and-answer results to lag behind the latest information.
By periodically downloading data from enterprise platforms, processing it in blocks and labeling metadata, and using sparse and dense retrieval combined with a cross-encoder, a cross-platform question-answering method is generated. This enables unified access and integration of knowledge from multiple enterprise platforms, ensuring the accuracy and timeliness of answers.
It enables comprehensive knowledge retrieval across platforms, improving retrieval efficiency and answer accuracy, reducing information silos, and ensuring that question-and-answer results are based on the latest knowledge.
Smart Images

Figure CN121833880A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural language processing technology. More specifically, this invention relates to a question-answering method and a computer-readable storage medium that integrates an enterprise-level heterogeneous knowledge base. Background Technology
[0002] In the process of modern enterprise operation, knowledge is scattered across many heterogeneous platforms, such as (1) local document systems: Word, PDF, Excel, PPT, text files, etc., with both structured and unstructured formats; (2) project management tools: such as Redmine, which contains information such as tasks, requirements, issue tracking, and Wiki pages; (3) enterprise communication and collaboration platforms: such as Lark and WeChat Work, which contain a large amount of group chat records, document sharing, knowledge base, and schedules; (4) email systems: which contain a large amount of historical communication, decision-making, and notification information.
[0003] These platforms differ in data format, access interface, update frequency, and content semantics, creating serious "knowledge silos." Traditional enterprise search or question-and-answer systems require queries to be performed on multiple platforms, which is inefficient, prone to missing key information, and lacks a dynamic synchronization mechanism, meaning that question-and-answer results may lag behind the latest information.
[0004] Existing open-source or commercial RAG systems typically target a single or limited number of standardized data sources, lacking effective support for the complex heterogeneous enterprise environments described above. Summary of the Invention
[0005] In view of this, this application provides a question-answering method that integrates an enterprise-level heterogeneous knowledge base, aiming to improve at least one of the above-mentioned problems.
[0006] Specifically, the following technical solutions are included:
[0007] On the one hand, embodiments of this application provide a question-answering method that integrates enterprise-level heterogeneous knowledge bases, the method being as follows:
[0008] (1) Periodically download data from multiple enterprise platforms, process the downloaded data into structured text blocks, label the metadata of each text block, and put it into the database;
[0009] (2) Find N text blocks in the database that are highly semantically relevant to the user's query;
[0010] (3) Embed the user query and its corresponding N text blocks into the prompt word template to form prompt words. The large language model outputs the answer corresponding to the user query.
[0011] In some embodiments of the present invention, the downloaded data is divided into instant messaging text and non-instant messaging text, and the text block extraction process for the two types of text is as follows:
[0012] For non-real-time communication text, the text is divided into blocks based on text paragraphs, the semantic similarity of adjacent text blocks is calculated, and text blocks with high semantic similarity are merged to form a text block;
[0013] For instant messaging text, a user's single message is used as the initial text block. Noise in the initial text block is filtered out, and the initial text blocks are classified based on user identifiers. Each user corresponds to an initial text block set. The initial text blocks in each initial text block set are merged sequentially to form a text block.
[0014] In some embodiments of the present invention, the merging process of the initial text blocks is as follows:
[0015] Merge adjacent initial text blocks whose time interval between initial text blocks is less than a set duration;
[0016] Adjacent initial text blocks with semantic similarity higher than a set threshold are merged to form the text block corresponding to the user.
[0017] In some embodiments of the present invention, metadata for each text block is constructed, including: text block identifier chunk_id, permission identifier permission_tag, update timestamp last_updated_time, and specific source location chunk_position.
[0018] In some embodiments of the present invention, the process of obtaining N text blocks with high semantic relevance to a user query is as follows:
[0019] (21) Based on the user query, perform sparse retrieval and / or dense retrieval on the relevant text blocks to obtain M text blocks that are highly semantically related to the user query.
[0020] (22) Determine the candidate text blocks among the M text blocks, obtain the relevance scores between the user query and each candidate text block based on the cross encoder, and select the N candidate text blocks with the highest relevance scores as the N text blocks with high semantic relevance to the user query.
[0021] In some embodiments of the present invention, the user identifier of the initial user query Query and the access permissions of the user identifier are obtained, the text blocks located within the access permissions are queried from the database and put into the set to be matched, and sparse search and / or dense search are performed on the text blocks in the set to be matched.
[0022] In some embodiments of the present invention, the process of obtaining the M text blocks that are highly semantically relevant to the user query is as follows:
[0023] Based on the user query, a sparse search is performed on the set to be matched to obtain M1 text blocks with high semantic relevance scores to the user query and a relevance score Score_1.
[0024] The user query is encoded to form a query vector. The text blocks in the database are encoded using the corresponding language model to form text block embedding vectors. The M2 text blocks with high similarity scores and similarity scores Score_2 with the query vector are found in the text block embedding vectors in the set to be matched.
[0025] Set weights c1 and c2 for sparse and dense retrieval, calculate the total score for each text block, Score = c1*Score_1 + c2*Score_2, and select the M text blocks with the highest total scores.
[0026] In some embodiments of the present invention, text blocks with scores lower than a score threshold are deleted from M text blocks, and the remaining text blocks are used as candidate text blocks.
[0027] On the one hand, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described question-and-answer method for integrating an enterprise-level heterogeneous knowledge base.
[0028] The question-answering method integrating enterprise-level heterogeneous knowledge bases provided by this invention has the following beneficial technical effects: Breaking down information silos: Achieving unified access and integration of heterogeneous knowledge sources across multiple enterprise platforms, including local documents, Redmine, Lark, WeChat Work, and email; Improving query efficiency and experience: Users only need to query once to obtain comprehensive knowledge across platforms; Enhancing answer accuracy and relevance: Hybrid retrieval ensures high recall, and cross-encoder ranking ensures highly relevant context, significantly improving the quality and factual accuracy of the final generated answer and reducing the illusion of large models; Ensuring knowledge timeliness: The dynamic database update mechanism ensures that question-answering results are based on the latest enterprise knowledge. Attached Figure Description
[0029] 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.
[0030] Figure 1A flowchart of a question-answering method integrating an enterprise-level heterogeneous knowledge base provided in an embodiment of the present invention;
[0031] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0033] Unless otherwise defined, all technical terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art.
[0034] Figure 1 The flowchart of the question-answering method integrating an enterprise-level heterogeneous knowledge base provided in this embodiment of the invention is as follows:
[0035] (1) Periodically download data from multiple enterprise platforms, process the downloaded data into structured text blocks, label the metadata of each text block, and put it into the database;
[0036] In this embodiment of the invention, relevant data is downloaded from various enterprise platforms periodically or based on platform events. Since the data formats differ across enterprise platforms, text in various formats (.docx, .pdf, .xlsx, .pptx, .txt, etc.) is processed in chunks. For text containing tables and / or images, specific text identifiers are inserted into the text. The text is divided into two categories: instant messaging text and non-instant messaging text. The specific text chunk extraction process for these two types of text is as follows:
[0037] For non-instant messaging text, including local files, email bodies and attachments, the text is first divided into blocks based on paragraphs, with each paragraph corresponding to a text block. The semantic similarity of adjacent text blocks is calculated, and text blocks with high semantic similarity are merged.
[0038] For instant messaging text, including WeChat Work, QQ, Lark, and customer service systems, each user's single message is used as the initial text block. Noise in the initial text block, including pure emojis / system notifications, is filtered out. The initial text blocks are classified based on user identifiers, with each user corresponding to a set of initial text blocks. The initial text blocks in each set are then merged sequentially. The merging process is as follows:
[0039] First, adjacent initial text blocks whose transmission interval is less than a set time are merged; second, adjacent initial text blocks with semantic similarity higher than a set threshold are merged to finally form the text block corresponding to the user.
[0040] This invention uses a document parser to parse text, tables, and images (OCR) in various formats (.docx, .pdf, .xlsx, .pptx, .txt, etc.), and saves the extracted text as a Markdown file. Specifically, PDF document parsing uses the pypdfium2 library and OCR technology to identify and extract elements such as titles, tables, and images; docx document parsing uses the python-docx library to extract text paragraphs and tables; pptx document parsing uses the python-pptx library to extract text paragraphs and tables; xlsx document parsing uses the openpyxl library to handle complex table formats, such as merging cells, and filters out blank rows and columns to reduce invalid interference; and txt document parsing uses the chardet library to detect the file encoding before reading the file content to ensure correct reading.
[0041] In this embodiment of the invention, metadata for each text block is constructed, and the text blocks with metadata are placed in the database. The metadata includes: a text block identifier (chunk_id), a permission identifier (permission_tag), an update timestamp (last_updated_time), and a specific source position (chunk_position). The text block identifier (chunk_id) is used to uniquely identify each text block, the permission identifier (permission_tag) inherits the permissions of the original file, and the specific source position (chunk_position) is used to record the source of the text block for easy tracing later.
[0042] (2) Find N text blocks in the database that are highly semantically relevant to the user's query;
[0043] In this embodiment of the invention, the initial user query is preprocessed, namely, the user query is expanded with synonyms, spelled correctly, and the intent is shallowly rewritten to form a new user query. The user identifier and access permissions of the initial user query are obtained. Text blocks within the access permissions are retrieved from the database and added to the matching set. Sparse retrieval and / or dense retrieval are performed on the matching set based on the user query to finally obtain M text blocks with high semantic relevance to the user query.
[0044] (a) Sparse retrieval: Based on the user query, perform sparse retrieval on the set to be matched to obtain M text blocks with high semantic relevance scores to the user query, and perform sparse retrieval based on the BM25 model;
[0045] (b) Dense retrieval: Use a pre-trained or fine-tuned language model (such as BAAI / bge-large-zh-v1.5) to encode the user query to form a query vector, use the corresponding language model to encode the text blocks in the database to form the embedding vector of the text blocks, and find the M text blocks with high similarity (cosine similarity score) with the query vector in the embedding vector of the text blocks in the set to be matched.
[0046] (c) Hybrid retrieval:
[0047] Sparse retrieval: Based on the user query, a sparse retrieval is performed on the set to be matched to obtain M1 text blocks with high semantic relevance scores to the user query and a relevance score Score_1;
[0048] Dense retrieval: The user query is encoded to form a query vector. The text blocks in the database are encoded using the corresponding language model to form text block embedding vectors. The M2 text blocks with high similarity scores and similarity scores Score_2 with the query vector are found in the text block embedding vectors in the set to be matched.
[0049] Set weights c1 and c2 for sparse and dense retrieval, calculate the total score for each text block, Score = c1*Score_1 + c2*Score_2, and select the M text blocks with the highest total scores.
[0050] In this embodiment of the invention, after determining the user query and M highly relevant text blocks based on sparse retrieval and / or dense retrieval, the best N text blocks are selected from the M text blocks. The selection process is as follows:
[0051] (21) Delete text blocks with scores lower than the score threshold from M text blocks, and use the remaining text blocks as candidate text blocks;
[0052] In this embodiment of the invention, if M text blocks with high semantic relevance to the user query are obtained through sparse retrieval, the above score is the relevance score Score_1; if M text blocks with high similarity scores to the query vector are obtained through dense retrieval, the above score is the similarity score Score_2; if M text blocks with high total scores are determined through hybrid retrieval, the above score is the total score Score, and corresponding score thresholds are set for the relevance score Score_1, the similarity score Score_2, and the total score Score.
[0053] (22) Input the user query and a candidate text block into the cross-encoder. The cross-encoder outputs the relevance score of the corresponding candidate text block (a probability value or score of 0-1).
[0054] (23) Select the N candidate text blocks with the highest relevance scores as the relevant text blocks for the user query, where N << M.
[0055] This invention uses a cross-encoder model specifically trained to cross sentences. The user query and a candidate text block are input into the cross-encoder model. The cross-encoder model outputs the relevance score between the candidate text block and the user query. Based on the relevance score, each candidate text block is sorted in descending order. After traversing all candidate text blocks, the top N candidate text blocks are selected as the relevant text blocks of the user query.
[0056] (3) Embed the user query and its corresponding N text blocks into the prompt word template to form prompt words. The large language model outputs the answer corresponding to the user query.
[0057] The constructed prompt words are input into a preloaded or remotely invoked large language model (such as GPT-4, Claude, Tongyi 1000 Questions, open source LLM, etc.), which outputs natural language answers and extracts / associates source information to display to the user.
[0058] The present invention illustrates the specific implementation process of the above-mentioned question-answering method integrating enterprise-level heterogeneous knowledge bases through the following embodiments, where the original data is downloaded from Lark, as follows:
[0059] [09:00] Zhang San: Equipment A temperature abnormality → Initial block 1;
[0060] [09:01] Zhang San: Temperature has been raised to 120℃ → Timing merged into block 1 (interval <10min);
[0061] [09:15] Li Si: I suggest shutting down the machine for maintenance → Initial block 2;
[0062] [09:16] Li Si: Reference manual P32 → Semantic merging into block 2 (similarity 0.92>0.85);
[0063] Formation of text blocks:
[0064] Text block 1: Device A has an abnormal temperature, which has risen to 120℃;
[0065] Text block 2: It is recommended to shut down the machine for maintenance. See page 32 of the manual.
[0066] Index building: The text is divided into chunks and stored in the Elasticsearch full-text search database. The text chunks are then encoded to form multi-dimensional embedding vectors, which are stored in the Milvus vector database.
[0067] User query: "Device A troubleshooting methods"
[0068] Sparse Search (BM25, weight c1=0.3): Elasticsearch database returns Top 40 fragments (including product manual P15).
[0069] Dense search (cosine similarity, weight c2=0.7): Milvus database returns Top 40 segments (including Lark group chat segment 1);
[0070] Merged results: The total score is calculated as 0.3 * Score_1 + 0.7 * Score_2, and the top 50 segments are selected for initial screening. M=50
[0071] Threshold filtering: Remove 23 text blocks with a score ≤ 0.2. Input the user query and the remaining 27 text blocks into the cross-encoder, re-rank and score the text blocks, and retain the 10 blocks with the highest scores (N=10), as follows:
[0072] 1. [Score 0.93] Product Manual P15: Overheating Process for Equipment A...;
[0073] 2. [Rating 0.88] Lark Group Chat: Suggestions for Handling Abnormal Temperature in Device A...;
[0074] 3. [Score 0.85] Redmine Issue #205: Equipment A Fault Repair Record...;
[0075] ...
[0076] Based on the user's query and the 10 highest-scoring (N=10) keywords in this block, the following suggestions are generated:
[0077] Prompt Template:
[0078] Answer based on the following context; fabricated answers are prohibited! If no relevant information is found, reply with "No relevant content found, unable to answer," and generate a natural and friendly follow-up question to guide the user to provide more specific and detailed questions.
[0079] Context:
[0080] [1] Product Manual P15: Equipment A must be stopped immediately for cooling if it overheats...;
[0081] [2] Lark group chat: Zhang San reports that the temperature of device A is abnormal, reaching 120℃...;
[0082] [3] Redmine Issue #205: Equipment A Fault Repair Record...;
[0083] ...
[0084] Question: How to handle malfunctions in device A;
[0085] LLM generation results:
[0086] "According to product manual page 15 and Lark technical discussion records, the following are the procedures for handling abnormal temperatures in device A: "
[0087] 1. Stop the equipment immediately;
[0088] 2. Activate the backup cooling system to lower the temperature;
[0089] 3. Contact the repair team to check the circuit (see Redmine Issue #205);
[0090] Data source: Product manual P15 / Lark group chat 2024-08-10.
[0091] The question-answering method integrating enterprise-level heterogeneous knowledge bases provided by this invention has the following beneficial technical effects: Breaking down information silos: Achieving unified access and integration of heterogeneous knowledge sources such as local documents, Redmine, Lark, WeChat Work, and email; Improving query efficiency and experience: Users only need to query once to obtain comprehensive knowledge across platforms; Enhancing answer accuracy and relevance: Hybrid retrieval ensures high recall, and cross-encoder ranking ensures highly relevant context, significantly improving the quality and factual accuracy of the final generated answer and reducing the illusion of large models; Ensuring knowledge timeliness: The dynamic database update mechanism ensures that question-answering results are based on the latest enterprise knowledge.
[0092] In this embodiment of the invention, a computer-readable storage medium is also provided. This storage medium can store a program suitable for processor execution. During program execution, the device containing the computer-readable storage medium executes the aforementioned question-answering method integrating an enterprise-level heterogeneous knowledge base. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0093] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only.
[0094] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for fusing enterprise-level heterogeneous knowledge bases for question answering, the method comprising: The method is specifically as follows: (1) periodically download data from multiple enterprise platforms, process the downloaded data into structured text blocks, and mark the metadata of each text block and put it into the database; (2) find N text blocks with high semantic correlation with the user query Query from the database; (3) embed the user query Query and the corresponding N text blocks into the prompt word template to form the prompt word, and the large language model outputs the answer corresponding to the user query Query.
2. The method of claim 1, wherein the fusing the enterprise heterogeneous knowledge bases comprises: The downloaded data is divided into instant messaging text and non-instant messaging text, and the text block extraction process of the two types of text is as follows: For non-instant messaging text, text blocks are divided based on text paragraphs, the semantic similarity of adjacent text blocks is calculated, and text blocks with high semantic similarity are merged to form text blocks; For instant messaging text, the user's single message is taken as an initial text block, the noise in the initial text block is filtered, the initial text block is classified based on the user identifier, each user corresponds to an initial text block set, and the initial text blocks in each initial text block set are merged in turn to form text blocks.
3. The method of claim 2, wherein the method further comprises: The merging process of the initial text block is as follows: Merge adjacent initial text blocks in the initial text block set with a time interval less than a set time length; Merge adjacent initial text blocks with a semantic similarity higher than a set threshold to form text blocks corresponding to the user.
4. The method of claim 1, wherein the fusing the enterprise heterogeneous knowledge bases comprises: The metadata of each text block is constructed, including: text block identifier chunk_id, permission identifier permission_tag, update timestamp last_updated_time and specific source location chunk_position.
5. The method of claim 1, wherein the fusing the enterprise heterogeneous knowledge bases comprises: The process of obtaining N text blocks with high semantic correlation with the user query Query is as follows: (21) Perform sparse retrieval and / or dense retrieval on the relevant text blocks based on the user query Query to obtain M text blocks with high semantic correlation with the user query Query; (22) Determine the candidate text blocks in the M text blocks, obtain the correlation scores between the user query Query and each candidate text block based on the cross-encoder, and select the N candidate text blocks with the highest correlation scores as the N text blocks with high semantic correlation with the user query Query.
6. The method of claim 5, wherein the fusing of the enterprise heterogeneous knowledge bases comprises: Get the user identifier of the initial user query Query and the access permission of the user identifier, query the text blocks within the access permission from the database and put them into the matching set, and perform sparse retrieval and / or dense retrieval on the text blocks in the matching set.
7. The method of claim 6, wherein the fusing the enterprise heterogeneous knowledge bases comprises: The process of obtaining M text blocks with high semantic correlation with the user query Query is as follows: Perform sparse retrieval on the matching set based on the user query Query to obtain M1 text blocks with high semantic correlation scores with the user query Query and correlation scores Score_1; Encode the user query Query to form a query vector, encode the text blocks in the database using the corresponding language model to form embedding vectors of the text blocks, and find M2 text blocks with high similarity scores with the query vector in the embedding vectors of the text blocks in the matching set and similarity scores Score_2; Set the weights c1, c2 of sparse retrieval and dense retrieval, calculate the total score of each text block, Score = c1* Score_1 + c2* Score_2, select M text blocks with high total score.
8. The method of claim 5, wherein the fusing of the enterprise heterogeneous knowledge bases comprises: Delete the text blocks with scores lower than the score threshold from the M text blocks, and take the remaining text blocks as candidate text blocks.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the question and answer method of the fused enterprise-level heterogeneous knowledge base as claimed in any one of claims 1 to 8.