Question and answer matching method and device of FAQ system, medium and computer equipment

Calculate the similarity of user problems and candidate results through quantum coding and quantum similarity algorithms, solving the problem that the traditional FAQ system responds to the problem of response speed and accuracy under large -scale data sets, and achieves efficient Q & A matching.

CN119377368APending Publication Date: 2025-01-28CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411548072.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

When facing large-scale data sets, traditional FAQ systems cannot simultaneously consult the accuracy and response speed of Q&A matching, resulting in insufficient processing capabilities and low response speed.

Method used

The quantum coding is used to prepare the quantum state of user problems and the candidate results, and use the quantum similarity algorithm algorithm to calculate the similarity set, thereby determining the target result of the most matched with the user problem.

Benefits of technology

A significant reduction of the time cost of similarity calculation, improving the response speed of the FAQ system Q & A matching, and taking into account the accuracy of the matching results, and improving the performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377368A_ABST
    Figure CN119377368A_ABST
Patent Text Reader

Abstract

The invention discloses a question and answer matching method and device of an FAQ system, a medium and computer equipment, and relates to the field of natural language processing and the field of financial science and technology. The method comprises the steps that a user question is obtained, a preset question and answer database is retrieved based on the user question, multiple candidate results related to the user question are obtained, multiple pairs of questions and answers in one-to-one correspondence are preset in the question and answer database, and the candidate results comprise candidate questions and candidate answers; quantum state preparation is conducted on the user problems and the candidate results through quantum coding, and a similarity set of the user problems and the candidate results is obtained through calculation by means of a quantum similarity algorithm; and based on the similarity set of the user question and the candidate results, determining a target result matched with the user question in the plurality of candidate results, and obtaining a target question and a target answer matched with the user question. According to the method, the response speed and the accuracy of the matching result can be considered, and the performance of the FAQ system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of natural language processing and financial technology, and in particular to a question-answer matching method, device, medium and computer equipment for an FAQ system. Background Art

[0002] FAQ (Frequently Asked Questions) system is a question-and-answer system based on common questions and preset answers for users to interact. Users can select or enter questions in the FAQ system by browsing or searching. The FAQ system matches the answers related to the user's questions in the database and presents the answers to the users. For search-based question-and-answer, the FAQ system usually needs to calculate the similarity between the user's questions and the common questions stored in the database, determine the common questions that are synonymous with the user's questions, and then obtain the answers corresponding to the user's questions based on the correspondence between the common questions and the preset answers.

[0003] In the insurance industry, some FAQ systems use a method based on keywords in the insurance field to match user questions with common questions. This method is relatively simple to implement, but has limitations in the accuracy of capturing semantic information. In order to improve the accuracy of matching, there are also methods that use pre-trained language models to deeply understand the semantic content of sentences, and use metrics such as cosine similarity to evaluate the similarity between user questions and common questions. However, traditional methods for calculating similarity have high time complexity and face performance bottlenecks when facing large-scale insurance data sets. The FAQ system has insufficient processing capabilities and low response speed. Summary of the invention

[0004] In view of this, the present application provides a question-answer matching method, apparatus, medium and computer equipment for an FAQ system, the main purpose of which is to solve the technical problem that traditional question-answer matching methods cannot take into account both accuracy and response speed when faced with large-scale data sets.

[0005] According to a first aspect of the present invention, a question-answer matching method of a FAQ system is provided, the method comprising:

[0006] Obtaining a user question, searching a preset question-and-answer database based on the user question, and obtaining a plurality of candidate results related to the user question, wherein the question-and-answer database is preset with a plurality of one-to-one corresponding questions and answers, and the candidate results include candidate questions and candidate answers;

[0007] Performing quantum state preparation on the user question and the candidate results through quantum coding, and calculating a similarity set between the user question and the candidate results using a quantum similarity algorithm;

[0008] Based on the similarity set between the user question and the candidate results, a target result matching the user question is determined from the plurality of candidate results, and a target question and a target answer matching the user question are obtained.

[0009] According to a second aspect of the present invention, a question-answer matching device of a FAQ system is provided, the device comprising:

[0010] A retrieval module, used to obtain a user question, and search a preset question-and-answer database based on the user question to obtain a plurality of candidate results related to the user question, wherein the question-and-answer database is preset with a plurality of one-to-one corresponding questions and answers, and the candidate results include candidate questions and candidate answers;

[0011] A similarity calculation module, used to prepare quantum states of the user question and the candidate results by quantum coding, and calculate a similarity set between the user question and the candidate results by using a quantum similarity algorithm;

[0012] A result determination module is used to determine a target result matching the user question from a plurality of candidate results based on a similarity set between the user question and the candidate results, and obtain a target question and a target answer matching the user question.

[0013] According to a third aspect of the present invention, there is provided a storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the question-answer matching method of the FAQ system.

[0014] According to a fourth aspect of the present invention, there is provided a computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the question-answer matching method of the FAQ system when executing the program.

