Question matching method and system in digital human system
By constructing a reference problem set in the digital human system and using word vector processing and probability models, the problems of long search time and low accuracy caused by the large number of standard problems and complex classification are solved, and efficient and accurate matching of user problems is achieved.
Patent Information
- Application Number
- CN202411778711.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-05
AI Technical Summary
In the digital human system, when the number of standard problems is large and the classification is complex, the matching search time of user problems is long, which affects the user experience, and cluster analysis is difficult to accurately classify, reducing the accuracy of the search results.
By selecting multiple standard problems from standard problems as reference problems, a reference problem set is constructed, and using technologies such as word vector processing, similarity and European distance calculation, probability model construction, etc., the standard problems most related to user problems are selected, significantly reducing the search time and improving matching accuracy and system efficiency.
This method significantly reduces the search time, improves matching accuracy and system efficiency, is suitable for application scenarios with large number of standard problems and complex classification, and enhances the robustness of the system.
Smart Images

Figure CN119782511A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a problem matching method and system in a digital human system. Background Art
[0002] In the digital human system, some standard questions and their corresponding answers are usually built in. First, these standard questions are converted into word vectors through BERT or other models; when the user enters a question, it is also converted into a word vector; then, the similarity between the vector of the user's question and the vector of each standard question is calculated; if the similarity exceeds the preset threshold, the corresponding standard answer is output; if the similarity of all standard questions does not reach the threshold, the user question is submitted to the subsequent large language model for answering.
[0003] A method and system for determining standard questions based on similarity, with publication number CN112131876A, includes the following steps: obtaining user question information, calculating the similarity between the user question and existing training data based on a similarity model, and storing the questions with a similarity lower than a specified threshold as data to be processed, and determining unfamiliar data that does not match the characteristics of existing standard questions; performing cluster analysis on the user questions in the data to be processed, extracting the characteristics of each category as hot words, sorting the hot words from high to low, storing the hot questions with the highest ranking in a database to be labeled, and expanding them for standard questions in an intelligent question-answering system.
[0004] The above existing solution has the problem that when there are a large number of built-in standard questions, the user needs to wait for a long search time before a standard question is matched, and the standard question retrieval speed is slow, which affects the user experience. In addition, when performing cluster analysis on user questions, when the user questions are between multiple categories, they cannot be accurately classified, thereby reducing the accuracy of the search results. Summary of the invention
[0005] In view of this, the present invention proposes a question matching method and system in a digital human system, which significantly reduces the retrieval time, improves the matching accuracy and system efficiency, and enhances the robustness through intersection screening of multiple reference questions. It is suitable for application scenarios with a large number of standard questions and complex classification.
[0006] The technical solution of the present invention is implemented as follows: In a first aspect, the present invention provides a question matching method in a digital human system, comprising the following steps:
[0007] S1, selecting a plurality of standard questions from a standard question set as reference questions, and constructing a reference question set, wherein the digital human system stores a standard question set and an answer set, and the data in the standard question set and the answer set are in a one-to-one correspondence;
[0008] S2, process the word vectors of each question in the standard question set and the reference question set, calculate the similarity and Euclidean distance between each reference question and other standard questions, construct the first candidate set, and sort them according to the similarity and Euclidean distance to generate a similarity sequence and a distance sequence;
[0009] S3, performing word embedding processing on the user input question, calculating the similarity and Euclidean distance between the user input question and each reference question, and building a probability model based on the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions;
[0010] S4, presetting a probability threshold of the probability model, determining the distance proximity range and similarity proximity range of each standard question according to the probability threshold, and screening in the distance sequence according to the distance proximity range of the standard question to obtain a distance candidate set, and screening in the similarity sequence according to the similarity proximity range of the standard question to obtain a similarity candidate set;
[0011] S5, performing an intersection operation on the distance candidate set and the similarity candidate set to obtain a candidate set, selecting the standard question input with the highest similarity from the candidate set to match, and outputting the corresponding standard answer as the answer to the question input by the user.
[0012] On the basis of the above technical solution, preferably, step S1 includes the following sub-steps:
[0013] Collect standard questions and answers, construct a standard question set and an answer set respectively, organize all standard questions and their corresponding answers, and establish a mapping relationship between standard questions and answers; add all standard questions to the standard question set, and add all answers to the answer set;
[0014] The K-means clustering algorithm is used to group the standard question set, the number of selected reference questions is preset, and standard questions are randomly selected from different grouped data as reference questions to construct a reference question set.
[0015] On the basis of the above technical solution, preferably, step S2 includes the following sub-steps:
[0016] Perform word embedding processing on each question in the standard question set and the reference question set, use the Euclidean distance formula to calculate the Euclidean distance between each reference question and other standard questions in the standard question set, and use the cosine similarity formula to calculate the similarity between each reference question and other standard questions in the standard question set;
[0017] Constructing a first candidate set, associating the standard question with the corresponding calculated Euclidean distance and similarity value, combining them into a reference subset and adding them to the first candidate set;
[0018] The elements in the first candidate set are arranged in ascending order according to the similarity value to generate a similarity sequence, and the elements in the first candidate set are arranged in ascending order according to the Euclidean distance value to generate a distance sequence.
[0019] On the basis of the above technical solution, preferably, step S3 includes the following steps:
[0020] Perform word vector processing on the user input question, use the Euclidean distance formula to calculate the Euclidean distance between the user input question and each reference question, and use the cosine similarity formula to calculate the similarity between the user input question and each reference question;
[0021] According to the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions, a probability model is constructed. The probability model is used to determine the degree of closeness between the standard question and the user question in terms of distance and similarity. The probability model calculation formula is:
[0022]
[0023] Where P j (q i |U) is the probability of the ith element in the jth reference subset being close to the user input question U, α and β are adjustment parameters, exp is the natural exponential function, d j,U is the Euclidean distance between the user input question U and the reference question corresponding to the jth reference subset, s j,U is the similarity between the user input question U and the reference question corresponding to the jth reference subset, d j,i is the Euclidean distance between the reference problem corresponding to the jth reference subset and the standard problem corresponding to the i-th element, s j,i is the similarity between the reference question corresponding to the j-th reference subset and the standard question corresponding to the i-th element.
[0024] On the basis of the above technical solution, preferably, step S4 includes the following sub-steps:
[0025] A probability threshold of a preset probability model is set, and the preset probability threshold, the Euclidean distance between the user input question and the j-th reference question, and the similarity between the user input question and the j-th reference question are substituted into the probability model calculation formula to calculate the distance proximity range and similarity proximity range of the corresponding standard question respectively;
[0026] Construct a distance candidate set. According to the distance proximity range of the reference question and the standard question, filter the corresponding reference subset in the distance sequence, obtain the elements that meet the range, and add them to each distance candidate subset respectively. Combine all distance candidate subsets to form a distance candidate set.
[0027] Construct a similar candidate set, and according to the similarity proximity range of the reference question and the standard question, screen the corresponding reference subsets in the similar sequence to obtain the elements that meet the range, and add them to each similar candidate subset respectively, and combine all similar candidate subsets to form a similar candidate set.
[0028] Based on the above technical solution, preferably, in step S5, the distance candidate set and the similarity candidate set are subjected to an intersection operation to obtain a candidate set, which includes:
[0029] Perform an intersection operation on the distance candidate set and the similarity candidate set to obtain the candidate set. The calculation expression is:
[0030]
[0031] In the formula, H is the candidate set, H j is the candidate subset corresponding to the jth reference question, TS j is the similar candidate subset corresponding to the jth reference question, TD j is the distance candidate set corresponding to the j-th reference question.
[0032] Based on the above technical solution, preferably, step S5 selects the standard question input match with the highest similarity from the candidate set and outputs the corresponding standard answer as the answer to the user input question, including the following sub-steps:
[0033] Determine whether all candidate subsets contain elements. If no element exists in any candidate subset, output the standard question that no match can be found. If all candidate subsets contain elements, perform an intersection operation on the candidate subsets of all reference questions to obtain a candidate set.
[0034] Determine whether all the elements exist in the candidate set. If no element exists in any candidate subset, output the standard question that cannot be matched. If the element exists in the candidate set, select the standard question with the highest similarity from the candidate set to match the input, and output the corresponding standard answer as the answer to the question input by the user.
[0035] In a second aspect, the present invention further provides a question matching system in a digital human system, which is implemented by using a question matching method in a digital human system as described above, and the system comprises:
[0036] A selection module is used to select multiple standard questions from a standard question set as reference questions and construct a reference question set. The digital human system stores a standard question set and an answer set, and the data in the standard question set and the answer set are in a one-to-one correspondence;
[0037] The first calculation module is used to perform word vector processing on each question in the standard question set and the reference question set, respectively calculate the similarity and Euclidean distance between each reference question and other standard questions, construct a first candidate set, and sort them according to the similarity and Euclidean distance to generate a similarity sequence and a distance sequence;
[0038] A model building module is used to process word vectors of user input questions, calculate the similarity and Euclidean distance between the user input question and each reference question, and build a probability model based on the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions;
[0039] A range screening module is used to determine the distance proximity range and similarity proximity range of each standard question according to the probability threshold of the preset probability model, and to screen the distance sequence according to the distance proximity range of the standard question to obtain a distance candidate set, and to screen the similarity sequence according to the similarity proximity range of the standard question to obtain a similarity candidate set;
[0040] The output module is used to perform an intersection operation on the distance candidate set and the similarity candidate set to obtain a candidate set, select the standard question input with the highest similarity from the candidate set to match, and output the corresponding standard answer as the answer to the user input question.
[0041] In the third aspect, the present invention also provides an electronic device, comprising at least one processor, at least one memory, a communication interface and a bus; wherein the processor, memory and communication interface communicate with each other through the bus; the memory stores a problem matching method program in a digital human system that can be executed by the processor, and the problem matching method program in a digital human system is configured to implement a problem matching method in a digital human system as described above.
[0042] In a fourth aspect, the present invention further provides a computer-readable storage medium, on which is stored a program for a method for matching a problem in a digital human system, which, when executed, implements the method for matching a problem in a digital human system as described above.
[0043] Compared with the prior art, the problem matching method and system in the digital human system of the present invention has the following beneficial effects:
[0044] (1) By randomly selecting several standard questions as references, evaluating the distance and similarity between the user question and the reference question, selecting standard questions with close distance and similarity to the user question in the reference question, and forming multiple subsets; taking the intersection of each subset, finally selecting the standard question with the highest similarity or the shortest distance and replying with the corresponding answer. This method significantly reduces the retrieval time, improves the matching accuracy and system efficiency, and enhances the robustness by screening the intersection of multiple reference questions. It is suitable for application scenarios with a large number of standard questions and complex classification.
[0045] (2) By constructing a probability model, the two factors of similarity and Euclidean distance are comprehensively considered, making the basis for judging the degree of proximity between the standard question and the user question more comprehensive and accurate, which helps to screen out the standard questions that are most relevant to the user question during the matching process and improve the matching accuracy. In addition, the adjustment parameters α and β in the probability model can be adjusted according to actual needs to adapt to the needs of different application scenarios, making this method flexible in the matching process. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 A flowchart of a method for matching questions in a digital human system according to the present invention;
[0048] Figure 2 It is a flowchart of step S2 of a method for matching questions in a digital human system of the present invention;
[0049] Figure 3 It is a flowchart of step S3 of a method for matching questions in a digital human system of the present invention;
[0050] Figure 4 It is a flowchart of step S4 of a question matching method in a digital human system of the present invention;
[0051] Figure 5 It is a flowchart of step S5 of a question matching method in a digital human system of the present invention. DETAILED DESCRIPTION
[0052] The following will be combined with 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 only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] In the digital human system of this embodiment, a large number of standard questions and their answers are often preset to facilitate quick matching and replying when users ask questions. The existing method selects the best answer by first classifying the standard questions and then calculating the word vector similarity within the corresponding category. However, when the number of standard questions exceeds 100,000 and the number of categories is as many as 500, classification and retrieval take a long time.
[0054] like Figure 1 As shown, a question matching method in a digital human system of the present invention comprises the following steps:
[0055] S1, selecting a plurality of standard questions from a standard question set as reference questions, and constructing a reference question set, wherein the digital human system stores a standard question set and an answer set, and the data in the standard question set and the answer set are in a one-to-one correspondence;
[0056] Among them, standard questions and answers are collected, a standard question set and an answer set are constructed respectively, all standard questions and their corresponding answers are sorted out, and a mapping relationship between standard questions and answers is established; all standard questions are added to the standard question set, and all answers are added to the answer set;
[0057] The K-means clustering algorithm is used to group the standard question set, the number of selected reference questions is preset, and standard questions are randomly selected from different grouped data as reference questions to construct a reference question set.
[0058] It should be noted that standard questions are pre-built into the system and are equipped with corresponding answers. Let the standard question set be Q = {q 1 ,q 2 ,…,q N}, where N is very large and each element is a 768-dimensional vector. Several questions are randomly selected from the standard question set as the reference question set. The selection criterion is that the elements in the reference set have significant differences in classification, that is, standard questions are selected from different grouping data as reference questions. The selected reference question set is denoted as R = {r 1 ,r 2 ,…,r K}, where the value range of K is between 3 and 5, that is, the number of selected reference questions is between 3 and 5.
[0059] It is understandable that the reference question set can also be obtained through manual screening, as long as the reference questions clearly belong to different groups;
[0060] like Figure 2 As shown, specifically, in step S1 of this embodiment:
[0061] First, collect standard questions and answers, organize all standard questions and their corresponding answers, establish a mapping relationship between standard questions and answers, and build a knowledge base;
[0062] Then, assign unique codes to all standard questions to ensure that the corresponding questions and their answers can be quickly found through the codes, and encode them in ascending order using natural numbers;
[0063] Next, select 3 to 5 questions from the standard question set as reference questions. The reference questions belong to different categories and have significant differences. Randomly select a candidate question from each group and record its code. When the number of selections reaches the preset number, stop selecting and add the reference question to the reference question set R.
[0064] This embodiment can reduce the number of questions that need to be compared during the matching process by constructing a reference question set, thereby improving matching efficiency. The significant differences in the classification of reference questions help to quickly locate the standard questions that are most relevant to the user's questions. The size of the reference question set is moderate, which not only maintains diversity but also reduces computational complexity, making the system easy to implement and maintain.
[0065] S2, perform word embedding processing on each question in the standard question set and the reference question set, calculate the similarity and Euclidean distance between each reference question and other standard questions, construct the first candidate set, and sort them according to the similarity and Euclidean distance to generate a similarity sequence and a distance sequence.
[0066] Among them, word vector processing is performed on each question in the standard question set and the reference question set, and the Euclidean distance formula is used to calculate the Euclidean distance between each reference question and other standard questions in the standard question set, and the cosine similarity formula is used to calculate the similarity between each reference question and other standard questions in the standard question set;
[0067] Constructing a first candidate set, associating the standard question with the corresponding calculated Euclidean distance and similarity value, combining them into a reference subset and adding them to the first candidate set;
[0068] The elements in the first candidate set are arranged in ascending order according to the similarity value to generate a similarity sequence, and the elements in the first candidate set are arranged in ascending order according to the Euclidean distance value to generate a distance sequence.
[0069] It should be noted that for each reference question, the distance and similarity between it and all standard questions are calculated respectively. The distance is calculated using the Euclidean distance formula, and the similarity is calculated using the cosine similarity formula. After the calculation is completed, a set C is generated for each reference question. j = {q i ∈Q|d j,i ,s j,i}, where d j,i Represents the standard problem q i With reference question r j The Euclidean distance between j,i Represent the cosine similarity between them, sort by similarity and Euclidean distance, and generate similarity sequence and distance sequence.
[0070] like Figure 2 As shown, specifically, in step S1 of this embodiment:
[0071] Use the BERT model to convert all standard questions into 768-dimensional vectors, record the encoding of each standard question and its corresponding vector representation, and the vectorized standard question set is Q;
[0072] Select a record from the reference question set R. If it is the first selection, select the first record in R; otherwise, select the next record of the current record, obtain the number of the selected reference question, and search for the reference question r in the standard question set Q. j The corresponding word vector;
[0073] Create an empty reference subset C j , used to store three aspects: question number, Euclidean distance and similarity, select a record from the standard question set Q, if it is the first selection, select the first record in Q, otherwise, select the next record q of the current record i+1 ,q i Number the current record;
[0074] Use the Euclidean distance formula to calculate the Euclidean distance d j,i , where the input is the word vector r of the reference question j and the currently selected standard question q i The result is recorded as d j,i ;
[0075] Use the cosine similarity formula to calculate s j,i , where the input is the word vector r of the reference question j and the currently selected standard question q i The calculation result is recorded as s j,i ;
[0076] The number of the current standard problem i and the calculated Euclidean distance dj,i and similarity s j,i Compose a composite element and add it to the set C j middle;
[0077] Determine whether all standard questions have been traversed. If so, determine whether all reference questions have been traversed. If so, sort by similarity and Euclidean distance. j The collection performs the following sorting operation, C j According to the similarity s j,i Sort from small to large to generate similar sequence DS j , C j According to the Euclidean distance d j,i Sort again from small to large to generate the distance sequence DD j , if not, continue to calculate the next standard problem.
[0078] This embodiment can more accurately measure the semantic similarity and spatial distance between the reference question and the standard question by calculating the similarity and Euclidean distance, which helps to screen out the standard question most relevant to the user question during the matching process and improve the matching accuracy.
[0079] S3, performs word embedding processing on the user input question, calculates the similarity and Euclidean distance between the user input question and each reference question, and builds a probability model based on the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions.
[0080] The user input question is processed with a word vector, the Euclidean distance formula is used to calculate the Euclidean distance between the user input question and each reference question, and the cosine similarity formula is used to calculate the similarity between the user input question and each reference question;
[0081] According to the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions, a probability model is constructed. The probability model is used to determine the degree of closeness between the standard question and the user question in terms of distance and similarity. The probability model calculation formula is:
[0082]
[0083] Where P j (q i |U) is the probability of the ith element in the jth reference subset being close to the user input question U, α and β are adjustment parameters, exp is the natural exponential function, d j,U is the Euclidean distance between the user input question U and the reference question corresponding to the jth reference subset, s j,U is the similarity between the user input question U and the reference question corresponding to the jth reference subset, dj,i is the Euclidean distance between the reference problem corresponding to the jth reference subset and the standard problem corresponding to the i-th element, s j,i is the similarity between the reference question corresponding to the j-th reference subset and the standard question corresponding to the i-th element.
[0084] It should be noted that in this implementation, a probability model is constructed to judge the degree of proximity. The purpose of this model is to determine the degree of proximity when the similarity and the Euclidean distance are equal to s j,U and d j,U When , the probability is 1; when the deviation is smaller, the probability is closer to 1; when the deviation is larger, the probability is closer to 0. Considering the deviation of distance and similarity at the same time makes the calculation more accurate.
[0085] In addition, after the user enters a question, the system will immediately use the same model to convert the question into a corresponding word vector representation to ensure that the input question and the reference question are comparable in the same vector space. After the conversion is completed, the system will calculate the distance and similarity between the word vector and the word vector of each reference question one by one. The Euclidean distance and cosine similarity are used to measure the semantic proximity and correlation between the input question and the reference question. In this way, the system can effectively identify the most relevant reference questions and provide accurate and relevant answers.
[0086] In this embodiment, after the user inputs a question, the BERT model is used to vectorize it to obtain a vector U. Then, the similarity and Euclidean distance between U and each reference question are calculated respectively.
[0087] Similarity j,U =sim(r j ,U), where sim represents any element r in the reference problem set R j The similarity between .
[0088] Euclidean distance d j,U = dist(r j ,U), where dist represents any element r in the reference problem set R j The Euclidean distance between .
[0089] like Figure 3 As shown, specifically, in step S3 of this embodiment:
[0090] Users can input questions in the form of voice or text. If voice input is used, the system will first convert it into text, use the BERT model to convert the user's input question into a word vector representation U, and construct an empty set T to store the user's question vector U and each reference question r jThe distance and similarity between them are calculated. Each element in the set will include the sequence number of the reference question, the reference question number, the distance and similarity. A record is selected from the reference question set R. If it is the first selection, the first record in R is selected; otherwise, the next record of the current record is selected, the number of the selected reference question is obtained, and the reference question r is searched in the standard question set Q. j The corresponding word vector.
[0091] Using the Euclidean distance formula, calculate the reference problem r j The distance between the word vector and the user question vector U, the calculation result is recorded as d j,U , using the cosine similarity formula, calculate the reference question r j The similarity between the word vector and the user question vector U. The calculation result is recorded as s j,U .
[0092] The reference problem number, serial number, and calculated Euclidean distance d j,U and similarity s j,U A composite element is formed and added to T to determine whether all reference questions have been traversed. If so, set T is output, otherwise, the next reference question is processed. Set T will store the distance and similarity data between the user question and each reference question, which will be used to screen the candidate sets in each reference set.
[0093] It should be noted that by constructing a probability model, the two factors of similarity and Euclidean distance are comprehensively considered, making the basis for judging the degree of proximity between standard questions and user questions more comprehensive and accurate, which helps to screen out the standard questions most relevant to user questions during the matching process and improve the accuracy of matching. The adjustment parameters α and β in the probability model can be adjusted according to actual needs to adapt to the needs of different application scenarios, making this method flexible and customizable in the matching process.
[0094] S4, preset the probability threshold of the probability model, determine the distance proximity range and similarity proximity range of each standard question according to the probability threshold, and screen in the distance sequence according to the distance proximity range of the standard question to obtain a distance candidate set, and screen in the similarity sequence according to the similarity proximity range of the standard question to obtain a similarity candidate set.
[0095] Step S4 includes the following sub-steps:
[0096] A probability threshold of a preset probability model is set, and the preset probability threshold, the Euclidean distance between the user input question and the j-th reference question, and the similarity between the user input question and the j-th reference question are substituted into the probability model calculation formula to calculate the distance proximity range and similarity proximity range of the corresponding standard question respectively;
[0097] Construct a distance candidate set. According to the distance proximity range of the reference question and the standard question, filter the corresponding reference subset in the distance sequence, obtain the elements that meet the range, and add them to each distance candidate subset respectively. Combine all distance candidate subsets to form a distance candidate set.
[0098] Construct a similar candidate set, and according to the similarity proximity range of the reference question and the standard question, screen the corresponding reference subsets in the similar sequence to obtain the elements that meet the range, and add them to each similar candidate subset respectively, and combine all similar candidate subsets to form a similar candidate set.
[0099] It should be noted that according to the probability model, since the calculation of probability is more complicated and all elements in the j-th reference set need to be calculated, the probability calculation amount is large. Therefore, it is only necessary to derive the range of the corresponding Euclidean distance and similarity through this function.
[0100] Assuming that similarity and distance have the same influence, we set the values of α and β to 1, and set that only when the close probability exceeds 0.85 can it be used as a candidate set, thus we can get:
[0101]
[0102] as well as
[0103]
[0104] Therefore, the i-th element in the j reference set should satisfy both d j,i In [0.8375d j,U ,1.1625d j,U ] range, s j,i In [0.8375s j,U ,1.1625s j,U ] range. It is particularly important to note that since the maximum similarity is 1, if 1.1625s j,U If it exceeds 1, it should be replaced by 1.
[0105] Using this method, we define the candidate set H j C j A subset of , set H j Contains all elements q that satisfy the following conditions i , H j = {q i ∈Q|0.8375d j,U ≤d j,i ≤1.1625d j,U , 0.8375s j,U ≤s j,i≤1.1625s j,U}.
[0106] like Figure 4 As shown, specifically, in step S4 of this embodiment:
[0107] Select a record from set T. If it is the first selection, take the first record in T; otherwise, select the next record of the current record;
[0108] Use the distance value d in the current record j,U , determine the close range of the standard problem distance. If the Euclidean distance between a standard problem and the reference problem is within 0.8375d j,U to 1.1625d j,U If the distance is between , then it is considered to be close, and the standard problem is added to the candidate set. For each reference subset, there is a distance sequence and a similarity sequence. Use the reference number j to select one of the distance sequences DD sorted by distance. j , from DD j Screen the standard questions that meet the distance range and generate the distance candidate set TD j , in the DDj sequence, filter out the distance between 0.8375d j,U to 1.1625d j,U Standard problems between them, add these standard problems to the distance candidate set TD j middle;
[0109] Use the similarity value s in the current record j,U , determine the close range of the standard problem distance. If the similarity between a standard problem and the reference problem is within 0.8375d j,U to 1.1625d j,U If the distance sequence and similarity sequence exist for each reference subset, we select one of the distance sequences DS sorted by distance using the reference number j. j , from DS j Filter the standard questions that meet the distance range and generate the distance candidate set TS j , in the DSj sequence, filter out the distance between 0.8375d j,U to 1.1625d j,U Standard problems between them, add these standard problems to the distance candidate set TS j middle.
[0110] It should be noted that by presetting the probability threshold of the probability model and filtering based on the range of distance and similarity, a distance candidate set and a similarity candidate set are constructed, which can further narrow the scope of standard questions related to user questions and help improve the accuracy and efficiency of matching.
[0111] S5, performing an intersection operation on the distance candidate set and the similarity candidate set to obtain a candidate set, selecting the standard question input with the highest similarity from the candidate set to match, and outputting the corresponding standard answer as the answer to the question input by the user.
[0112] Among them, the distance candidate set and the similarity candidate set are intersected to obtain the candidate set, and the calculation expression is:
[0113]
[0114] In the formula, H is the candidate set, H j is the candidate subset corresponding to the jth reference question, TS j is the similar candidate subset corresponding to the jth reference question, TD j is the distance candidate set corresponding to the j-th reference question.
[0115] Determine whether all candidate subsets contain elements. If no element exists in any candidate subset, output the standard question that no match can be found. If all candidate subsets contain elements, perform an intersection operation on the candidate subsets of all reference questions to obtain a candidate set.
[0116] Determine whether all the elements exist in the candidate set. If no element exists in any candidate subset, output the standard question that cannot be matched. If the element exists in the candidate set, select the standard question with the highest similarity from the candidate set to match the input, and output the corresponding standard answer as the answer to the question input by the user.
[0117] It should be noted that to ensure that the final candidate set meets the requirements in terms of distance and similarity, the distance candidate set and the similarity candidate set are intersected to obtain the candidate subset H of the reference problem. j , judge H j Does the element exist in the set? If any H j If it is empty, it means that no standard question matching the user question can be found. Otherwise, for all candidate sets of reference questions H j Perform an intersection operation to obtain the final candidate set H, check whether the final candidate set H contains elements, if H is not empty, output the question number of each element in the set H, and the standard questions corresponding to these numbers are highly matched with the questions input by the user, so as to select the most appropriate standard question to answer, otherwise, it means that no standard question matching the user's question is found in the existing standard question library.
[0118] like Figure 5As shown, in this embodiment, when only the final candidate set H has elements, it means that there is at least one standard question that is semantically close to the user question, and the closest standard question is selected from the final candidate set, and its answer is used as the answer to the user question.
[0119] Specifically, it includes initializing variables tmps and final: setting variable tmps=0 to store the current maximum similarity value; setting variable final=-1 to store the standard question number with the maximum similarity.
[0120] From the final candidate set H, select a record for processing. If it is the first selection, take the first record in H; otherwise, select the next record of the current record, and find and obtain the word vector corresponding to the standard question number in the current record. Use the cosine similarity method to calculate the similarity between the word vector obtained in the previous step and the user question word vector U, recorded as tmpU.
[0121] Compare the values of tmpU and tmps. If tmpU>tmps, it means that the current standard question is closer to the user question. The standard question number of the current record is assigned to the variable final, and the currently calculated similarity tmpU is assigned to the variable tmps to ensure that tmps always stores the maximum similarity value. Otherwise, determine whether all records in the candidate set H have been traversed. If not, return to continue processing the next record. If traversal has been completed, find the corresponding answer according to the standard question number stored in the variable final, and output it as a response to the user.
[0122] Through intersection operations and similarity calculations, it can be ensured that the final selected standard questions are highly matched with the user questions in terms of distance and similarity, which improves the accuracy and efficiency of matching and helps provide users with more accurate and useful answers.
[0123] This method can effectively reduce the time overhead of classification and retrieval by screening the intersection of multiple reference questions, while improving the accuracy of matching, improving efficiency, improving accuracy, and enhancing robustness, avoiding the deviation that may be caused by a single reference, and making the matching process more robust. This method can achieve efficient and accurate user question matching in a large-scale standard question library, and is suitable for application scenarios with a huge number of standard questions and complex classification.
[0124] The present invention also provides a question matching system in a digital human system, which is implemented by using the above-mentioned question matching method in a digital human system, and the system comprises:
[0125] A selection module is used to select multiple standard questions from a standard question set as reference questions and construct a reference question set. The digital human system stores a standard question set and an answer set, and the data in the standard question set and the answer set are in a one-to-one correspondence;
[0126] The first calculation module is used to perform word vector processing on each question in the standard question set and the reference question set, respectively calculate the similarity and Euclidean distance between each reference question and other standard questions, construct a first candidate set, and sort them according to the similarity and Euclidean distance to generate a similarity sequence and a distance sequence;
[0127] A model building module is used to process word vectors of user input questions, calculate the similarity and Euclidean distance between the user input question and each reference question, and build a probability model based on the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions;
[0128] A range screening module is used to determine the distance proximity range and similarity proximity range of each standard question according to the probability threshold of the preset probability model, and to screen the distance sequence according to the distance proximity range of the standard question to obtain a distance candidate set, and to screen the similarity sequence according to the similarity proximity range of the standard question to obtain a similarity candidate set;
[0129] The output module is used to perform an intersection operation on the distance candidate set and the similarity candidate set to obtain a candidate set, select the standard question input with the highest similarity from the candidate set to match, and output the corresponding standard answer as the answer to the user input question.
[0130] It should be noted that this system is a system corresponding to the above-mentioned new energy power generation technology supervision and management method. All implementation methods in the above-mentioned method embodiments are applicable to the embodiments of this system and can achieve the same technical effects.
[0131] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0132] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system and module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0133] In the embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0134] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0135] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0136] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0137] In addition, it should be noted that in the system and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. Moreover, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order, and some steps can be performed in parallel or independently of each other. For those of ordinary skill in the art, it is understood that all or any steps or components of the method and apparatus of the present invention can be implemented in any computing device (including processors, storage media, etc.) or a network of computing devices in hardware, firmware, software or a combination thereof, which can be achieved by those of ordinary skill in the art using their basic programming skills after reading the description of the present invention.
[0138] Therefore, the purpose of the present invention can also be achieved by running a program or a group of programs on any computing system. The computing system can be a well-known general-purpose system. Therefore, the purpose of the present invention can also be achieved by simply providing a program product containing a program code that implements the method or device. That is to say, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any well-known storage medium or any storage medium developed in the future. It should also be pointed out that in the device and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. In addition, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order. Some steps can be performed in parallel or independently of each other.
[0139] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A question matching method in a digital human system, characterized in that: The following steps are involved: S1, selecting a plurality of standard questions from a standard question set as reference questions, and constructing a reference question set, wherein the digital human system stores a standard question set and an answer set, and the data in the standard question set and the answer set are in a one-to-one correspondence; S2, process the word vectors of each question in the standard question set and the reference question set, calculate the similarity and Euclidean distance between each reference question and other standard questions, construct the first candidate set, and sort them according to the similarity and Euclidean distance to generate a similarity sequence and a distance sequence; S3, performing word embedding processing on the user input question, calculating the similarity and Euclidean distance between the user input question and each reference question, and building a probability model based on the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions; S4, presetting a probability threshold of the probability model, determining the distance proximity range and similarity proximity range of each standard question according to the probability threshold, and screening in the distance sequence according to the distance proximity range of the standard question to obtain a distance candidate set, and screening in the similarity sequence according to the similarity proximity range of the standard question to obtain a similarity candidate set; S5, performing an intersection operation on the distance candidate set and the similarity candidate set to obtain a candidate set, selecting the standard question input with the highest similarity from the candidate set to match, and outputting the corresponding standard answer as the answer to the question input by the user.
2. The question matching method in a digital human system as claimed in claim 1, characterized in that: Step S1 includes the following sub-steps: Collect standard questions and answers, construct standard question sets and answer sets respectively, organize all standard questions and their corresponding answers, and establish a mapping relationship between standard questions and answers; Add all standard questions to the Standard Question Set and all answers to the Answer Set; The K-means clustering algorithm is used to group the standard question set, the number of selected reference questions is preset, and standard questions are randomly selected from different grouped data as reference questions to construct a reference question set.
3. The question matching method in a digital human system as claimed in claim 2, characterized in that: Step S2 includes the following sub-steps: Perform word embedding processing on each question in the standard question set and the reference question set, use the Euclidean distance formula to calculate the Euclidean distance between each reference question and other standard questions in the standard question set, and use the cosine similarity formula to calculate the similarity between each reference question and other standard questions in the standard question set; Constructing a first candidate set, associating the standard question with the corresponding calculated Euclidean distance and similarity value, combining them into a reference subset and adding them to the first candidate set; The elements in the first candidate set are arranged in ascending order according to the similarity value to generate a similarity sequence, and the elements in the first candidate set are arranged in ascending order according to the Euclidean distance value to generate a distance sequence.
4. The question matching method in a digital human system as claimed in claim 3, characterized in that: Step S3 includes the following steps: Perform word vector processing on the user input question, use the Euclidean distance formula to calculate the Euclidean distance between the user input question and each reference question, and use the cosine similarity formula to calculate the similarity between the user input question and each reference question; According to the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions, a probability model is constructed. The probability model is used to determine the degree of closeness between the standard question and the user question in terms of distance and similarity. The probability model calculation formula is: Where P j (q i |U) is the probability of the ith element in the jth reference subset being close to the user input question U, α and β are adjustment parameters, exp is the natural exponential function, d j,U is the Euclidean distance between the user input question U and the reference question corresponding to the jth reference subset, s j,U is the similarity between the user input question U and the reference question corresponding to the jth reference subset, d j,i is the Euclidean distance between the reference problem corresponding to the jth reference subset and the standard problem corresponding to the i-th element, s j,i is the similarity between the reference question corresponding to the j-th reference subset and the standard question corresponding to the i-th element.
5. The question matching method in a digital human system as claimed in claim 4, characterized in that: Step S4 includes the following sub-steps: A probability threshold of a preset probability model is set, and the preset probability threshold, the Euclidean distance between the user input question and the j-th reference question, and the similarity between the user input question and the j-th reference question are substituted into the probability model calculation formula to calculate the distance proximity range and similarity proximity range of the corresponding standard question respectively; Construct a distance candidate set. According to the distance proximity range of the reference question and the standard question, filter the corresponding reference subset in the distance sequence, obtain the elements that meet the range, and add them to each distance candidate subset respectively. Combine all distance candidate subsets to form a distance candidate set. Construct a similar candidate set, and according to the similarity proximity range of the reference question and the standard question, screen the corresponding reference subsets in the similar sequence to obtain the elements that meet the range, and add them to each similar candidate subset respectively, and combine all similar candidate subsets to form a similar candidate set.
6. The question matching method in a digital human system as claimed in claim 5, characterized in that: In step S5, the distance candidate set and the similarity candidate set are intersected to obtain a candidate set, which includes: Perform an intersection operation on the distance candidate set and the similarity candidate set to obtain the candidate set. The calculation expression is: In the formula, H is the candidate set, H j is the candidate subset corresponding to the jth reference question, TS j is the similar candidate subset corresponding to the jth reference question, TD j is the distance candidate set corresponding to the j-th reference question.
7. The question matching method in a digital human system as claimed in claim 6, characterized in that: Step S5, in which the standard question input with the highest similarity is selected from the candidate set to match, and the corresponding standard answer is output as the answer to the user input question, includes the following sub-steps: Determine whether all candidate subsets contain elements. If no element exists in any candidate subset, output the standard question that no match can be found. If all candidate subsets contain elements, perform an intersection operation on the candidate subsets of all reference questions to obtain a candidate set. Determine whether all the elements exist in the candidate set. If no element exists in any candidate subset, output the standard question that cannot be matched. If the element exists in the candidate set, select the standard question with the highest similarity from the candidate set to match the input, and output the corresponding standard answer as the answer to the user input question.
8. A question matching system in a digital human system, implemented by a question matching method in a digital human system as claimed in any one of claims 1 to 7, characterized in that: The system comprises: A selection module is used to select multiple standard questions from a standard question set as reference questions and construct a reference question set. The digital human system stores a standard question set and an answer set, and the data in the standard question set and the answer set are in a one-to-one correspondence; The first calculation module is used to perform word vector processing on each question in the standard question set and the reference question set, respectively calculate the similarity and Euclidean distance between each reference question and other standard questions, construct a first candidate set, and sort them according to the similarity and Euclidean distance to generate a similarity sequence and a distance sequence; A model building module is used to process word vectors of user input questions, calculate the similarity and Euclidean distance between the user input question and each reference question, and build a probability model based on the similarity and Euclidean distance between the user input question and each reference question and between each reference question and other standard questions; A range screening module is used to determine the distance proximity range and similarity proximity range of each standard question according to the probability threshold of the preset probability model, and to screen the distance sequence according to the distance proximity range of the standard question to obtain a distance candidate set, and to screen the similarity sequence according to the similarity proximity range of the standard question to obtain a similarity candidate set; The output module is used to perform an intersection operation on the distance candidate set and the similarity candidate set to obtain a candidate set, select the standard question input with the highest similarity from the candidate set to match, and output the corresponding standard answer as the answer to the user input question.
9. An electronic device, characterized in that: It includes at least one processor, at least one memory, a communication interface and a bus; wherein the processor, memory and communication interface communicate with each other through the bus; the memory stores a problem matching method program in a digital human system that can be executed by the processor, and the problem matching method program in a digital human system is configured to implement a problem matching method in a digital human system as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a problem matching method program in a digital human system, which, when executed, implements a problem matching method in a digital human system as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for determining standard problem based on similarity
CN112131876A
Problem screening method and device based on FAQ database, computer equipment and medium
CN111797214A
Question processing method and device based on semantic matching, terminal and storage medium
CN112632257A
Auxiliary medical management method and system based on natural questions and answers and knowledge graph
CN118568228A
Question and answer method based on enterprise internal management manual
CN118689988A