Question and Answer Matching Method, Device, Computer Equipment and Storage Medium of a Question and Answer System
By constructing a dynamic programming model in the Q&A system to extract and match concept keywords, the problem of low accuracy of Q&A matching is solved, and a more efficient and accurate Q&A matching effect is achieved.
Patent Information
- Application Number
- CN202010364727.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-30
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2040-04-30
AI Technical Summary
The current Q&A system has low accuracy in Q&A matching, which is difficult to meet the needs of multiple rounds of conversations.
A dynamic programming model is used to build a question-answer matching system, extract concept keywords when receiving user questions, match concepts in the knowledge base, determine the optimal concept sequence, and match the standard answers through similarity.
It improves the matching accuracy and efficiency of the question-and-answer system, and can more accurately match the standard answers of user questions.
Smart Images

Figure CN111639164B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular, to a method, device, computer device, and storage medium for question-answer matching in a question-answer system. Background Art
[0002] Currently, in the field of natural language processing or information mining, question-answer matching is an important research direction and an important development trend. An artificial intelligence robot customer service based on automatic dialogue and question-answer matching calculation can complete most simple question-answer dialogues. However, in higher-order complex logic dialogues, manual auxiliary judgment is still required. In traditional dialogue systems, the current customer service robots cannot meet the accuracy requirements for multi-turn dialogues.
[0003] Traditional question-answer matching systems usually adopt an end-to-end architecture, mostly based on full-text retrieval systems and deep semantic models. The end-to-end model architecture is simple and direct, and large-parameter models have good generalization ability. However, this architecture easily leads to an uncontrollable model black box, unpredictable risks, and difficulties in disassembling task accuracy. Eventually, when implementing question-answer matching, there are technical problems of low matching accuracy. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to provide a method, device, computer device, and storage medium for question-answer matching in a question-answer system, aiming to solve the technical problem of low question-answer matching accuracy in the current question-answer system.
[0005] To solve the above technical problem, the embodiments of the present application provide a method for question-answer matching in a question-answer system, which adopts the following technical solutions:
[0006] A method for question-answer matching in a question-answer system includes the following steps:
[0007] Construct a dynamic programming model for the question-answer matching system. When receiving a user's question sentence, extract the concept keywords of the user's question sentence based on the dynamic programming model;
[0008] Match the concept keywords with the concepts stored in the knowledge base to determine the optimal concept sequence corresponding to the concept keywords;
[0009] Obtain a standard concept sequence pre-stored in the knowledge base, match the optimal concept sequence with the standard concept sequence, and obtain the standard answer corresponding to the user's question sentence.
[0010] Further, the step of constructing the dynamic programming model for the question-answer matching system includes:
[0011] Obtain multiple groups of concept training data, and determine the corresponding loss function according to the concept training data;
[0012] Calculate the corresponding optimization objective function according to the loss function;
[0013] Construct a dynamic programming model of the question-answer matching system according to the optimization objective function.
[0014] Further, the steps of constructing a dynamic programming model of the question-answer matching system according to the optimization objective function include:
[0015] Obtain the state transition equation corresponding to the concept training data;
[0016] Construct a dynamic programming model of the question-answer matching system according to the optimization objective function and the state transition equation.
[0017] Further, the steps of determining the optimal concept sequence corresponding to the concept keyword include:
[0018] Obtain the emission probability corresponding to the concept keyword;
[0019] Determine the optimal concept sequence corresponding to the concept keyword according to the emission probability.
[0020] Further, the steps of determining the optimal concept sequence corresponding to the concept keyword according to the emission probability include:
[0021] Obtain the sequence transition probability corresponding to the concept in the knowledge base;
[0022] Determine the optimal concept sequence corresponding to the concept keyword according to the emission probability and the sequence transition probability.
[0023] Further, the steps of determining the optimal concept sequence corresponding to the concept keyword according to the emission probability and the sequence transition probability include:
[0024] Calculate the joint probability according to the emission probability and the sequence transition probability;
[0025] When the joint probability takes the maximum value, the obtained concept sequence is the optimal concept sequence.
[0026] Further, the steps of matching the optimal concept sequence with the standard concept sequence to obtain the standard answer corresponding to the user's question include:
[0027] Obtain the similarity between the optimal concept sequence and the standard concept sequence;
[0028] Sort the standard concept sequences according to the similarity, and determine that the answer corresponding to the standard concept sequence with the highest similarity is the standard answer to the user's question. The standard answer can be stored in the blockchain.
[0029] To solve the above technical problems, an apparatus for question-answer matching of a question-answer system is further provided in an embodiment of the present application, and the following technical solutions are adopted:
[0030] An extraction module, configured to construct a dynamic programming model of the question-answer matching system, and when receiving a user question sentence, extract the concept keywords of the user question sentence based on the dynamic programming model;
[0031] A confirmation module, configured to match the concept keywords with the concepts stored in the knowledge base, and determine the optimal concept sequence corresponding to the concept keywords;
[0032] A matching module, configured to obtain a standard concept sequence pre-stored in the knowledge base, match the optimal concept sequence with the standard concept sequence, and obtain the standard answer corresponding to the user question sentence, where the standard answer can be stored in the blockchain.
[0033] To solve the above technical problems, an embodiment of the present application further provides a computer device, including a memory and a processor, and a computer program stored in the memory and executable on the processor, where when the processor executes the computer program, the steps of the question-answer matching method of the above question-answer system are implemented.
[0034] To solve the above technical problems, an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the question-answer matching method of the above question-answer system are implemented.
[0035] For the above question-answer matching method, apparatus, computer device and storage medium of the question-answer system, by constructing a dynamic programming model of the question-answer matching system, when receiving a user question sentence, extract the concept keywords of the user question sentence based on the dynamic programming model. Among them, a user question sentence may obtain multiple different keyword combinations, and the concept keyword is the optimal keyword corresponding to the current user question sentence; match the concept keyword with the concepts stored in the knowledge base, and determine the optimal concept sequence corresponding to the concept keyword. The optimal concept sequence is the optimal combination of the concept sequences obtained by matching the concept keywords of the current user question sentence with the concepts in the knowledge base; obtain the standard concept sequence pre-stored in the knowledge base, match the optimal concept sequence with the standard concept sequence, and the similarity between the optimal concept sequence and the standard concept sequence can be obtained. According to the similarity, the standard concept sequence is screened, and the standard answer corresponding to the user question sentence can be obtained. Thus, the technical problem of low accuracy of question-answer matching in the current question-answer system is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] To more clearly illustrate the solutions in this application, the following will briefly introduce the accompanying drawings required for the description of the embodiments of this application. Obviously, the accompanying drawings in the following description are some embodiments of this application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0037] Figure 1 is an exemplary system architecture diagram to which this application can be applied;
[0038] Figure 2 is a schematic flowchart of an embodiment of the question and answer matching method for a question and answer system;
[0039] Figure 3 is a schematic structural diagram of an embodiment of the question and answer matching device of the question and answer system according to this application;
[0040] Figure 4 is a schematic structural diagram of an embodiment of a computer device according to this application.
[0041] Reference numerals: question and answer matching device 500 of the question and answer system, extraction module 510, confirmation module 520, matching module 530. Detailed implementation manners
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs; the terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above accompanying drawings are intended to cover non-exclusive inclusion. The terms "first", "second", etc. in the specification and claims of this application or the above accompanying drawings are used to distinguish different objects and not to describe a specific order.
[0043] Referring to "embodiment" herein means that the specific features, structures or characteristics described in connection with the embodiment can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0044] To make the objectives, technical solutions and advantages of this application more clear and understandable, the following further elaborates on this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for explaining this application and are not used to limit this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this invention without creative efforts fall within the scope of protection of this invention.
[0045] As Figure 1 shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0046] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0047] The terminal devices 101, 102, 103 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop portable computers, and desktop computers, etc.
[0048] The server 105 may be a server providing various services, such as a background server that supports the pages displayed on the terminal devices 101, 102, 103.
[0049] It should be noted that the question-and-answer matching method of the question-and-answer system provided by the embodiments of this application is generally executed by the server / terminal. Correspondingly, the question-and-answer matching device of the question-and-answer system is generally set in the server / terminal device.
[0050] It should be understood that Figure 1 the numbers of terminals, networks, and servers in
[0051] Continue to refer toFigure 2 , showing a flowchart of an embodiment of a question-answer matching method of a question-answer system according to the present application. The question-answer matching method of the question-answer system includes the following steps:
[0052] Step S200, constructing a dynamic programming model of the question-answer matching system, and when receiving a user question sentence, extracting concept keywords of the user question sentence based on the dynamic programming model;
[0053] In the question-answer system, the dynamic programming model is a pre-constructed model, and based on this dynamic programming model, concept keywords of the user question sentence can be extracted. Among them, the concept keyword is the optimal keyword of the user question sentence. For example, "There was a car crash" is a concept keyword, and "car accident" is a concept. In the knowledge base corresponding to the question-answer system, multiple concepts and subordinate concepts of the concepts are pre-stored. For example, "vehicle" is a concept, and "motorcycle" is a subordinate concept. Multiple concepts can be combined with each other to form a combined concept, and different collocation methods among multiple concepts can also obtain multiple different combined concepts. The keywords of a user question sentence can have n 2 combinations, and only some of these keywords are included in the knowledge base. Therefore, when receiving a user question sentence, it is necessary to extract the concept keywords of the user question sentence so that the extracted concept keywords can belong to the knowledge base as much as possible. Based on the dynamic programming model, the concept keywords of the received user question sentence can be extracted. Among them, the dynamic programming model is an optimization solution model proposed based on the extraction of concept keywords. According to the calculation of the optimization objective function and state transition equation in the constructed dynamic programming model, the concept keywords corresponding to the user question sentence can be extracted.
[0054] Step S300, matching the concept keywords with the concepts stored in the knowledge base, and determining the optimal concept sequence corresponding to the concept keywords;
[0055] The optimal concept sequence is the optimal combination of the concept keywords of the current user's question sentence that match the concepts in the knowledge base. When obtaining the concept keywords corresponding to the user's question sentence, the concept keywords may correspond to multiple different concepts in the knowledge base, and each different concept may correspond to different concept keywords. Therefore, obtain the sequence transition probability between the concepts corresponding to the concept keywords, as well as the emission probability of each concept corresponding to the concept keyword. Based on the sequence transition probability and the concept keyword, establish an HMM (Hidden Markov Model), and determine the optimal concept sequence corresponding to the concept keyword based on this HMM model. Among them, the HMM model is a statistical model used to describe a Markov process with unknown parameters, and abstract the problem of solving the optimal concept sequence according to the emission probability and the sequence transition probability into an HMM model. According to this HMM model, the optimal combination of the concepts corresponding to the concept keywords in the knowledge base, that is, the optimal concept sequence, can be determined. Specifically, according to this HMM model, the joint probability corresponding to the emission probability and the sequence transition probability can be obtained. When this joint probability is the largest, the obtained concept sequence is the optimal concept sequence.
[0056] Step S400, obtain the standard concept sequence pre-stored in the knowledge base, match the optimal concept sequence with the standard concept sequence, and obtain the standard answer corresponding to the user's question sentence.
[0057] When obtaining the optimal concept sequence, match the optimal concept sequence with the standard concept sequence, where the standard concept sequence is the concept sequence pre-stored in the knowledge base. Calculate the similarity between the optimal concept sequence and the standard concept sequence, and determine the standard concept sequence with the largest matching degree with the optimal concept sequence according to this similarity. The answer corresponding to the standard concept sequence with the largest matching degree is the standard answer corresponding to the current user's question sentence.
[0058] In this embodiment, the rapid acquisition of the optimal keyword is realized, so that the correct answer corresponding to the current user's question sentence can be quickly matched through the optimal keyword, improving the matching efficiency and accuracy of the question-answering system. And when obtaining the optimal keyword, through the optimization algorithm, it is possible to avoid the unnecessary generalization ability added when using statistical algorithms, include some keywords that do not belong to concepts, which is easy to control the boundary, improve the model processing accuracy, is easy to adjust, and has high extensibility.
[0059] In some embodiments of the present application, step S200 includes:
[0060] Obtain multiple groups of concept training data, and determine the corresponding loss function according to the concept training data;
[0061] Calculate the corresponding optimization objective function according to the loss function;
[0062] Construct a dynamic programming model for the question-answer matching system according to the optimization objective function.
[0063] In the question-answer matching system, it is necessary to pre-construct a dynamic programming model, so as to extract the concept keywords corresponding to the user's question sentence according to this dynamic programming model. The construction of this dynamic programming model requires pre-collecting multiple groups of concept training data. Among them, the question sentence and the concept keyword in this concept training data are a group of concept training data. Determine the loss function corresponding to the current concept keyword extraction problem according to this concept training data, which is also the loss function corresponding to this concept training data. This loss function is the sign function of whether the string corresponding to the question sentence is in the knowledge base. The corresponding optimization objective function can be determined according to the calculation of this loss function. The loss function and the optimization objective function are as follows:
[0064]
[0065] cut = argmin K,cut ∑ k cost(str cut[k] ) * len(str cut[k] )
[0066] Among them, the cost function is the sign function of whether the concept corresponding to the user's question sentence is in the knowledge base. If the concept corresponding to the user's question sentence is in the database, this cost function takes a negative sign and is represented by -1; if the keyword of the user's question sentence is not in the database, this cost function takes a positive sign and is represented by 1. This cost function can correspond to different expression methods according to the complexity of the keyword. len(str cut[k] ) is the length of the string corresponding to the k-th slice, and cut[k] is the content of the k-th field displayed.
[0067] When obtaining this optimization objective function, the dynamic programming model in the question-answer matching system can be determined through this optimization objective function. That is, based on the multiple groups of concept training data obtained, input them into this optimization objective function to train this optimization objective function. The optimization objective function with a complexity meeting the expected requirements obtained by training is the objective function meeting the solution requirements in this dynamic programming model.
[0068] In this embodiment, the creation of the dynamic programming model according to the optimization objective function is realized, avoiding some unnecessary generalization capabilities of the model, improving the model accuracy, and further improving the extraction efficiency and accuracy of the concept keywords of the user's question sentence.
[0069] In some embodiments of this application, the steps of constructing the dynamic programming model of the question-answer matching system according to the optimization objective function described above include:
[0070] Obtain the state transition equation corresponding to the concept training data;
[0071] Construct a dynamic programming model of the question-answer matching system according to the optimization objective function and the state transition equation.
[0072] When constructing the dynamic programming model, it is also necessary to obtain the state transition equation corresponding to the concept training data. In dynamic programming, the state at this stage is usually the result of the state and decision in the previous stage. Given the state and decision in the K-th stage, the state in the (k + 1)-th stage can also be determined accordingly. The equation representing the relationship between the front and back stages is the state transition equation. Through the state transition equation, the solution to the problem in the dynamic programming model can be promoted.
[0073] Specifically, the state transition equation is:
[0074] sum_cost k (str [0,j] ) = min i sum_cost k-1 (str [0,i] ) + cost(str [i,j] ) * (j - i)
[0075] where k represents the k-th stage, k - 1 represents the previous stage of k, sum_cost k (str [0,j] ) represents the total cost in the k-th stage, represents the minimum total cost in the (k - 1)-th stage; represents the loss cost from the k-th stage to the (k - 1)-th stage.
[0076] In this embodiment, the determination of the state transition equation in the dynamic programming model is realized, so that the complexity of the user's question sentence is relatively low, and the efficiency of extracting the concept keywords corresponding to the user's question sentence is further improved.
[0077] In some embodiments of the present application, step S300 includes:
[0078] Obtain the emission probability corresponding to the concept keyword;
[0079] Determine the optimal concept sequence corresponding to the concept keyword according to the emission probability.
[0080] The emission probability is the probability of the concept corresponding to the concept keyword in the knowledge base. When the concept keyword is obtained, the emission probability is calculated. According to this emission probability, the optimal concept sequence corresponding to the current user question is calculated. Among them, the optimal concept sequence is the optimal combination of the concept sequences obtained by matching the concept keywords of the current user question with the concepts in the knowledge base. When obtaining this emission probability, an HMM (Hidden Markov Model) can be established through this emission probability, and the optimal concept sequence corresponding to the concept keyword can be determined according to this HMM model.
[0081] In this embodiment, the accurate calculation of the optimal concept sequence corresponding to the concept keyword is realized, and further the accuracy of the matching answer corresponding to the obtained user question is improved.
[0082] In some embodiments of the present application, the above determining the optimal concept sequence corresponding to the concept keyword according to the emission probability includes:
[0083] Obtain the sequence transition probability corresponding to the concepts in the knowledge base;
[0084] According to the emission probability and the sequence transition probability, determine the optimal concept sequence corresponding to the concept keyword.
[0085] The sequence transition probability is the transition probability between the concepts in the knowledge base corresponding to the concept keyword. For example, if C n represents the nth concept in the knowledge base corresponding to the concept keyword, and C n-1 is the (n - 1)th concept in the knowledge base corresponding to the concept keyword, then P(C n |C n-1 ) is the sequence transition probability. When obtaining this sequence transition probability, the optimal concept sequence corresponding to the concept keyword can be obtained through calculation based on this sequence transition probability and the emission probability. Specifically, when obtaining the sequence transition probability and the emission probability, according to this sequence transition probability and the emission probability, the joint probability of the concept keyword is calculated, where this calculation method is a pre-designed calculation method, such as multiplying the sequence transition probability and the emission probability, or adding them, etc. When the joint probability is calculated, the optimal concept sequence corresponding to the current concept keyword can be determined according to this joint probability.
[0086] In this embodiment, the determination of the optimal concept sequence corresponding to the concept keyword is realized, and further the accuracy of the matching answer corresponding to the current user question is obtained according to this optimal concept sequence, and the model calculation accuracy is improved.
[0087] In some embodiments of the present application, the above determining the optimal concept sequence corresponding to the concept keyword according to the emission probability and the sequence transition probability includes:
[0088] Calculate the joint probability according to the emission probability and the sequence transition probability;
[0089] When the joint probability takes the maximum value, the obtained concept sequence is the optimal concept sequence.
[0090] When determining the emission probability corresponding to the concept keyword and the sequence transition probability, calculate the joint probability according to the emission probability and the sequence transition probability. Among them, the calculation formula of the joint probability is as follows:
[0091] P(x 1 ,x 2 ,...,x n ,c 1 ,c 2 ,...,x n )=P(x 1 |c 1 )P(c 2 |c 1 )P(x 2 |c 2 )...P(x n |c n )P(c n |c n-1 )
[0092] Among them, P(x 1 ,x 2 ,...,x n ,c 1 ,c 2 ,...,x n ) represents the joint probability, x n represents the nth concept keyword, c n represents the concept corresponding to the nth concept keyword, P(c n |c n-1 ) is the sequence transition probability, P(x n |c n ) is the emission probability. When obtaining the joint probability, it is necessary to determine the optimal concept sequence of the concept corresponding to the concept keyword when the joint probability takes the maximum value. Based on the Viterbi algorithm, it can be determined that when the joint probability takes the maximum value, the optimal combination of the concepts in the knowledge base corresponding to the concept keyword, that is, the optimal concept sequence. Among them, the Viterbi algorithm is used to find the -Viterbi path - hidden state sequence that is most likely to generate the observed event sequence. In the HMM model constructed by the emission probability and the sequence transition probability, through this Viterbi algorithm, the optimal combination of the concepts in the knowledge base corresponding to the concept keyword when the joint probability takes the maximum value can be calculated. Thus, the optimal concept sequence corresponding to the concept keyword can be obtained.
[0093] In this embodiment, the determination of the optimal concept sequence according to the joint probability is realized, which improves the accuracy and efficiency of model calculation and saves the question-answering matching time of the question-answering system.
[0094] In some embodiments of the present application, step S400 includes:
[0095] Obtain the similarity between the optimal concept sequence and the standard concept sequence;
[0096] Sort the standard concept sequences according to the similarity, and determine the answer corresponding to the standard concept sequence with the highest similarity as the standard answer to the user's question sentence. The standard answer can be stored in a blockchain.
[0097] The similarity is the similarity between the optimal concept sequence and the standard concept sequence. When the optimal concept sequence is obtained, match the optimal concept sequence with the standard concept sequences in the knowledge base, and thus obtain the similarity between the optimal concept sequence and each standard concept sequence. Sort the standard concept sequences in the knowledge base from largest to smallest according to this similarity. The standard concept sequence at the forefront of the sorting is the standard concept sequence with the largest similarity to the optimal concept sequence. Obtain the answer corresponding to the standard concept sequence at the forefront of this sorting, and determine this answer as the standard answer to the user's question sentence. It should be emphasized that to further ensure the privacy and security of the above standard answer, the above standard answer can also be stored in a node of a blockchain. In this embodiment, the determination of the standard concept sequence with the largest similarity is realized, so as to accurately obtain the standard answer corresponding to the current user's question sentence, that is, the matching answer, save the matching time of the question-answering system, and improve the matching accuracy and efficiency of the question-answering system.
[0098] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), etc., or a random access memory (RAM), etc.
[0099] It should be understood that although the steps in the flowchart of the accompanying drawings are shown sequentially according to the indication of the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise clearly stated in this document, there is no strict order restriction for the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.
[0100] Further reference Figure 3 , as an implementation of the method shown above Figure 2 , this application provides an embodiment of a question-answer matching device for a question-answer system. This device embodiment corresponds to Figure 2 the method embodiment shown, and this device can be specifically applied to various electronic devices.
[0101] As Figure 3 shown, the question-answer matching device 500 of the question-answer system described in this embodiment includes:
[0102] An extraction module 510, configured to build a dynamic programming model for the question-answer matching system, and extract the concept keywords of the user's question sentence based on the dynamic programming model when receiving the user's question sentence;
[0103] Among them, the extraction module includes:
[0104] A first acquisition unit, configured to acquire multiple groups of concept training data and determine the corresponding loss function according to the concept training data;
[0105] A calculation unit, configured to calculate the corresponding optimization objective function according to the loss function;
[0106] A construction unit, configured to build a dynamic programming model for the question-answer matching system according to the optimization objective function.
[0107] Among them, the construction unit includes:
[0108] A second acquisition unit, configured to acquire the state transition equation corresponding to the concept training data;
[0109] A construction subunit, configured to build a dynamic programming model for the question-answer matching system according to the optimization objective function and the state transition equation.
[0110] In a question-and-answer system, the dynamic programming model is a pre-constructed model. Based on this dynamic programming model, the conceptual keywords of the user's question can be extracted. Among them, the conceptual keywords are the optimal keywords of the user's question. For example, "a car accident occurred" is a conceptual keyword, and "car accident" is a concept. In the knowledge base corresponding to the question-and-answer system, multiple concepts and the hyponyms of the concepts are pre-stored. For example, "car" is a concept, and "motorcycle" is a hyponym. Multiple concepts can be combined with each other to form a combined concept, and different collocation methods among multiple concepts can also obtain various different combined concepts. The keywords of a user's question can have n 2 combinations, and only some of these keywords are included in the knowledge base. Therefore, when receiving a user's question, it is necessary to extract the conceptual keywords of the user's question so that the extracted conceptual keywords can belong to the knowledge base as much as possible. Based on the dynamic programming model, the conceptual keywords of the received user's question can be extracted. Among them, the dynamic programming model is an optimization solution model proposed based on the extraction of conceptual keywords. According to the calculation of the optimization objective function and the state transition equation in the constructed dynamic programming model, the conceptual keywords corresponding to the user's question can be extracted.
[0111] A confirmation module 520 is used to match the conceptual keywords with the concepts stored in the knowledge base and determine the optimal concept sequence corresponding to the conceptual keywords;
[0112] Among them, the confirmation module includes:
[0113] A third acquisition unit is used to acquire the emission probability corresponding to the conceptual keywords;
[0114] A first confirmation unit is used to determine the optimal concept sequence corresponding to the conceptual keywords according to the emission probability.
[0115] Among them, the first confirmation unit includes:
[0116] A fourth acquisition unit is used to acquire the sequence transition probability corresponding to the concepts in the knowledge base;
[0117] A second confirmation unit is used to determine the optimal concept sequence corresponding to the conceptual keywords according to the emission probability and the sequence transition probability.
[0118] Among them, the second confirmation unit includes:
[0119] A calculation subunit is used to calculate the joint probability according to the emission probability and the sequence transition probability;
[0120] A confirmation subunit is used to obtain the concept sequence as the optimal concept sequence when the joint probability takes the maximum value.
[0121] The optimal concept sequence is the optimal combination of the concept keywords of the current user's question matching the concepts in the knowledge base. When obtaining the concept keywords corresponding to the user's question, the concept keywords may correspond to multiple different concepts in the knowledge base, and each different concept may correspond to different concept keywords. Therefore, obtain the sequence transition probability between the concepts corresponding to the concept keywords, as well as the emission probability of each concept corresponding to the concept keyword. Based on the sequence transition probability and the concept keyword, establish an HMM (Hidden Markov Model), and determine the optimal concept sequence corresponding to the concept keyword based on this HMM model. Among them, the HMM model is a statistical model used to describe a Markov process with unknown parameters, and abstract the problem of solving the optimal concept sequence according to the emission probability and the sequence transition probability into an HMM model. According to this HMM model, the optimal combination of the concepts corresponding to the concept keywords in the knowledge base, that is, the optimal concept sequence, can be determined. Specifically, according to this HMM model, the joint probability corresponding to the emission probability and the sequence transition probability can be obtained. When the joint probability is the largest, the obtained concept sequence is the optimal concept sequence.
[0122] The matching module 530 is used to obtain the standard concept sequence pre-stored in the knowledge base, match the optimal concept sequence with the standard concept sequence, and obtain the standard answer corresponding to the user's question. The standard answer can be stored in the blockchain.
[0123] Among them, the matching module includes:
[0124] The fifth acquisition unit is used to obtain the similarity between the optimal concept sequence and the standard concept sequence;
[0125] The third confirmation unit is used to sort the standard concept sequences according to the similarity, and determine the answer corresponding to the standard concept sequence with the highest similarity as the standard answer to the user's question. The standard answer can be stored in the blockchain.
[0126] When obtaining the optimal concept sequence, match the optimal concept sequence with the standard concept sequence, where the standard concept sequence is the concept sequence stored in the knowledge base. Calculate the similarity between the optimal concept sequence and the standard concept sequence, and determine the standard concept sequence with the largest matching degree with the optimal concept sequence according to the similarity. The answer corresponding to the standard concept sequence with the largest matching degree is the standard answer corresponding to the current user's question. It should be emphasized that to further ensure the privacy and security of the above standard answer, the above standard answer can also be stored in a node of a blockchain.
[0127] In this embodiment, the rapid acquisition of the optimal keyword is realized, so that the correct answer corresponding to the current user's question can be quickly matched through the optimal keyword, improving the matching efficiency and accuracy of the question-answering system. When obtaining the optimal keyword, an optimization algorithm is used to avoid the unnecessary generalization ability added when using statistical algorithms, including some keywords that do not belong to the concept, which is easy to control the boundary, improves the model processing accuracy, is easy to adjust, and has high extensibility.
[0128] To solve the above technical problems, the embodiment of the present application also provides a computer device. Specifically, please refer to Figure 4 , Figure 4 which is the basic structural block diagram of the computer device in this embodiment.
[0129] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are communicatively connected to each other through a system bus. It should be noted that only the computer device 6 with components 61-63 is shown in the figure, but it should be understood that it is not required to implement all the shown components, and more or fewer components can be alternatively implemented. Among them, those skilled in the art of the present technology can understand that a computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0130] The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer device can perform human-computer interaction with the user through a keyboard, a mouse, a remote control, a touchpad or a voice control device, etc.
[0131] The memory 61 at least includes one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disc, etc. In some embodiments, the memory 61 may be an internal storage unit of the computer device 6, such as the hard disk or memory of the computer device 6. In other embodiments, the memory 61 may also be an external storage device of the computer device 6, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, FlashCard, etc. equipped on the computer device 6. Of course, the memory 61 may also include both the internal storage unit and the external storage device of the computer device 6. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed on the computer device 6, such as the program code of the question-answering matching method of the question-answering system. In addition, the memory 61 may also be used to temporarily store various types of data that have been output or will be output.
[0132] In some embodiments, the processor 62 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run the program code stored in the memory 61 or process data, such as running the program code of the question-answering matching method of the question-answering system.
[0133] The network interface 63 may include a wireless network interface or a wired network interface, and the network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0134] The computer device proposed in this embodiment realizes the rapid acquisition of the optimal keyword, so that the correct answer corresponding to the current user's question sentence can be quickly matched through the optimal keyword, improving the matching efficiency and accuracy of the question-answering system. And when obtaining the optimal keyword, through the optimization algorithm, it avoids the unnecessary generalization ability added when using statistical algorithms, includes some keywords that do not belong to the concept, is easy to control the boundary, improves the model processing accuracy, is easy to adjust, and has high scalability.
[0135] The present application also provides another implementation manner, that is, to provide a computer-readable storage medium storing a question-and-answer matching program of a question-and-answer system, and the question-and-answer matching program of the question-and-answer system can be executed by at least one processor, so that the at least one processor executes the steps of the question-and-answer matching method of the question-and-answer system as described above.
[0136] The computer-readable storage medium proposed in this embodiment realizes the rapid acquisition of the optimal keyword, so that the correct answer corresponding to the current user's question sentence can be quickly matched through the optimal keyword, improving the matching efficiency and accuracy of the question-and-answer system. When obtaining the optimal keyword, the optimization algorithm is used to avoid the unnecessary generalization ability added when using statistical algorithms, including some keywords that do not belong to the concept, which is easy to control the boundary, improves the model processing accuracy, is easy to adjust, and has high extensibility.
[0137] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0138] The blockchain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. Blockchain, in essence, is a decentralized database, a string of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity (anti-counterfeiting) of the information and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer, etc.
[0139] Obviously, the embodiments described above are only a part of the embodiments of this application, rather than all of them. The preferred embodiments of this application are shown in the accompanying drawings, but they do not limit the patent scope of this application. This application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosed content of this application more thorough and comprehensive. Although this application has been described in detail with reference to the foregoing embodiments, for those skilled in the art, they can still modify the technical solutions described in the foregoing specific embodiments, or perform equivalent replacements on some of the technical features. Any equivalent structure made by using the content of the specification and drawings of this application, directly or indirectly applied in other related technical fields, is equally within the scope of patent protection of this application.
Claims
1. A question-answering matching method for a question-answering system, characterized in that, it includes the following steps: Obtain multiple groups of concept training data, and determine the corresponding loss function according to the concept training data. The question sentence and the concept keyword in the concept training data are a group of concept training data, and the loss function is the sign function of whether the string corresponding to the question sentence is in the knowledge base; Calculate the corresponding optimization objective function according to the loss function; Obtain the state transition equation corresponding to the concept training data. The state transition equation is used to represent the relationship between the front and back stages and promote the solution of the problem in the dynamic programming model; Construct a dynamic programming model of the question-answering matching system according to the optimization objective function and the state transition equation; When receiving a user's question sentence, extract the concept keyword of the user's question sentence based on the dynamic programming model; Match the concept keyword with the concepts stored in the knowledge base, and determine the optimal concept sequence corresponding to the concept keyword; Obtain the standard concept sequence pre-stored in the knowledge base, match the optimal concept sequence with the standard concept sequence, and obtain the standard answer corresponding to the user's question sentence.
2. The question-answering matching method for a question-answering system according to claim 1, characterized in that, the step of determining the optimal concept sequence corresponding to the concept keyword includes: Obtain the emission probability corresponding to the concept keyword; Determine the optimal concept sequence corresponding to the concept keyword according to the emission probability.
3. The question-answering matching method for a question-answering system according to claim 2, characterized in that, the step of determining the optimal concept sequence corresponding to the concept keyword according to the emission probability includes: Obtain the sequence transition probability corresponding to the concept in the knowledge base; Determine the optimal concept sequence corresponding to the concept keyword according to the emission probability and the sequence transition probability.
4. The question-answering matching method for a question-answering system according to claim 3, characterized in that, the step of determining the optimal concept sequence corresponding to the concept keyword according to the emission probability and the sequence transition probability includes: Calculate the joint probability according to the emission probability and the sequence transition probability; When the joint probability takes the maximum value, the obtained concept sequence is the optimal concept sequence.
5. The question-answering matching method for a question-answering system according to claim 1, characterized in that, the step of matching the optimal concept sequence with the standard concept sequence to obtain the standard answer corresponding to the user's question sentence includes: Obtain the similarity between the optimal concept sequence and the standard concept sequence; Sort the standard concept sequences according to the similarity, and determine that the answer corresponding to the standard concept sequence with the highest similarity is the standard answer of the user's question sentence. The standard answer is stored in the blockchain.
6. A question-answering matching device for a question-answering system, characterized in that, it includes: An extraction module, configured to extract the concept keyword of the user's question sentence based on a dynamic programming model when receiving the user's question sentence; wherein, the extraction module includes: A first acquisition unit, configured to acquire multiple groups of concept training data, determine a corresponding loss function according to the concept training data, where a question sentence and a concept keyword in the concept training data form a group of concept training data, and the loss function is a sign function indicating whether the string corresponding to the question sentence is in the knowledge base; A calculation unit, configured to calculate a corresponding optimization objective function according to the loss function; A construction unit, configured to construct a dynamic programming model of a question-answer matching system according to the optimization objective function; Among them, the construction unit includes: A second acquisition unit, configured to acquire a state transition equation corresponding to the concept training data, where the state transition equation is used to represent the relationship between the front and back stages and promote the solution of the problem in the dynamic programming model; A construction subunit, configured to construct a dynamic programming model of a question-answer matching system according to the optimization objective function and the state transition equation; A confirmation module, configured to match the concept keyword with the concept stored in the knowledge base and determine an optimal concept sequence corresponding to the concept keyword; A matching module, configured to acquire a standard concept sequence pre-stored in the knowledge base, match the optimal concept sequence with the standard concept sequence, obtain a corresponding answer to the user question sentence, and the corresponding answer is stored in the blockchain.
7. A computer device, including a memory and a processor, where a computer program is stored in the memory, and when the processor executes the computer program, the steps of the question-answer matching method of the question-answer system according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the question-answer matching method of the question-answer system according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Customer service method for human-machine cooperation, electronic device and storage medium
CN107832291A