[0015] The present invention provides a question-answer matching method, device, medium and computer equipment for a FAQ system. First, a user question is obtained, and a preset question-answer database is searched based on the user question to obtain multiple candidate results related to the user question, wherein the question-answer database is preset with multiple pairs of one-to-one corresponding questions and answers, and the candidate results include candidate questions and candidate answers; then, the user question and the candidate result are quantum-state prepared by quantum coding, and a similarity set between the user question and the candidate result is calculated using a quantum similarity algorithm; finally, based on the similarity set between the user question and the candidate result, a target result matching the user question is determined from the multiple candidate results, and a target question and a target answer matching the user question are obtained. The above method first retrieves multiple candidate results from the question-answer database based on the user question, so as to quickly narrow the processing scope of the subsequent further similarity evaluation, reduce the amount of calculation, and lay the foundation for subsequent accurate matching. Then, the quantum similarity algorithm is used to calculate the similarity between the user question and each candidate result, and then the candidate result that best matches the user question is determined from the multiple candidate results as the target result. Among them, the quantum similarity algorithm calculates similarity based on quantum states. The quantum state contains semantic information in user questions and candidate results. Therefore, the quantum similarity algorithm can evaluate the similarity between user questions and candidate results based on semantic information, and the obtained results are more accurate. In addition, the quantum similarity algorithm uses the superposition of quantum states to directly obtain the similarity between two high-dimensional vectors in one calculation. Compared with the traditional algorithm for calculating similarity, the time complexity of the quantum similarity algorithm is low, which can significantly reduce the time cost of calculation and improve the response speed of FAQ system question and answer matching. Therefore, the question and answer matching method of the FAQ system provided in this application can handle larger data sets, and can take into account both the response speed and the accuracy of the matching results, thereby improving the performance of the FAQ system.

[0016] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0018] Figure 1 A schematic diagram showing an application environment of a question-answer matching method of a FAQ system provided by an embodiment of the present invention is shown;

[0019] Figure 2 A schematic diagram showing a flow chart of a question-answer matching method of a FAQ system provided by an embodiment of the present invention;

[0020] Figure 3 A schematic diagram of a quantum state preparation process of another question-answer matching method of a FAQ system provided by an embodiment of the present invention is shown;

[0021] Figure 4 A schematic diagram showing the structure of a question-answer matching device of a FAQ system provided by an embodiment of the present invention is shown;

[0022] Figure 5 A schematic diagram of the structure of a computer device for implementing a question-answer matching method of a FAQ system provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. In the absence of conflict, the embodiments in this application and the features in the embodiments can be combined 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.

[0024] It should be noted that, in the various embodiments shown below, the first, second and various digital numbers are only distinguished for the convenience of description and are not used to limit the scope of the embodiments of the present application.

[0025] The question-answer matching method of the FAQ system provided in the embodiment of the present application can be applied to Figure 1 In an application environment, the client can communicate data with the server through a variety of communication methods. For example, the client can establish a communication connection with the server through a local area network, a wireless local area network, and other networks. The client may include but is not limited to various personal computers, laptops, smart phones, mobile devices, tablet computers, and portable wearable devices. The server can be implemented with an independent server or a server cluster consisting of multiple servers, and the server can be deployed locally and / or in the cloud.

[0026] In one embodiment, Figure 2 As shown, the embodiment of the present application provides a question-answer matching method of a FAQ system, comprising the following steps:

[0027] 101. Obtain a user question, and search a preset question-and-answer database based on the user question to obtain a plurality of candidate results related to the user question, wherein the question-and-answer database has a plurality of one-to-one corresponding questions and answers preset, and the candidate results include candidate questions and candidate answers.

[0028] The FAQ system in the embodiment of the present application can be applied to platforms with question-and-answer requirements such as insurance systems, banking systems, transaction systems, and order systems. A question-and-answer database is provided in the FAQ system, and a plurality of common questions and corresponding answers are pre-set in the question-and-answer database. Users can select the questions they want to know in the FAQ system by browsing, and the FAQ system will query the corresponding answers in the question-and-answer database and return them to the user. Alternatively, when it is difficult to quickly find the question in question by browsing, the user can also enter the user question they want to ask in the FAQ system. Based on the input user question, the FAQ system matches the question with the same or similar semantics as the user question in the question-and-answer database, and queries the corresponding answer and returns it to the user.

[0029] In the process of FAQ system matching questions and answers based on user questions, specifically, after receiving the user questions, firstly, multiple questions related to the user questions are retrieved from the question and answer database based on the user questions as candidate questions, and candidate answers corresponding to each candidate question are obtained to obtain candidate results. In this way, multiple pairs of candidate answers and candidate questions are preliminarily retrieved, which can quickly narrow the processing scope and lay the foundation for further accurate question and answer matching in the future.

[0030] 102. Perform quantum state preparation on the user question and the candidate results by quantum coding, and calculate a similarity set between the user question and the candidate results by using a quantum similarity algorithm.

[0031] After retrieving multiple candidate results, the user question and each candidate result are evaluated for similarity to further determine the candidate result that matches the user question. In this embodiment, a quantum similarity algorithm is used to calculate the similarity between the user question and each candidate result. Specifically, the user question and each candidate result are first converted into quantum states by quantum coding technology to obtain the user question quantum state and each candidate result quantum state. Then, the similarity between the user question quantum state and the quantum state of each candidate result is calculated by the quantum similarity algorithm to obtain a similarity set between the user question and the candidate results. Finally, based on the similarity set between the user question and the candidate results, the candidate result that best matches the user question is selected from multiple candidate results as the final question-answer matching result.

