Domain intelligent question-answering system and method based on knowledge graph library and text vector library
Through an intelligent question-and-answer system combining knowledge graph library and text vector library, the traditional intelligent question-and-answer system solves the problems of insufficient knowledge and hallucinatory answers in specific fields, and realizes efficient and accurate domain knowledge retrieval and question-and-answer services to ensure the integrity of the answers and logical coherence.
Patent Information
- Application Number
- CN202411232806.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-13
AI Technical Summary
When traditional intelligent question-and-answer systems deal with problems in specific vertical fields, there are problems with insufficient knowledge and hallucinatory answers, and text block segmentation may destroy text semantic continuity, resulting in incomplete answers or logical incoherence.
Adopt a domain intelligent question-and-answer system based on knowledge graph library and text vector library. Through the combination of knowledge management and text vector library, ontology modeling, automated knowledge extraction, voice interaction and customized Prompt technology are used to realize structured and unstructured knowledge. Search and answer generation.
It improves the efficiency and accuracy of user queries, provides accurate domain knowledge Q&A services, ensures the integrity and logical coherence of answers, and enhances the credibility and user experience of the system.
Smart Images

Figure CN119128095A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge graphs and intelligent question answering, and specifically to a domain intelligent question answering system and method based on a knowledge graph library and a text vector library. Background Art
[0002] Knowledge graphs and intelligent question-answering systems are two important application directions in the field of natural language processing. Since traditional relational databases have limitations in processing complex related data, multi-hop queries, and semantic network construction, graph-structured databases, as a new type of data storage and management method, have gradually become the first choice for organizing such data formats. In recent years, intelligent question-answering systems have made continuous breakthroughs in technology, and their application scope has been widely penetrated into various industries and fields, providing users with efficient and accurate information retrieval and question-answering services.
[0003] Most current intelligent question-answering systems rely on large language models in general fields to provide question-answering services. However, for questions in specific vertical fields, these models often have problems with insufficient knowledge or produce hallucinatory answers. To meet this challenge, researchers have introduced an external knowledge base strategy, that is, based on the large language model, an external text vector library is combined to perform text block vector similarity retrieval. This method alleviates the model's lack of knowledge in specific fields and hallucination problems to a certain extent. However, the use of text block segmentation may destroy the continuity of text semantics and may divide the complete semantic information into two parts, which may cause the system output answers to have incomplete information or logical incoherence. For this reason, the present invention proposes a domain intelligent question-answering system and method based on a knowledge graph library and a text vector library. Summary of the invention
[0004] The purpose of the present invention is to provide a domain intelligent question answering system and method based on a knowledge graph library and a text vector library to solve the problems raised in the above background technology.
[0005] To achieve the above purpose, a domain intelligent question answering system based on a knowledge graph library and a text vector library is proposed. The system includes two subsystems: a knowledge management system and a domain intelligent question answering system. Specifically,
[0006] The knowledge management system is used to manage two types of knowledge bases, including:
[0007] Knowledge base domain management module: responsible for classifying, organizing and maintaining knowledge in different fields; providing operations for adding, deleting, modifying and checking domain information;
[0008] Knowledge graph library management module: The ontology modeling function supports the construction of domain ontology, defines conceptual models such as classes, attributes, and relationships, and provides a structured framework for the knowledge graph; the knowledge instance management function implements the addition, editing, deletion, and query operations of specific knowledge instances in the knowledge graph; the knowledge extraction and update function automatically extracts knowledge from unstructured text through the model and regularly updates the knowledge graph;
[0009] Text vector library management module: responsible for storing and managing the vector representation of text data, supporting fast retrieval and analysis of text content; providing functions for importing, exporting, updating and maintaining text vectors; supporting index construction and query optimization of vector libraries;
[0010] The domain intelligent question answering system mainly provides users with domain knowledge intelligent question answering services, including:
[0011] Domain Q&A module: This module relies on the retrieval results of structured and unstructured knowledge to provide users with accurate question answering services;
[0012] Question recommendation module: Based on the current question-answer pair and related search information, it intelligently generates and recommends the next potential question;
[0013] Voice interaction module: realizes the voice recognition input function of user query and the voice synthesis reading function of answer output;
[0014] Question library storage and management module: This module is responsible for storing the user's historical question records and calculating hot issues through algorithm analysis;
[0015] Answer source display module: provides a transparent display of the source of the answer.
[0016] According to the above-mentioned domain intelligent question answering method based on the knowledge graph library and the text vector library, the following steps are included:
[0017] Step 1: Build a knowledge graph of the domain manually or in batches by first modeling the ontology and then building instances.
[0018] Step 2: Build a domain text vector library. The system reads a text file and performs text segmentation on the read file according to a rule-based or semantic-based segmentation algorithm to obtain multiple text blocks. The multiple text blocks are vectorized and stored in a vector database to form a domain text vector library.
[0019] Step 3: User query input, which supports both voice input and text input, and vectorizes the user query;
[0020] Step 4: Use the vectorized user query to search in the text vector library. Use the cosine similarity algorithm to select the top three text blocks with the highest similarity as the context information to answer the user query;
[0021] Step 5: Apply the vectorized user query to the vectorized retrieval in the graph database. Through the cosine similarity algorithm, select nodes whose similarity exceeds the set threshold as candidate nodes, and obtain the upper and lower hop nodes of these candidate nodes to form the subgraph information that answers the user query;
[0022] Step 6: Combine the context information and subgraph information obtained in steps 4 and 5, and use the prompt engineering method combined with a large language model to achieve natural language generation of the answer;
[0023] Step 7: Based on the answer generated in step 6, the system recommends the next question that the user may be interested in;
[0024] Step 8: Based on the answer generated in step 6, the system implements the voice broadcast function of the answer;
[0025] Step 9: Based on the user query in step 6, store it in the question library;
[0026] Step 10: Based on the question and answer situation in step 6, the system will complete the tracing function of the source of the answer, including two types of tracing: knowledge graph and unstructured text.
[0027] Preferred: ontology-based knowledge graph construction method, knowledge automatic extraction algorithm and data storage mechanism, including:
[0028] Building a knowledge graph based on ontology includes ontology modeling and instance construction. Ontology modeling includes the ontology and its attributes and relationships. When building an instance, add instances and their attributes and relationships according to the modeled ontology.
[0029] The automatic knowledge extraction algorithm uses the Chinese-RoBERT-wwm model trained by using domain data to automatically extract knowledge from unstructured texts, and can also complete knowledge fusion through manual review and other methods;
[0030] During the instance construction process, hidden attributes are automatically added to each instance. These hidden attributes are designed to support vectorized retrieval of knowledge graphs and the implementation of other system functions without being directly exposed in the system interface.
[0031] Preferred: Use knowledge graph similar node retrieval algorithm, specifically including:
[0032] Vectorize the user's query request;
[0033] The cosine similarity algorithm is used to calculate the similarity between the user query vector and the vector representation of all nodes in the graph database. Based on the similarity score, the node set most relevant to the user query is selected as the candidate node.
[0034] A further graph traversal operation is performed on each candidate node to query and obtain its directly connected next-hop node to build a subgraph related to the user query, and the constructed subgraph is returned as the query result. The subgraph contains the information path and network structure most relevant to the user query to provide a comprehensive and relevant answer.
[0035] Preferred: Use customized prompt + large language model to generate accurate answers, including,
[0036] Design and implement customized prompting strategies to ensure that large language models can accurately understand and perform specified tasks. This strategy involves constructing well-targeted instructions and contextual information to guide the model to produce the desired output.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] The domain intelligent question-answering system and method based on knowledge graph and text vector library provided by the present invention manages the structured and unstructured knowledge of a specific domain by combining knowledge graph and text vector library, and can use a semi-automatic method to build knowledge graph at the same time. The two knowledge bases complement each other and use semantic vector similarity retrieval algorithm based on user query to find relevant knowledge, and use the natural language understanding and generation capabilities of large language model to return the correct answer to the user. In summary, the retrieval and intelligent question-answering of relevant data in a specific domain are realized, and the efficiency and accuracy of user query of specific domain problems are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a flowchart of a domain intelligent question answering method based on a knowledge graph and a text vector library according to an embodiment of the present application;
[0040] Figure 2 A flowchart for semi-automatically updating a knowledge graph according to a training domain extraction model of a domain intelligent question-answering method based on a knowledge graph and a text vector library according to an embodiment of the present application;
[0041] Figure 3 A flow chart of a knowledge graph retrieval algorithm of a domain intelligent question answering method based on a knowledge graph and a text vector library according to an embodiment of the present application;
[0042] Figure 4 This is an architecture diagram of a domain intelligent question answering system based on a knowledge graph and a text vector library according to an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the implementation regulations described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] Example
[0045] See also Figure 1-4 , the figure is a network framework diagram of the present invention, a domain intelligent question answering system based on a knowledge graph library and a text vector library, the system includes two subsystems: a knowledge management system and a domain intelligent question answering system, specifically:
[0046] The knowledge management system is used to manage two types of knowledge bases, including:
[0047] Knowledge base domain management module: responsible for classifying, organizing and maintaining knowledge in different fields; providing operations for adding, deleting, modifying and checking domain information;
[0048] Knowledge graph library management module: The ontology modeling function supports the construction of domain ontology, defines conceptual models such as classes, attributes, and relationships, and provides a structured framework for the knowledge graph; the knowledge instance management function implements the addition, editing, deletion, and query operations of specific knowledge instances in the knowledge graph; the knowledge extraction and update function automatically extracts knowledge from unstructured text through the model and regularly updates the knowledge graph;
[0049] Text vector library management module: responsible for storing and managing the vector representation of text data, supporting fast retrieval and analysis of text content; providing functions for importing, exporting, updating and maintaining text vectors; supporting index construction and query optimization of vector libraries;
[0050] The domain intelligent question answering system mainly provides users with domain knowledge intelligent question answering services, including:
[0051] Domain Q&A module: This module relies on the retrieval results of structured and unstructured knowledge to provide users with accurate question answering services;
[0052] Question recommendation module: Based on the current question-answer pair and related search information, it intelligently generates and recommends the next potential question;
[0053] Voice interaction module: realizes the voice recognition input function of user query and the voice synthesis reading function of answer output;
[0054] Question library storage and management module: This module is responsible for storing the user's historical question records and calculating hot issues through algorithm analysis;
[0055] Answer source display module: provides a transparent display of the source of the answer.
[0056] The knowledge management system includes: knowledge base domain management module: responsible for classifying, organizing and maintaining knowledge in different fields; providing operations of adding, deleting, modifying and checking domain information to ensure the accuracy and completeness of the knowledge base content; knowledge graph library management module: ontology modeling function supports the construction of domain ontology, defines conceptual models such as classes, attributes, relationships, and provides a structured framework for knowledge graphs; knowledge instance management function realizes the addition, editing, deletion and query operations of specific knowledge instances in the knowledge graph; knowledge extraction and update function realizes automatic extraction of knowledge from unstructured text through models, and regularly updates the knowledge graph to maintain the timeliness of knowledge; text vector library management module: responsible for storing and managing vector representation of text data, supporting rapid retrieval and analysis of text content; providing text vector import, export, update and maintenance functions; supporting index construction and query optimization of vector libraries to improve the efficiency and accuracy of text processing.
[0057] The domain intelligent question and answer system mainly provides users with domain knowledge intelligent question and answer services, including: domain question and answer module: this module relies on the retrieval results of structured and unstructured knowledge to provide users with accurate question answering services; question recommendation module: based on the current question and answer pair and related retrieval information, it intelligently generates and recommends the next potential question to enhance the user experience; voice interaction module: realizes the voice recognition input function of user query, and the voice synthesis reading function of answer output; question library storage and management module: this module is responsible for storing the user's historical question records, and calculates hot issues through algorithm analysis. The algorithm considers factors including the click rate of the question and the question timestamp to ensure the timeliness and practicality of the question library; answer traceability display module: provides a transparent display of the source of the answer to enhance the credibility of the system.
[0058] The question recommendation module uses the strategy of prompt engineering + large language model to customize professional prompts, so that the large language model can accurately provide users with recommendations for the next question; the voice interaction module calls iFlytek's voice-to-text and text-to-speech interfaces to realize voice interaction between the system and the user; the question library storage and management module uses the relational database MySQL as the storage medium for the question library. When the user initiates a query, the system will automatically store the query record in the question library. In order to accurately identify whether the query corresponds to the same question that already exists in the library, the system uses a vectorized similarity judgment method. The cosine similarity between the user query vector and the question vector in the question library is calculated to determine whether the similarity between the two exceeds the preset threshold; if the cosine similarity exceeds the threshold, it is determined to be the same question, otherwise it is considered a new question. question; in addition, this module includes a hot question sorting algorithm, which comprehensively considers the time factor and click-through rate of the question. The core idea of the algorithm is that the popularity of a question is proportional to the time when it was last asked and the cumulative click-through rate. The specific operation process is as follows: record the time when each question was last asked; accumulate the click-through rate of each question; take a weighted sum of the most recent question time and click-through rate of each question to calculate its popularity value; sort the questions according to the hot value, the larger the value, the more popular the question. In this way, this module can effectively manage and sort the questions in the question library to ensure that users can quickly locate the most popular questions at the moment; the answer tracing display module, the answer tracing, that is, for the current user query, the retrieved knowledge graph subgraph and the relevant context of the retrieved text vector library.
[0059] According to the above-mentioned domain intelligent question answering method based on the knowledge graph library and the text vector library, the following steps are included:
[0060] Step 1: Build a knowledge graph of the domain manually or in batches by first modeling the ontology and then building instances.
[0061] Step 2: Build a domain text vector library. The system reads a text file and performs text segmentation on the read file according to a rule-based or semantic-based segmentation algorithm to obtain multiple text blocks. The multiple text blocks are vectorized and stored in a vector database to form a domain text vector library.
[0062] Step 3: User query input, which supports both voice input and text input, and vectorizes the user query;
[0063] Step 4: Use the vectorized user query to search in the text vector library, and use the cosine similarity algorithm to select the top three text blocks with the highest similarity as the context information to answer the user query;
[0064] Step 5: Apply the vectorized user query to the vectorized retrieval in the graph database. Through the cosine similarity algorithm, select nodes whose similarity exceeds the set threshold as candidate nodes, and obtain the upper and lower hop nodes of these candidate nodes to form the subgraph information that answers the user query.
[0065] Step 6: Combine the context information and subgraph information obtained in steps 4 and 5, and use the prompt engineering method combined with a large language model to achieve natural language generation of the answer;
[0066] Step 7: Based on the answer generated in step 6, the system recommends the next question that the user may be interested in;
[0067] Step 8: Based on the answer generated in step 6, the system implements the voice broadcast function of the answer;
[0068] Step 9: Based on the user query in step 6, store it in the question library;
[0069] Step 10: Based on the question and answer situation in step 6, the system will complete the tracing function of the source of the answer, including two types of tracing: knowledge graph and unstructured text.
[0070] Furthermore, domain structured knowledge and unstructured text are collected. The domain structured knowledge refers to the knowledge that has been manually organized in the field, and the system needs to perform knowledge alignment on this knowledge. The knowledge alignment is the process of mapping the ontology to the user-defined ontology; the unstructured text refers to a large amount of unstructured text that has not been manually organized in the field obtained through web crawler scripts or manual collection.
[0071] Furthermore, structured domain knowledge is used to construct a knowledge graph or unstructured text is used to automatically extract knowledge. For structured domain knowledge, it can be imported into the knowledge base management system in batches or manually after knowledge alignment; the unstructured text is used to automatically extract knowledge, and the trained chinese-RoBerta-wwm-ext model is used to extract knowledge from unstructured text. The extracted knowledge must be manually reviewed before entering the knowledge graph.
[0072] Furthermore, knowledge graphs are constructed using structured domain knowledge or knowledge automatically extracted from unstructured text. Figure 2The specific steps of training and applying the extraction model are described, including the following steps: collecting domain texts; data preprocessing; manually annotating data sets; hyperparameter selection and model training; model prediction; manual review and storage of prediction results; collecting domain texts, using web crawler tools or manual collection to systematically collect text data in the field. To ensure the effectiveness of model training, the amount of data should be between 6,000 and 10,000. Each piece of data should not be too long, preferably one or two complete sentences, and ensure that the data contains user-specified ontology type instances; data preprocessing, data cleaning of the collected data, including removing stop words, special characters Symbol processing, reference disambiguation and other steps are performed to obtain a high-quality clean data set; manually annotated data set, manually annotate the preprocessed data set, annotate each text as a BIO annotation sequence to constitute the final data for training and testing; hyperparameter selection and model training, after repeated training, the best hyperparameters are determined, and the model is trained under this set of hyperparameters, and the model with the best test indicators is taken for model prediction; model prediction, the user inputs a text of moderate length, and the model automatically extracts knowledge from the text based on the predefined ontology structure; the prediction results are manually reviewed and stored, and the results extracted by the model are manually reviewed to avoid erroneous knowledge being stored.
[0073] Furthermore, a text vector library is constructed using unstructured domain text, including the following steps: text file import, mainly including the import of txt and pdf files, wherein for the import of pdf files, for text-formatted pdf files, the pdf text recognition library pymupdf can be used directly to recognize text, and for image-formatted pdf files such as books and other scanned materials, the OCR recognition technology needs to be used to recognize the image as text; text segmentation, dividing the text into text blocks of appropriate size, this step is to divide the complete information in the text into text blocks of appropriate size, and to divide the text blocks as completely as possible, document segmentation technology helps to reduce noise during text block retrieval and improve retrieval effect; text block vectorization and storage in the vector library, the segmented text blocks are vectorized using the word embedding model BGE-M3 model and then stored in the FAISS vector library.
[0074] Furthermore, text segmentation involves text segmentation algorithms. Two segmentation algorithms are implemented in this application, a rule-based segmentation algorithm and a semantics-based segmentation algorithm. The rule-based segmentation algorithm aims to segment the text content into a series of text blocks of reasonable size. The algorithm flow is as follows: the algorithm predefines a text block size interval, which is defined by the minimum and maximum text block values, to know the text block segmentation and ensure that the segmented text block size falls within the interval as much as possible; the algorithm recognizes and uses punctuation marks such as periods that can clearly indicate semantic integrity as separators to segment the document into a series of complete sentences, ensuring the semantic independence of each segmentation unit; then the algorithm starts from the beginning of the document and splices the text blocks sentence by sentence. The algorithm monitors the current text block size in real time. If the current text block is If the maximum value of the interval is exceeded after the new sentence is spliced, the sentence splicing is canceled, and the spliced text block is output as a complete text block. If the size of the current text block after the new sentence is spliced is within the preset interval or smaller than the interval, the next sentence is spliced until it reaches or exceeds the upper limit of the interval. Finally, the document is segmented into a series of text blocks that meet the preset size requirements. The semantic-based segmentation algorithm aims to ensure the semantic integrity of each text block during the text segmentation process. Specifically, the algorithm aims to segment the text into multiple segments, each of which maintains independent and complete semantic content. The algorithm focuses on maintaining the semantic coherence and integrity of the segmented text blocks, and avoids inappropriate segmentation of text units with complete semantics. The algorithm adopts the BERT (Bidirectional The Chinese text segmentation model based on EncoderRepresentations from Transformers - nlp_bert_document-segmentation_chinese-base, is suitable for general fields and can perform in-depth and fine-grained semantic analysis of Chinese text. Through the fine-grained semantic analysis capability of the model, the algorithm can identify semantic boundaries in the text and thus segment it at appropriate sentence boundaries. The algorithm performs the segmentation task by predicting the segmentation requirements after each sentence, that is, the model evaluates whether the current sentence needs to be segmented after the end to ensure the accuracy of the segmentation point selection. The algorithm effectively avoids incorrectly segmenting a semantically complete text unit into multiple fragments, ensuring the semantic coherence of the text block.
[0075] Furthermore, we receive domain-related queries from users, and the queries entered by users through keyboard or voice are vectorized by the word embedding model BGE-M3 to obtain the user query vector.
[0076] Furthermore, a similar node retrieval algorithm based on the constructed domain knowledge graph adopts an efficient retrieval strategy based on the topological structure of the domain knowledge graph. The strategy believes that in the process of matching the user query vector with the graph nodes, not only the directly matched candidate nodes are related to the query, but also the directly connected previous hop and next hop nodes also carry information related to the query. Therefore, the algorithm regards these node sets as a similar subgraph closely related to the user query and outputs it as the retrieval result to improve the accuracy and comprehensiveness of the retrieval. Figure 3 The knowledge graph retrieval process based on the above algorithm idea is described. The user query vector is used to perform vector search in the graph database to identify the candidate entity with the largest cosine similarity with the query vector; the retrieved candidate entity set is traversed to explore the adjacency relationship of each entity in the graph; for each candidate entity, its directly connected previous hop (predecessor) node and next hop (successor) node are extracted, and these nodes represent the direct association information of the entity in the graph structure; based on the above traversal and node extraction, a retrieval result subgraph is constructed, which contains not only the attribute information of the candidate entity, but also the attribute information of its predecessor and successor nodes.
[0077] Furthermore, based on the constructed domain text vector similarity retrieval algorithm, the text vector similarity retrieval algorithm aims to achieve accurate matching of user query vectors in the pre-constructed domain text vector library through an efficient vector space model. The algorithm calculates the similarity between the user query vector and each text block vector in the library through a cosine similarity algorithm, and identifies the top three text vectors closest to it. Based on this, the system will return the text content corresponding to these three text vectors as the most relevant context information in response to the user query. This process ensures high relevance of the retrieval results at the semantic level, thereby improving the accuracy and efficiency of information retrieval.
[0078] Furthermore, prompt engineering + large language model generates answers in natural language based on retrieval results. This application involves the combination of prompt engineering and large language model technology, aiming to guide the model to efficiently generate answers in natural language based on retrieval results through precise prompt design. After repeated experiments and iterations, this application has established a set of optimized prompt formats to ensure that the large language model can accurately interpret the task requirements, that is, answer questions based on specific contextual information. This application has specially customized and developed a set of prompt templates. The design purpose of this template is to guide the large language model to accurately and efficiently generate answers based on given contextual information. In this technical solution, the application of the large language model is achieved by calling Zhipu Qingyan's WebAPI, which uses the natural language understanding (NLU) and natural language generation (NLG) capabilities of the large parameter model to complete the core task of generating natural language answers based on retrieval results, which not only improves the accuracy of the answers, but also enhances the response efficiency of the model.
[0079] The above content is a further detailed description of the present invention in combination with specific implementation methods. It cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, some simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the scope of protection determined by the claims submitted for the present invention.
Claims
1. A domain intelligent question answering system based on a knowledge graph library and a text vector library, the system includes two subsystems: a knowledge management system and a domain intelligent question answering system, characterized in that: The knowledge management system is used to manage two types of knowledge bases, including: Knowledge base domain management module: responsible for classifying, organizing and maintaining knowledge in different fields; providing operations for adding, deleting, modifying and checking domain information; Knowledge graph library management module: The ontology modeling function supports the construction of domain ontology, defines conceptual models such as classes, attributes, and relationships, and provides a structured framework for the knowledge graph; the knowledge instance management function implements the addition, editing, deletion, and query operations of specific knowledge instances in the knowledge graph; the knowledge extraction and update function automatically extracts knowledge from unstructured text through the model and regularly updates the knowledge graph; Text vector library management module: responsible for storing and managing the vector representation of text data, supporting fast retrieval and analysis of text content; providing functions for importing, exporting, updating and maintaining text vectors; supporting index construction and query optimization of vector libraries; The domain intelligent question answering system mainly provides users with domain knowledge intelligent question answering services, including: Domain Q&A module: This module relies on the retrieval results of structured and unstructured knowledge to provide users with accurate question answering services; Question recommendation module: Based on the current question-answer pair and related search information, it intelligently generates and recommends the next potential question; Voice interaction module: realizes the voice recognition input function of user query and the voice synthesis reading function of answer output; Question library storage and management module: This module is responsible for storing the user's historical question records and calculating hot issues through algorithm analysis; Answer source display module: provides a transparent display of the source of the answer.
2. The domain intelligent question answering method based on the knowledge graph library and the text vector library according to claim 1 is characterized in that: The steps include: Step 1: Build a knowledge graph of the domain manually or in batches by first modeling the ontology and then building instances. Step 2: Build a domain text vector library. The system reads a text file and performs text segmentation on the read file according to a rule-based or semantic-based segmentation algorithm to obtain multiple text blocks. The multiple text blocks are vectorized and stored in a vector database to form a domain text vector library. Step 3: User query input, which supports both voice input and text input, and vectorizes the user query; Step 4: Use the vectorized user query to search in the text vector library. Use the cosine similarity algorithm to select the top three text blocks with the highest similarity as the context information to answer the user query; Step 5: Apply the vectorized user query to the vectorized retrieval in the graph database. Through the cosine similarity algorithm, select nodes whose similarity exceeds the set threshold as candidate nodes, and obtain the upper and lower hop nodes of these candidate nodes to form the subgraph information that answers the user query; Step 6: Combine the context information and subgraph information obtained in steps 4 and 5, and use the prompt engineering method combined with a large language model to achieve natural language generation of the answer; Step 7: Based on the answer generated in step 6, the system recommends the next question that the user may be interested in; Step 8: Based on the answer generated in step 6, the system implements the voice broadcast function of the answer; Step 9: Based on the user query in step 6, store it in the question library; Step 10: Based on the question and answer situation in step 6, the system will complete the tracing function of the source of the answer, including two types of tracing: knowledge graph and unstructured text.
3. The domain intelligent question answering method based on the knowledge graph library and the text vector library according to claim 2 is characterized by: Ontology-based knowledge graph construction method, knowledge automatic extraction algorithm and data storage mechanism, including: Building a knowledge graph based on ontology includes ontology modeling and instance construction. Ontology modeling includes the ontology and its attributes and relationships. When building an instance, add instances and their attributes and relationships according to the modeled ontology. The automatic knowledge extraction algorithm uses the Chinese-RoBERT-wwm model trained by using domain data to automatically extract knowledge from unstructured texts, and can also complete knowledge fusion through manual review and other methods; During the instance construction process, hidden attributes are automatically added to each instance. These hidden attributes are designed to support vectorized retrieval of knowledge graphs and the implementation of other system functions without being directly exposed in the system interface.
4. The domain intelligent question answering method based on the knowledge graph library and the text vector library according to claim 3 is characterized by: Use the knowledge graph similar node retrieval algorithm, including: Vectorize the user's query request; The cosine similarity algorithm is used to calculate the similarity between the user query vector and the vector representation of all nodes in the graph database. Based on the similarity score, the node set most relevant to the user query is selected as the candidate node. A further graph traversal operation is performed on each candidate node to query and obtain its directly connected next-hop node to build a subgraph related to the user query, and the constructed subgraph is returned as the query result. The subgraph contains the information path and network structure most relevant to the user query to provide a comprehensive and relevant answer.
5. The domain intelligent question answering method based on the knowledge graph library and the text vector library according to claim 4 is characterized in that: Use customized Prompt+ large language model to generate accurate answers, including, Design and implement customized prompting strategies to ensure that large language models can accurately understand and perform specified tasks. This strategy involves constructing well-targeted instructions and contextual information to guide the model to produce the desired output.
Citation Information
Cited By
Intelligent answering method and system for building construction process information
CN119312936A
Intelligent question and answer method and system based on mineral knowledge base
CN119493850A
Automatic content traceability generation system and method based on large model
CN119760651A
Intelligent question and answer method and device
CN119917622A
Intelligent question answering method and apparatus
CN119917622B
