Intelligent question and answer method, device and equipment based on knowledge graph and medium
By constructing structured text blocks and keyword graphs, and combining hop prediction model and knowledge graph retrieval, the problems of low answer accuracy and hallucination phenomena in the intelligent question-and-answer method are solved, achieving more accurate and interpretable answer generation.
Patent Information
- Application Number
- CN202411150364.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-13
Smart Images

Figure CN119129738A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent question answering technology, and specifically relates to an intelligent question answering method, device, equipment and medium based on a knowledge graph. Background Art
[0002] Large language models (LLMs) have complex design structures and a large number of parameters. They have achieved remarkable results in natural language processing (NLP) tasks by rigorously pre-training on a wide range of diverse corpora, covering a variety of areas from language understanding to conditional and unconditional text generation; however, since LLMs sometimes exhibit a tendency to hallucinate, the predictions they provide are sometimes not accurate enough. On the other hand, the black-box nature of LLMs impairs their interpretability and factual accuracy, resulting in the possibility of incorrect statements despite the fact that the model has learned during training.
[0003] Existing intelligent question-answering methods that use knowledge graphs usually alleviate these problems through the functions of knowledge bases, obtain natural language knowledge from external searchable databases, and evaluate the semantic similarity with information search queries by calculating the similarity of embedded vectors between related concepts. However, the similarity obtained by calculation lacks structured information and can only obtain relevant text information. There is a technical problem of low accuracy in generating answers. Summary of the invention
[0004] In view of the above analysis, the embodiments of the present invention aim to provide a knowledge graph-based intelligent question answering method, apparatus, device and medium to solve one or more of the above problems existing in the prior art.
[0005] The object of the present invention is achieved in that:
[0006] The first aspect of the present invention provides an intelligent question answering method based on a knowledge graph, comprising:
[0007] Get input question;
[0008] Convert the text in the knowledge base into text blocks and extract keywords to obtain a keyword list;
[0009] Constructing a text block graph based on the text block, and constructing a keyword graph based on the keyword list; constructing a mapping relationship between the keyword list and the text block according to the text block graph and the keyword graph;
[0010] Calculating a first similarity between the input question and a text block in the knowledge base, and setting a text block whose first similarity is greater than a first threshold as a first candidate text block;
[0011] Extracting a first keyword of the input question, calculating a second similarity between the first keyword and a keyword in the keyword list, and setting a keyword whose second similarity is greater than a second threshold as a first candidate keyword; and setting a text block corresponding to the first candidate keyword as a second candidate text block according to a mapping relationship between the keyword list and the text block;
[0012] Calculating a third similarity between the first candidate keyword and a keyword in the keyword graph, and setting a keyword whose third similarity is greater than a third threshold as a second candidate keyword; and setting a text block corresponding to the second candidate keyword as a third candidate text block according to a mapping relationship between a keyword list and a text block;
[0013] A final answer is generated according to the first candidate text block, the second candidate text block, the third candidate text block, the first candidate keyword and the second candidate keyword.
[0014] Furthermore, the method converts the text in the knowledge base into a text block and extracts keywords, including: vectorizing the text block and clustering the vectorized text block; sampling 2c text block vectors in each cluster, wherein c text block vectors are close to the cluster center and the other c text block vectors are randomly selected in the cluster; inputting the text blocks corresponding to the sampled 2c text block vectors into a large language model to extract keywords in the text block.
[0015] Furthermore, the construction of a text block graph based on the text blocks includes: processing the text blocks in the knowledge base into vector form; and constructing a text block graph with text block vectors as nodes and similarities between text block vectors as edges between nodes.
[0016] Furthermore, constructing a keyword graph based on the keyword list includes: constructing a keyword graph with the keywords in the keyword list as nodes and the association strengths between the keywords as edges between the nodes.
[0017] Furthermore, constructing a mapping relationship between a keyword list and a text block based on the text block graph and the keyword graph includes: initializing weight values between nodes of the text block graph and nodes of the keyword graph, wherein the weight values represent the relevance between text blocks in the text block graph and keywords in the keyword graph; and iteratively updating the weight values using a graph Laplace learning method until the iteration converges.
[0018] Furthermore, it also includes: generating at least two similar questions based on the input question, using a hop count prediction model to predict the hop counts of the input question and similar questions, and taking the hop count with the highest frequency as the predicted hop count of the input question; searching in the knowledge graph based on the predicted hop count of the input question to obtain supplementary information, and adding the supplementary information to the final answer.
[0019] Furthermore, the retrieval in the knowledge graph based on the predicted number of hops for the input question includes: searching the knowledge graph for entities corresponding to the input question and the similar questions; using the nodes of the entities corresponding to the input question and the similar questions as the initial retrieval nodes; taking the initial retrieval node as the starting point, eliminating the edges connected to the current retrieval node that are not related to the input question or similar questions, and iterating the retrieval in the knowledge graph until the predicted number of hops is reached, thereby obtaining multiple groups of entity and relationship combinations that may solve the input question and similar questions; calculating the scores of the multiple groups of entity and relationship combinations, and setting the entity and relationship combination with the highest score as supplementary information.
[0020] The second aspect of the present invention provides an intelligent question-answering device based on a knowledge graph, comprising:
[0021] The acquisition module is used to obtain input questions;
[0022] The extraction module is used to convert the text in the knowledge base into a text block and extract keywords to obtain a keyword list;
[0023] A construction module, used to construct a text block graph based on the text block, and to construct a keyword graph based on the keyword list; and to construct a mapping relationship between the keyword list and the text block according to the text block graph and the keyword graph;
[0024] A first candidate module, used to calculate a first similarity between the input question and a text block in the knowledge base, and set a text block whose first similarity is greater than a first threshold as a first candidate text block;
[0025] A second candidate module is used to extract a first keyword of the input question, calculate a second similarity between the first keyword and the keywords in the keyword list, and set the keyword whose second similarity is greater than a second threshold as the first candidate keyword; according to the mapping relationship between the keyword list and the text block, set the text block corresponding to the first candidate keyword as the second candidate text block;
[0026] A third candidate module, configured to calculate a third similarity between the first candidate keyword and a keyword in the keyword graph, and set a keyword whose third similarity is greater than a third threshold as a second candidate keyword; and set a text block corresponding to the second candidate keyword as a third candidate text block according to a mapping relationship between a keyword list and a text block;
[0027] The answer generation module is used to generate a final answer based on the first candidate text block, the second candidate text block, the third candidate text block, the first candidate keyword and the second candidate keyword.
[0028] A third aspect of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the intelligent question-answering method based on the knowledge graph described in any embodiment is implemented.
[0029] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the intelligent question-answering method based on the knowledge graph described in any one of the embodiments.
[0030] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0031] The intelligent question-answering method based on knowledge graph provided by the present invention constructs text blocks and keywords in the knowledge base into structured text block graphs and keyword graphs, and then constructs a mapping relationship between the keyword list and the text blocks through the structured knowledge graph. During retrieval, the input question is searched in the knowledge base, the keyword of the input question is searched in the keyword list, and the keyword of the input question is searched in the keyword graph. After searching according to the mapping relationship, a plurality of candidate text blocks and keywords are obtained, and a final answer is obtained comprehensively, thereby improving the accuracy of the answers generated by the model and reducing the illusion phenomenon. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this specification. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0033] Figure 1 A flowchart of the knowledge graph-based intelligent question answering method provided in Example 1 of the present invention;
[0034] Figure 2 A schematic diagram of an intelligent question-answering device based on a knowledge graph provided in Example 2 of the present invention;
[0035] Figure 3 This is a schematic diagram of the electronic device architecture provided in Example 3 of the present invention. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. It should be noted that, in the absence of conflict, the embodiments and features in the embodiments disclosed in this disclosure can be combined, separated, interchanged and / or rearranged with each other. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0037] Example 1
[0038] A specific embodiment of the present invention, as Figure 1 As shown, an intelligent question answering method based on knowledge graph is disclosed, including:
[0039] S1. Get input question.
[0040] S2. Convert the text in the knowledge base into text blocks and extract keywords to obtain a keyword list.
[0041] In this embodiment, step S2 specifically includes:
[0042] S201, vectorizing the text blocks, and clustering the vectorized text blocks;
[0043] Exemplarily, when dividing the text blocks, each text block contains a token of maximum length, and then converted into Embedding form, and then the K-means clustering or spectral clustering unsupervised clustering algorithm is used to cluster the text blocks in Embedding form. When clustering, parameters such as the number of clusters and the number of text blocks need to be set.
[0044] S202. In each cluster, 2c text block vectors are sampled, of which c text block vectors are close to the cluster center and the other c text block vectors are randomly selected in the cluster; to ensure that the global and core information in the entire text is captured.
[0045] S203: Input the text blocks corresponding to the sampled 2c text block vectors into the large language model to extract keywords from the text blocks.
[0046] Exemplarily, keywords of text blocks corresponding to the sampled 2c text block vectors in the knowledge base are extracted through the large language model, and then the extracted keywords are filtered and optimized through the large language model to ensure the accuracy of the keywords.
[0047] S3, constructing a text block graph based on the text block, and constructing a keyword graph based on the keyword list; and constructing a mapping relationship between the keyword list and the text block according to the text block graph and the keyword graph.
[0048] In this embodiment, constructing a text block graph based on the text block in step S3 specifically includes:
[0049] The text blocks in the knowledge base are processed into vector form; a text block graph is constructed with the text block vectors as nodes and the similarities between the text block vectors as edges between the nodes.
[0050] Specifically, for the text block graph G t =(X,W t ), X represents the text block vector set, W t Represents the edge weight matrix, that is, the similarity between two nodes in the text block graph. The similarity function is expressed as follows:
[0051]
[0052] Among them, v i The text block vector of node i, v j represents the text block vector of node j, represents the normalization term, τ i =∠(v i ,v iK ) represents the similarity between node i and its Kth nearest neighbor;
[0053] Considering that the number of text blocks may be large, in order to improve computational efficiency, only the first K neighbor text blocks of each node are considered to construct the graph. The K value can be adjusted according to specific needs. For text blocks with more than K neighbors, their values are set to 0 in the similarity matrix.
[0054] Constructing a keyword graph based on the keyword list in step S3 specifically includes:
[0055] Construct a keyword graph with the keywords in the keyword list as nodes and the association strengths between the keywords as edges between the nodes.
[0056] Specifically, for the keyword graph G k =(Key,W k ), Key represents the keyword, W k The weight matrix represents the edge, that is, the association strength between two nodes in the keyword graph. The association strength refers to the number of times two keywords appear in a text block at the same time.
[0057] The step S3 of constructing a mapping relationship between a keyword list and a text block according to the text block graph and the keyword graph specifically includes:
[0058] Initializing weight values between nodes of the text block graph and nodes of the keyword graph, wherein the weight values represent the relevance between text blocks in the text block graph and keywords in the keyword graph;
[0059] The weight values are iteratively updated using the graph Laplacian learning method until the iteration converges.
[0060] Specifically, the weight values between the nodes in the text block graph and the nodes in the keyword graph are first initialized to 0, and then graph Laplace learning and graph Laplace operations are used to iteratively update the weight values. This operation will comprehensively consider the weight values of adjacent nodes and the weights of edges until the iteration converges. The weight value of each text block node is between 0 and 1, and then the text blocks with weight values greater than 0.5 are set to be text blocks related to keywords. Through such processing, a deep connection between text blocks and keywords is established, providing a powerful tool for text analysis and processing. The advantage of this method is that it can make full use of the adjacency relationship and weight information in the graph structure, thereby improving the accuracy and efficiency of text block classification.
[0061] S4. Calculate a first similarity between the input question and a text block in the knowledge base, and set a text block whose first similarity is greater than a first threshold as a first candidate text block.
[0062] Specifically, when searching after the two graphs are constructed in step S3, a text block with a high similarity to the input question is first searched in the knowledge base and used as the first candidate text block.
[0063] S5. Extract the first keyword of the input question, calculate the second similarity between the first keyword and the keywords in the keyword list, and set the keyword whose second similarity is greater than a second threshold as the first candidate keyword; according to the mapping relationship between the keyword list and the text block, set the text block corresponding to the first candidate keyword as the second candidate text block.
[0064] Exemplarily, the input question can be input into a large language model to extract the first keyword, and then the first keyword and the keywords in the keyword list are converted into Embedding form, the second similarity is calculated, and the keyword with higher second similarity is used as the first candidate keyword. Then, based on the mapping relationship between the keyword list and the text block constructed in step S3, the text block corresponding to the first candidate keyword is set as the second candidate text block.
[0065] S6. Calculate the third similarity between the first candidate keyword and the keyword in the keyword graph, and set the keyword whose third similarity is greater than a third threshold as the second candidate keyword; and set the text block corresponding to the second candidate keyword as the third candidate text block according to the mapping relationship between the keyword list and the text block.
[0066] Specifically, this step first finds a second candidate keyword with a high similarity to the first candidate keyword in the keyword graph, and then sets the text block corresponding to the second candidate keyword as the third candidate text block according to the mapping relationship between the keyword list and the text block constructed in step S3.
[0067] Exemplarily, the first similarity, the second similarity, and the third similarity in steps S4 to S6 can all be calculated using cosine similarity.
[0068] S7. Generate a final answer based on the first candidate text block, the second candidate text block, the third candidate text block, the first candidate keyword and the second candidate keyword.
[0069] Exemplarily, a final answer to the input question may be generated by a large language model based on the first candidate text block, the second candidate text block, the third candidate text block, the first candidate keyword, and the second candidate keyword.
[0070] Compared with the prior art, the intelligent question-answering method based on the knowledge graph provided in this embodiment constructs the text blocks and keywords in the knowledge base into structured text block graphs and keyword graphs, and then constructs a mapping relationship between the keyword list and the text blocks through the structured knowledge graph. During retrieval, the input question is searched in the knowledge base, the keywords of the input question are searched in the keyword list, and the keywords of the input question are searched in the keyword graph. After searching according to the mapping relationship, a final answer is obtained after obtaining multiple candidate text blocks and keywords, which improves the accuracy of the answers generated by the model and reduces the illusion phenomenon.
[0071] In some embodiments, the intelligent question answering method based on the knowledge graph further includes:
[0072] S8, generating at least two similar questions according to the input question, using a hop count prediction model to predict the hop counts of the input question and the similar questions, and taking the hop count with the highest frequency as the predicted hop count of the input question;
[0073] Specifically, the hop count prediction model is obtained by pre-training and fine-tuning the large language model. Through fine-tuning, the model can effectively identify the key information in the question, understand the relationship between entities, and infer the number of reasoning hops required to answer the question.
[0074] For example, the fine-tuning process can collect a data set containing a large number of questions, annotate them, convert them into Embedding form, and then use the training set in vector form to fine-tune the large language model. The fine-tuning method can choose LORA fine-tuning.
[0075] S9. Search the knowledge graph according to the predicted number of hops for the input question to obtain supplementary information, and add the supplementary information to the final answer.
[0076] In this embodiment, step S9 specifically includes:
[0077] Searching for entities corresponding to the input question and the similar questions in the knowledge graph;
[0078] The nodes of entities corresponding to the input question and similar questions are used as initial retrieval nodes;
[0079] Taking the initial search node as the starting point, removing the edges connected to the current search node that are not related to the input question or similar questions, and iterating the search in the knowledge graph until the predicted number of hops is reached, thereby obtaining multiple groups of entity and relationship combinations that may solve the input question and similar questions;
[0080] Calculate the scores of multiple sets of entity and relationship combinations, and set the entity and relationship combination with the highest score as supplementary information.
[0081] Specifically, the entity and relationship combination can be retrieved through the large model in the existing knowledge graph through cyclic iteration. When calculating the score of the entity and relationship combination, the weight of the input question is set to 2 and the weight of the similar question is set to 1. In this way, it can be ensured that while paying full attention to the input question, the influence of similar questions is also taken into account. The calculation formula of the score is expressed as follows:
[0082]
[0083] Among them, r represents the combination of entities and relations, S represents the input question or a set of similar questions, ω(s) represents the weight of the input question or similar questions, and R represents the knowledge graph.
[0084] Compared with the prior art, steps S8 and S9 provided in this embodiment obtain supplementary information through hop count prediction and supplementary search in the knowledge graph to supplement the answers obtained in steps S1-S7, thereby further improving the accuracy of answers generated by the model and reducing hallucination phenomena.
[0085] Example 2
[0086] This embodiment provides an intelligent question-answering device based on a knowledge graph, such as Figure 2 As shown, including:
[0087] The acquisition module is used to obtain input questions;
[0088] The extraction module is used to convert the text in the knowledge base into a text block and extract keywords to obtain a keyword list;
[0089] A construction module, used to construct a text block graph based on the text block, and to construct a keyword graph based on the keyword list; and to construct a mapping relationship between the keyword list and the text block according to the text block graph and the keyword graph;
[0090] A first candidate module, used to calculate a first similarity between the input question and a text block in the knowledge base, and set a text block whose first similarity is greater than a first threshold as a first candidate text block;
[0091] A second candidate module is used to extract a first keyword of the input question, calculate a second similarity between the first keyword and the keywords in the keyword list, and set the keyword whose second similarity is greater than a second threshold as the first candidate keyword; according to the mapping relationship between the keyword list and the text block, set the text block corresponding to the first candidate keyword as the second candidate text block;
[0092] A third candidate module, configured to calculate a third similarity between the first candidate keyword and a keyword in the keyword graph, and set a keyword whose third similarity is greater than a third threshold as a second candidate keyword; and set a text block corresponding to the second candidate keyword as a third candidate text block according to a mapping relationship between a keyword list and a text block;
[0093] The answer generation module is used to generate a final answer based on the first candidate text block, the second candidate text block, the third candidate text block, the first candidate keyword and the second candidate keyword.
[0094] Example 3
[0095] This embodiment provides an electronic device, such as Figure 3 As shown, it includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, it implements the intelligent question answering method based on the knowledge graph as described in any of the above embodiments.
[0096] Example 4
[0097] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the intelligent question-answering method based on the knowledge graph as described in any of the above embodiments is implemented.
[0098] Computer readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0099] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0100] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0101] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. An intelligent question-answering method based on knowledge graph, characterized in that: include: Get input question; Convert the text in the knowledge base into text blocks and extract keywords to obtain a keyword list; Constructing a text block graph based on the text block, and constructing a keyword graph based on the keyword list; constructing a mapping relationship between the keyword list and the text block according to the text block graph and the keyword graph; Calculating a first similarity between the input question and a text block in the knowledge base, and setting a text block whose first similarity is greater than a first threshold as a first candidate text block; Extracting a first keyword of the input question, calculating a second similarity between the first keyword and a keyword in the keyword list, and setting a keyword whose second similarity is greater than a second threshold as a first candidate keyword; and setting a text block corresponding to the first candidate keyword as a second candidate text block according to a mapping relationship between the keyword list and the text block; Calculating a third similarity between the first candidate keyword and a keyword in the keyword graph, and setting a keyword whose third similarity is greater than a third threshold as a second candidate keyword; and setting a text block corresponding to the second candidate keyword as a third candidate text block according to a mapping relationship between a keyword list and a text block; A final answer is generated according to the first candidate text block, the second candidate text block, the third candidate text block, the first candidate keyword and the second candidate keyword.
2. The intelligent question-answering method based on knowledge graph according to claim 1, characterized in that: The text in the knowledge base is converted into a text block and keywords are extracted, including: vectorizing the text blocks, and clustering the vectorized text blocks; In each cluster, 2c text block vectors are sampled, of which c text block vectors are close to the cluster center and the other c text block vectors are randomly selected in the cluster; The text blocks corresponding to the sampled 2c text block vectors are input into the large language model to extract the keywords in the text blocks.
3. The intelligent question-answering method based on knowledge graph according to claim 1, characterized in that: The step of constructing a text block graph based on the text block includes: Process the text blocks in the knowledge base into vector form; Construct a text block graph with text block vectors as nodes and similarities between text block vectors as edges between nodes.
4. The intelligent question-answering method based on knowledge graph according to claim 3 is characterized in that: The step of constructing a keyword graph based on the keyword list includes: Construct a keyword graph with the keywords in the keyword list as nodes and the association strengths between the keywords as edges between the nodes.
5. The intelligent question-answering method based on knowledge graph according to claim 1, characterized in that: The step of constructing a mapping relationship between a keyword list and a text block according to the text block graph and the keyword graph includes: Initializing weight values between nodes of the text block graph and nodes of the keyword graph, wherein the weight values represent the relevance between text blocks in the text block graph and keywords in the keyword graph; The weight values are iteratively updated using the graph Laplacian learning method until the iteration converges.
6. The intelligent question-answering method based on knowledge graph according to any one of claims 1 to 5, characterized in that: Also includes: Generate at least two similar questions according to the input question, use a hop count prediction model to predict the hop counts of the input question and the similar questions, and use the hop count with the highest frequency as the predicted hop count of the input question; A search is performed in the knowledge graph according to the predicted number of hops of the input question to obtain supplementary information, and the supplementary information is added to the final answer.
7. The intelligent question-answering method based on knowledge graph according to claim 6, characterized in that: The step of searching the knowledge graph according to the predicted hop count of the input question includes: Searching for entities corresponding to the input question and the similar questions in the knowledge graph; The nodes of entities corresponding to the input question and similar questions are used as initial retrieval nodes; Taking the initial search node as the starting point, removing the edges connected to the current search node that are not related to the input question or similar questions, and iterating the search in the knowledge graph until the predicted number of hops is reached, thereby obtaining multiple groups of entity and relationship combinations that may solve the input question and similar questions; Calculate the scores of multiple sets of entity and relationship combinations, and set the entity and relationship combination with the highest score as supplementary information.
8. An intelligent question-answering device based on knowledge graph, characterized in that: The device comprises: The acquisition module is used to obtain input questions; The extraction module is used to convert the text in the knowledge base into a text block and extract keywords to obtain a keyword list; A construction module, used to construct a text block graph based on the text block, and to construct a keyword graph based on the keyword list; and to construct a mapping relationship between the keyword list and the text block according to the text block graph and the keyword graph; A first candidate module, used to calculate a first similarity between the input question and a text block in the knowledge base, and set a text block whose first similarity is greater than a first threshold as a first candidate text block; A second candidate module is used to extract a first keyword of the input question, calculate a second similarity between the first keyword and the keywords in the keyword list, and set the keyword whose second similarity is greater than a second threshold as the first candidate keyword; according to the mapping relationship between the keyword list and the text block, set the text block corresponding to the first candidate keyword as the second candidate text block; A third candidate module, configured to calculate a third similarity between the first candidate keyword and a keyword in the keyword graph, and set a keyword whose third similarity is greater than a third threshold as a second candidate keyword; and set a text block corresponding to the second candidate keyword as a third candidate text block according to a mapping relationship between a keyword list and a text block; The answer generation module is used to generate a final answer based on the first candidate text block, the second candidate text block, the third candidate text block, the first candidate keyword and the second candidate keyword.
9. An electronic device, characterized in that: It includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, it implements the intelligent question-answering method based on the knowledge graph as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the intelligent question-answering method based on the knowledge graph described in any one of claims 1-7 is implemented.
Citation Information
Cited By
Large model-based science and technology text related cue word generation method and system
CN119357375A
Contract content query method and system based on artificial intelligence
CN120470095A
Text generation method and device, electronic equipment and readable medium
CN120509478A
Method and system for generating industry digital scene atlas
CN121072727A