[0032] The candidate result quantum state may include one or more of the candidate question quantum state and the candidate answer quantum state, and accordingly, the similarity set between the user question and the candidate result may include one or more of the similarity set between the user question and the candidate question and the similarity set between the user question and the candidate answer. That is, the question-answer matching result may be determined based on the question dimension alone, or the question dimension and the answer dimension may be combined to jointly determine the question-answer matching result.

[0033] In this embodiment, the user problem quantum state and the candidate result quantum state contain semantic information of the user problem and the candidate result. The similarity between the user problem quantum state and the candidate result quantum state is calculated by the quantum similarity algorithm, and the similarity between the user problem and the candidate result can be accurately evaluated based on the semantic information. The quantum similarity algorithm is used to directly obtain the similarity between two high-dimensional vectors in one calculation by utilizing the superposition of quantum states, achieving exponential acceleration and greatly improving the operation speed, so that larger-scale data can be processed.

[0034] 103. Based on the similarity set between the user question and the candidate results, determine a target result matching the user question from the plurality of candidate results, and obtain a target question and a target answer matching the user question.

[0035] In this embodiment, after obtaining a set of similarities between the user question and the candidate results, the candidate results can be sorted in order of similarity from small to large or from large to small, and the candidate result with the greatest similarity to the user question is selected as the target result from multiple candidate results, thereby obtaining the target question and target answer that best match the user question, and outputting the target answer and returning it to the user.

[0036] Among them, when the similarity set between user questions and candidate results includes both the similarity set between user questions and candidate answers and the similarity set between user questions and candidate results, the similarity between the user question and each candidate result can be calculated in a weighted manner according to the correspondence between the candidate questions and the candidate answers, thereby evaluating the similarity between the user question and the candidate results based on both the question dimension and the answer dimension, making the question-answer matching results more accurate.

[0037] The question-answer matching method of the FAQ system provided in this embodiment first retrieves multiple candidate results in the question-answer database based on the user question to quickly narrow the processing scope of the subsequent further similarity evaluation, reduce the amount of calculation, and lay the foundation for subsequent accurate matching. Then the quantum similarity algorithm is used to calculate the similarity between the user question and each candidate result, and then the candidate result that best matches the user question is determined as the target result among the multiple candidate results. Among them, the quantum similarity algorithm calculates similarity based on quantum state, and the quantum state contains semantic information in the user question and the candidate result. Therefore, the quantum similarity algorithm can evaluate the similarity between the user question and the candidate result based on semantic information. Compared with the traditional strategy of matching only by keywords, the matching method provided in this application has a higher accuracy. In addition, the quantum similarity algorithm uses the superposition of quantum states to directly obtain the similarity between two high-dimensional vectors in one calculation. Compared with the traditional algorithm for calculating similarity, the time complexity of the quantum similarity algorithm is low, which can significantly reduce the time cost of calculation and improve the response speed of FAQ system question-answer matching. Therefore, the question-answer matching method of the FAQ system provided in the present application can process larger-scale data sets, and can take into account both the response speed and the accuracy of the matching results, thereby improving the performance of the FAQ system.

[0038] Furthermore, in order to fully illustrate the implementation process of this embodiment, the specific implementation methods of the above embodiment are refined and expanded below. Specifically, in one embodiment, a plurality of pre-set common questions and answers corresponding to the questions are stored in the question and answer database of the FAQ system, wherein the questions and answers stored in the question and answer database may be in text form and vector form. Among them, the questions and answers can be converted from text form to vector form through a pre-trained embedding model. Specifically, the knowledge of the target domain can be used to train the general embedding model to improve the correlation between the vector and the text.

[0039] Taking the insurance field as an example, we can use multiple semantically similar professional terms such as "employer liability insurance", "employer insurance", "employer liability insurance A", "employer liability insurance B" and so on to train the embedding model. Through continuous iteration, the semantic similarity between these word vectors is increased to a certain threshold, thereby obtaining a trained embedding model. In this way, the converted vector can express more semantics more accurately, thus providing a basis for subsequent accurate calculations.

[0040] In one embodiment, in step 101, a preset question and answer database is searched based on the user question to obtain multiple candidate results related to the user question, which can be specifically achieved in the following ways: using the user question as a search condition, querying the questions stored in the question and answer database to obtain multiple first candidate questions, and / or using a pre-trained keyword extraction model to identify and extract keywords in the user question, using the keywords as search conditions, querying the questions stored in the question and answer database to obtain multiple second candidate questions; obtaining a final multiple candidate questions based on the first candidate question and / or the second candidate question, and obtaining the candidate answer corresponding to each candidate question in the question and answer database, and obtaining multiple candidate results based on the multiple candidate questions and the multiple candidate answers.

[0041] In the above embodiment, when screening candidate results, the question and answer database can be searched based on two dimensions: the user question itself and / or the keywords in the user question. Specifically, the user question or the keyword can be used as a search condition alone to obtain the first candidate result corresponding to the user question or the second candidate result corresponding to the keyword, and the first candidate result or the second candidate result can be used as the final candidate result. The user question and the keyword can also be used as search conditions respectively to obtain the first candidate result corresponding to the user question and the second candidate result corresponding to the keyword, and then the first candidate result and the second candidate result can be merged to obtain the final candidate result.

[0042] Among them, keywords can be obtained by identifying and extracting user questions through a pre-trained keyword extraction model. The search conditions can be in text form and / or vector form, and the number of first candidate results and the number of second candidate results can be the same or different, and can be set according to actual conditions. For example, the user question can be used as a search condition to recall n1 candidate questions and the candidate answers corresponding to each candidate question to obtain n1 first candidate results; the keywords in the user question can be used as a search condition to recall n2 candidate questions and the candidate answers corresponding to each candidate question to obtain n2 second candidate results; the n1 first candidate results and the n2 second candidate results are merged to obtain the final n (n≤n1+n2) candidate results, where n1 and n2 can be set according to actual conditions.

[0043] The embodiment of the present application uses user questions and keywords as search conditions respectively, which can expand the scope of the search and improve the level of the search, reduce the omission of candidate results, and increase the probability of hitting the correct candidate results, providing a basis for subsequent accurate question and answer matching.

[0044] In one embodiment, a pre-trained keyword extraction model is used to identify and extract keywords in the user question, which can be specifically achieved in the following ways: optimizing a word segmentation tool based on preset keywords in the target field, and using the optimized word segmentation tool to perform word segmentation processing on the user question; using a pre-trained keyword extraction model to identify the user question after word segmentation processing to obtain the keywords in the user question.

[0045] In the above embodiment, before using the keywords in the user's question as the search condition to search the question and answer database, it is necessary to first extract the keywords in the user's question through the keyword extraction model. In order to improve the accuracy of keyword extraction, the user's question can be first segmented. Specifically, the word segmentation tool can be optimized by preset keywords to improve the word segmentation tool's processing ability for professional terms. The preset keywords can be set according to the terms in the target field. For example, for the insurance industry, the proprietary vocabulary / professional terms of the insurance industry can be integrated into the database of the word segmentation tool to optimize the word segmentation tool, and then the optimized word segmentation tool can be used to perform word segmentation on the user's question.

[0046] In one example, conventional word segmentation tools may not be able to identify professional terms in a specific field. For example, in the insurance industry, "employer liability insurance" is incorrectly segmented into ['employer', 'liability', 'insurance']. However, a word segmentation tool optimized with preset keywords in the target field can ensure that professional terms in the field are identified as a single entity. For example, if the user question input is "Who is employer liability insurance suitable for?", the user question after word segmentation processing is ['employer liability insurance', 'suitable for', 'which', 'people']. In this way, the accuracy of keyword recognition can be improved.

[0047] After word segmentation, the user question is input into the keyword extraction model for keyword recognition and extraction. In one embodiment, the keyword extraction model may include a word vector input layer, a neural network layer, a fully connected layer, and an output layer. Among them, the word vector input layer is used to convert each word in the user question after word segmentation into a word vector, and input the sequence composed of the word vectors into the neural network layer. The neural network layer can be a bidirectional LSTM (Long Short-Term Memory, long short-term memory network), and the neural network layer and the fully connected layer are used to process the word vector, capture the context information of each word in the sentence, and generate a feature vector. The output layer can be a softmax output layer, which is used to process the feature vector, calculate the probability value of each word as a keyword, and mark each word as a keyword based on the probability value. For example, the output of the word vector output layer can be a two-dimensional vector ([0,1] or [1,0]) to mark whether a certain word is a keyword. If the vector corresponding to a certain word is [1,0], then the word is a keyword, otherwise it is a non-keyword. It should be noted that the structure of the keyword extraction model and the output vector form in the embodiment of the present application are only examples and are not limited to the above methods. Any solutions conceived or transformed by technical personnel in this field without creative work should fall within the scope of protection of the present application.

[0048] In one embodiment, after obtaining the candidate results related to the user question, the similarity between the user question and the candidate results can be evaluated based on the question dimension. In step 102, the similarity set between the user question and the candidate results includes the similarity set between the user question and the candidate questions. The quantum state preparation of the user question and the candidate results by quantum coding and the calculation of the similarity set between the user question and the candidate results by a quantum similarity algorithm can be specifically achieved in the following manner: based on quantum amplitude coding, the user question and each of the candidate questions are respectively mapped from vectors to quantum states to obtain a user question quantum state and multiple candidate question quantum states; the similarity between the user question quantum state and each of the candidate question quantum states is respectively calculated by a quantum similarity algorithm to obtain a similarity set between the user question and the candidate questions.

[0049] In the above embodiment, the user question is first converted from text form to vector form through a pre-trained embedding model, and the vector form of the candidate question is obtained. Then, the user question and the candidate question are mapped from vector form to quantum state through quantum coding to obtain the user question quantum state and the candidate question quantum state. The quantum coding can select quantum amplitude coding. Quantum amplitude coding can greatly reduce the amount of computation compared to ordinary ground state coding. For example, assuming that the dimension of the user question vector and the candidate question vector is 128, 128 quantum bits are required through ground state coding, while only 7 quantum bits (2 7 =128), the resource requirements can be greatly reduced through quantum amplitude coding.

[0050] In one example, the steps for preparing a quantum state through quantum amplitude coding are as follows: first, the target vector to be encoded is normalized, and the quantum bit is placed in an initial state; then, the target vector is feature combined, and based on the feature combination process of the target vector, the initial quantum bit is processed through a quantum circuit to obtain a prepared quantum state.

[0051] Specifically, the schematic diagram of the quantum state preparation process is as follows: Figure 3 As shown, for an M-dimensional target vector with M features, the combination process of the M features of the target vector is as follows Figure 3 (a), where m = logM, P1 m represents the first element of the target vector, represents the second element of the target vector, ..., Represents the Mth element of the target vector; P1 m-1 The square of P1 m The square of The square of , that is, the square of the element in the previous layer is the sum of the squares of the two corresponding elements in the next layer. Figure 3 In the preparation route (b), R y (θ) represents the rotation of the quantum bit on the Bloch sphere by an angle of θ, where the kth parameter of the jth layer is The calculation formula is That is, the specific preparation process of the quantum state is: first, Figure 3 The feature combination process shown in (a) processes the target vector, and then calculates each θ value in the preparation line according to the intermediate quantity P in the feature combination process of the target vector, and obtains the rotation angle of each revolving door in the preparation line. Finally, the initialized quantum state is input into Figure 3 The preparation circuit shown in (b) is processed through a series of rotating gates in the preparation circuit to obtain the prepared quantum state.

[0052] After the quantum states of the target problem and each candidate problem are prepared by the above method, the similarity between the quantum state of the target problem and the quantum state of each candidate problem is calculated by the quantum similarity algorithm. In this embodiment, taking the swap-test algorithm as an example, the steps of calculating the similarity between the user problem and the candidate problem include: setting three quantum registers A, B, and C, register A is used to store the user problem quantum state, register B is used to store the candidate problem quantum state, and register C is used to store an auxiliary quantum bit as a control register. Apply the Hadamard gate to the control register to create a superposition state. If the control register is in state |1>, the states of register A and register B are exchanged, and then the Hadamard gate is applied to the control register again. Measure the control register, and estimate the modulus of the inner product of the two quantum states in register A and register B based on the measurement results. The calculation formula is as follows:

[0053]

[0054] Among them, P(0) is the probability that the auxiliary quantum bit is 0, and P(1) is the probability that the auxiliary quantum bit is 1, which is |<a|b> |The inner product modulus of the quantum state in register A and the quantum state in register B.

[0055] |<a|b> |It can be used to evaluate the similarity between the quantum state of the user question and the quantum state of the candidate question, that is, the similarity between the user question and the candidate question. The similarity between the user question and each candidate question is calculated by the above method to obtain the collection of similarities between the user question and the candidate question.

[0056] In the traditional method of calculating similarity, calculating the dot product of two vectors usually has a time complexity of O(n), where n is the length of the vector, which means that as the data scale increases, the required computing resources will increase linearly. The embodiment of the present application calculates the similarity between the user question and each candidate question through a quantum similarity algorithm, and encodes the user question and the candidate question into a quantum state through quantum amplitude coding, thereby reducing the amount of calculation while retaining the semantics, and in the similarity calculation process, the superposition of the quantum algorithm is used to directly obtain the similarity between two high-dimensional vectors in one calculation, and its time complexity is much smaller than that of the conventional similarity algorithm, achieving exponential acceleration. The method provided in this embodiment can significantly reduce the time cost of similarity calculation, and solves the problem of low efficiency of traditional algorithms when processing large-scale data.

[0057] Accordingly, in one embodiment, in step 103, based on the similarity set between the user question and the candidate results, a target result matching the user question is determined from multiple candidate results to obtain a target question and a target answer matching the user question. This can be specifically achieved in the following manner: the candidate questions are sorted in descending order of the similarity between the user question and the candidate questions, and the candidate question ranked first is determined as the target question matching the user question, and the answer corresponding to the target question in the question and answer database is determined as the target answer.

[0058] In the above embodiment, after obtaining the similarity set between the user question and the candidate question, the candidate question with the highest similarity to the user can be selected as the target question matching the user question. Specifically, the candidate questions can be sorted in order of similarity from large to small (or from small to large), and then the candidate question at the first place (with the highest similarity) is selected as the target question matching the user question, and the target answer corresponding to the target question is searched in the question and answer database, and the target answer is returned to the user.

[0059] In one embodiment, after obtaining the candidate results related to the user question, the question dimension and the answer dimension can also be combined to comprehensively evaluate the similarity between the user question and the candidate results. Then, in step 102, the similarity set between the user question and the candidate results also includes the similarity set between the user question and the candidate questions and the similarity set between the user question and the candidate answers. The quantum state preparation of the user question and the candidate results by quantum coding, and the calculation of the similarity set between the user question and the candidate results by a quantum similarity algorithm can be specifically implemented in the following manner: based on quantum amplitude coding, the user question, each of the candidate questions, and each of the candidate answers are respectively mapped from vectors to quantum states to obtain a user question quantum state, multiple candidate question quantum states, and multiple candidate answer quantum states; the similarity between the user question quantum state and each of the candidate question quantum states is calculated by a quantum similarity algorithm to obtain a similarity set between the user question and the candidate questions; and the similarity between the user question quantum state and each of the candidate answer quantum states is calculated by a quantum similarity algorithm to obtain a similarity set between the user question and the candidate answers.

[0060] Accordingly, in one embodiment, in step 103, based on the similarity set between the user question and the candidate results, a target result matching the user question is determined from the multiple candidate results to obtain a target question and a target answer matching the user question. This can be specifically achieved in the following manner: according to the correspondence between the candidate questions and the candidate answers, multiple candidate question-answer pairs are obtained; for each candidate question-answer pair, the similarity between the user question and the candidate question and the similarity between the user question and the candidate answer are weighted to obtain a similarity score between the user question and each candidate question-answer pair; the candidate question-answer pairs are sorted in descending order of the similarity scores between the user question and the candidate question-answer pairs, and the candidate question and the candidate answer in the candidate question-answer pair that is ranked first are determined as the target question and the target answer matching the user question.

[0061] In the above embodiment, in addition to determining the question-answer matching result based on the similarity between the user question and the candidate question, the question-answer matching result can also be determined by combining the similarity between the user question and the candidate question and the similarity between the user question and the candidate answer. Specifically, based on the same or similar method as the above embodiment, the user question quantum state, the candidate question quantum state and the candidate answer quantum state are prepared, and the similarity between the user question and each candidate question, and the similarity between the user question and each candidate answer are calculated respectively by a quantum similarity algorithm, wherein the method for calculating the similarity between the user question and the candidate answer is similar to the method for calculating the similarity between the user question and the candidate question in the above embodiment, and will not be repeated here.

[0062] Because the candidate questions and candidate answers are in a one-to-one correspondence, that is, the candidate questions and candidate answers constitute multiple candidate question-answer pairs, that is, the user question corresponds to multiple candidate question-answer pairs. For each candidate question-answer pair, the similarity between the user question and the candidate question and the similarity between the user question and the candidate answer are weighted to calculate the similarity score between the user question and the candidate question-answer pair. For example, the similarity score can be calculated by the following formula: F=0.8*x1+0.2*x2. Among them, F is the similarity score between the user question and the candidate question, x1 is the similarity between the user question and the candidate question, x2 is the similarity between the user question and the candidate answer, and 0.8 and 0.2 are weights. It should be noted that the similarity score is only used as an example, and the weight can be set according to the actual situation, which does not constitute a limitation on the embodiments of the present application.

[0063] Then, the candidate question-answer pairs are sorted in descending order (or descending order) according to the similarity score, and the candidate question-answer pair at the first position (with the largest similarity score) is selected as the target candidate question-answer pair, and the candidate question and candidate answer in the target candidate question-answer pair are determined as the target question and target answer that match the user's question, and the target answer is returned to the user. The target question and target answer can also be output at the same time for the user's reference.

[0064] The above embodiment uses the quantum similarity algorithm to calculate the similarity between the user question and the candidate question and the similarity between the user question and the candidate answer. Not only the similarity between the user question and the candidate question is considered, but also the similarity between the user question and the candidate answer is evaluated. This method can enhance the accuracy of hitting the candidate question that best matches the user question and improve the accuracy of the question-answer matching result.

[0065] The question-answer matching method of the FAQ system provided in this embodiment adopts a dual-strategy retrieval method in the preliminary coarse-grained retrieval stage, that is, the candidate question set is recalled using user questions and keywords respectively, which increases the probability of the correct candidate questions being retrieved and solves the technical problem that a single retrieval strategy may miss important candidate questions. For example, when a user asks "If I get injured while skiing, will my comprehensive accident insurance cover my medical expenses?", the user question contains a specific activity (skiing) and insurance type (comprehensive accident insurance). If the search is based only on keywords, the correlation between the user question and the candidate question cannot be accurately identified, resulting in incomplete candidate questions being recalled. The retrieval method used in the embodiment of the present application can make up for this deficiency. In the similarity evaluation stage, the embodiment of the present application proposes a comprehensive evaluation mechanism, which is not only based on the similarity between the user question and the candidate question, but also combined with the similarity between the user question and the candidate answer to make a judgment, which improves the accuracy of selecting the most matching candidate question and solves the technical problem that a single similarity evaluation ignores the quality of the answer. For example, for the above user questions, the traditional keyword matching technology cannot accurately understand the connection between "skiing" and "comprehensive accident insurance", and although the semantic similarity algorithm can understand it, it will cause a long response time due to the limitation of computing resources. Even if a highly relevant candidate question is found through the semantic similarity algorithm, such as "If I get injured while doing high-risk sports, will my insurance cover it?", the answer is not completely applicable to the specific case of skiing. And if the system needs to perform similarity calculations on a large number of candidate questions when processing user questions, this will result in a slow system response speed and affect the user experience. This embodiment uses a quantum similarity algorithm in the similarity evaluation stage to quantify the similarity between user questions and candidate questions and the similarity between user questions and candidate answers, which can significantly reduce the time cost of calculation and improve the accuracy of calculation results, solving the technical problem of low efficiency of traditional algorithms when processing large-scale data.

[0066] Further, as Figure 2 The specific implementation of the method shown in the embodiment provides a question-answer matching device of a FAQ system, such as Figure 4 As shown, the device includes: a retrieval module 31, a similarity calculation module 32, and a result determination module 33.

[0067] A search module 31 is used to obtain a user question, and search a preset question-and-answer database based on the user question to obtain a plurality of candidate results related to the user question, wherein the question-and-answer database is preset with a plurality of one-to-one corresponding questions and answers, and the candidate results include candidate questions and candidate answers;

[0068] A similarity calculation module 32, which can be used to prepare quantum states of the user question and the candidate results through quantum coding, and calculate the similarity set between the user question and the candidate results using a quantum similarity algorithm;

[0069] The result determination module 33 may be used to determine a target result matching the user question from among the plurality of candidate results based on a set of similarities between the user question and the candidate results, and obtain a target question and a target answer matching the user question.

[0070] In a specific application scenario, a preset question and answer database is searched based on the user question to obtain multiple candidate results related to the user question. The retrieval module 31 can be specifically used to use the user question as a retrieval condition to query the questions stored in the question and answer database to obtain multiple first candidate questions, and / or use a pre-trained keyword extraction model to identify and extract keywords in the user question, use the keywords as retrieval conditions, query the questions stored in the question and answer database to obtain multiple second candidate questions; based on the first candidate question and / or the second candidate question, obtain the final multiple candidate questions, and obtain the candidate answer corresponding to each candidate question in the question and answer database, and obtain multiple candidate results based on the multiple candidate questions and the multiple candidate answers.

[0071] In a specific application scenario, a pre-trained keyword extraction model is used to identify and extract keywords in the user question. The retrieval module 31 can be specifically used to optimize the word segmentation tool based on preset keywords in the target field, and use the optimized word segmentation tool to perform word segmentation processing on the user question; use the pre-trained keyword extraction model to identify the user question after word segmentation processing to obtain the keywords in the user question.

[0072] In a specific application scenario, the similarity set between the user question and the candidate results includes the similarity set between the user question and the candidate question; the quantum state preparation of the user question and the candidate result is performed through quantum coding, and the similarity set between the user question and the candidate result is calculated using a quantum similarity algorithm. The similarity calculation module 32 can be specifically used to map the user question and each of the candidate questions from vectors to quantum states based on quantum amplitude coding to obtain a user question quantum state and multiple candidate question quantum states; the similarity between the user question quantum state and each of the candidate question quantum states is calculated using a quantum similarity algorithm to obtain a similarity set between the user question and the candidate question.

[0073] In a specific application scenario, based on the similarity set between the user question and the candidate results, a target result matching the user question is determined among the multiple candidate results to obtain a target question and a target answer matching the user question. The result determination module 33 can be specifically used to sort the candidate questions in descending order of the similarity between the user question and the candidate questions, and determine the candidate question ranked first as the target question matching the user question, and determine the answer corresponding to the target question in the question and answer database as the target answer.

[0074] In a specific application scenario, the similarity set between the user question and the candidate results also includes the similarity set between the user question and the candidate answers; the quantum state preparation of the user question and the candidate results is performed through quantum coding, and the similarity set between the user question and the candidate results is calculated using a quantum similarity algorithm. The similarity calculation module 32 can also be used to map the candidate answer corresponding to each candidate question from a vector to a quantum state based on quantum amplitude coding to obtain multiple candidate answer quantum states; the similarity between the user question quantum state and each candidate answer quantum state is calculated using a quantum similarity algorithm to obtain a similarity set between the user question and the candidate answers.

[0075] In a specific application scenario, based on the similarity set between the user question and the candidate results, a target result matching the user question is determined from multiple candidate results to obtain a target question and a target answer matching the user question. The result determination module 33 can be specifically used to obtain multiple candidate question-answer pairs according to the correspondence between the candidate questions and the candidate answers; for each candidate question-answer pair, the similarity between the user question and the candidate question and the similarity between the user question and the candidate answer are weighted to obtain a similarity score between the user question and each candidate question-answer pair; the candidate question-answer pairs are sorted in descending order of the similarity scores between the user question and the candidate question-answer pairs, and the candidate question and the candidate answer in the candidate question-answer pair ranked first are determined as the target question and the target answer matching the user question.

[0076] It should be noted that for other corresponding descriptions of the functional units involved in the question-answer matching device of a FAQ system provided in this embodiment, reference can be made to Figure 2 The corresponding descriptions in the above embodiments will not be repeated here.

[0077] based on Figure 2 As well as the method shown in the above embodiment, correspondingly, this embodiment also provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above Figure 2 And the question-answer matching method of the FAQ system shown in the above embodiment.

[0078] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product. The software product to be identified can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0079] based on Figure 2 And the method of the above embodiment, and Figure 4 In order to achieve the above-mentioned purpose, the question-answer matching device embodiment of the FAQ system shown in FIG. Figure 5 As shown, this embodiment also provides a computer device for question-answer matching of a FAQ system, which can be a personal computer, a server, a smart phone, a tablet computer, a smart watch, or other network devices, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program and an operating system; the processor is used to execute the computer program to implement the above-mentioned Figure 2 And the method shown in the above embodiment.

[0080] Optionally, the computer device may further include an internal memory, a communication interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, a display, an input device such as a keyboard, etc. Optionally, the communication interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.

[0081] Those skilled in the art will appreciate that the computer device structure for question-answer matching in a FAQ system provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.

[0082] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the above-mentioned computer device hardware and the software resources to be identified, and supports the operation of the information processing program and other software and / or programs to be identified. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing computer device.

[0083] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the technical solution of the present application, a preliminary search is first performed in the question-and-answer database based on the user's question, and candidate questions and candidate answers that are relevant to the user's question are screened out as candidate results, so as to narrow the scope of similarity evaluation in subsequent steps and reduce the amount of calculation. After retrieving the candidate results, compared to the traditional similarity calculation method, the process of calculating the similarity between the candidate question and the candidate result through the quantum similarity algorithm not only utilizes semantic information, but also significantly reduces the calculation time. Compared with the prior art, when processing large-scale data, both the accuracy and response speed of the results can be taken into account at the same time, thereby improving the performance of the FAQ question-and-answer system.

[0084] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.

[0085] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.

Claims

1. A question-answer matching method for a FAQ system, characterized in that: The method comprises: Obtaining a user question, searching a preset question-and-answer database based on the user question, and obtaining a plurality of candidate results related to the user question, wherein the question-and-answer database is preset with a plurality of one-to-one corresponding questions and answers, and the candidate results include candidate questions and candidate answers; Performing quantum state preparation on the user question and the candidate results through quantum coding, and calculating a similarity set between the user question and the candidate results using a quantum similarity algorithm; Based on the similarity set between the user question and the candidate results, a target result matching the user question is determined from the plurality of candidate results, and a target question and a target answer matching the user question are obtained.

2. The method according to claim 1, characterized in that The similarity set between the user question and the candidate results includes a similarity set between the user question and the candidate question; The step of preparing the quantum state of the user question and the candidate result by quantum coding, and calculating the similarity set between the user question and the candidate result by using a quantum similarity algorithm, includes: Based on quantum amplitude coding, the user problem and each of the candidate problems are respectively mapped from vectors to quantum states to obtain a user problem quantum state and multiple candidate problem quantum states; The similarity between the user question quantum state and each of the candidate question quantum states is calculated using a quantum similarity algorithm to obtain a similarity set between the user question and the candidate question.

3. The method according to claim 2, characterized in that The step of determining a target result matching the user question from among the plurality of candidate results based on a set of similarities between the user question and the candidate results, and obtaining a target question and a target answer matching the user question, comprises: The candidate questions are sorted in descending order of similarity between the user question and the candidate questions, and the candidate question at the first place is determined as the target question matching the user question, and the answer corresponding to the target question in the question and answer database is determined as the target answer.

4. The method according to claim 2, characterized in that: The similarity set between the user question and the candidate results also includes a similarity set between the user question and the candidate answers; The step of preparing the quantum state of the user question and the candidate result by quantum coding, and calculating the similarity set between the user question and the candidate result by using a quantum similarity algorithm, further includes: Based on quantum amplitude coding, the candidate answer corresponding to each candidate question is mapped from a vector to a quantum state to obtain a plurality of candidate answer quantum states; The similarity between the user question quantum state and each candidate answer quantum state is calculated using a quantum similarity algorithm to obtain a similarity set between the user question and the candidate answers.

5. The method according to claim 4, characterized in that The step of determining a target result matching the user question from among the plurality of candidate results based on a set of similarities between the user question and the candidate results, and obtaining a target question and a target answer matching the user question, comprises: According to the correspondence between the candidate questions and the candidate answers, a plurality of candidate question-answer pairs are obtained; For each of the candidate question-answer pairs, weight the similarity between the user question and the candidate question and the similarity between the user question and the candidate answer to obtain a similarity score between the user question and each of the candidate question-answer pairs; The candidate question-answer pairs are sorted in descending order of the similarity scores between the user question and the candidate question-answer pairs, and the candidate question and candidate answer in the candidate question-answer pair that is ranked first are determined as the target question and the target answer that match the user question.

6. The method according to claim 1, characterized in that The method searches a preset question-and-answer database based on the user question to obtain multiple candidate results related to the user question, including: Using the user question as a search condition, querying the questions stored in the question-answering database to obtain a plurality of first candidate questions, and / or using a pre-trained keyword extraction model to identify and extract keywords in the user question, using the keywords as a search condition, querying the questions stored in the question-answering database to obtain a plurality of second candidate questions; Based on the first candidate question and / or the second candidate question, a final plurality of candidate questions are obtained, and a candidate answer corresponding to each candidate question is obtained from the question-and-answer database, and a plurality of candidate results are obtained based on the plurality of candidate questions and the plurality of candidate answers.

7. The method according to claim 6, characterized in that The using of the pre-trained keyword extraction model to identify and extract keywords in the user question includes: Optimizing the word segmentation tool based on preset keywords in the target field, and using the optimized word segmentation tool to perform word segmentation processing on the user question; The user question after word segmentation is identified using a pre-trained keyword extraction model to obtain keywords in the user question.

8. A question-answer matching device for a FAQ system, characterized in that: The device comprises: A retrieval module, used to obtain a user question, and search a preset question-and-answer database based on the user question to obtain a plurality of candidate results related to the user question, wherein the question-and-answer database is preset with a plurality of one-to-one corresponding questions and answers, and the candidate results include candidate questions and candidate answers; A similarity calculation module, used to prepare quantum states of the user question and the candidate results by quantum coding, and calculate a similarity set between the user question and the candidate results by using a quantum similarity algorithm; A result determination module is used to determine a target result matching the user question from a plurality of candidate results based on a similarity set between the user question and the candidate results, and obtain a target question and a target answer matching the user question.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.