A similar question generation method and device, a storage medium and an electronic device
By searching for relevant knowledge points of user questions in the question-and-answer knowledge base and generating similar questions, the problem of insufficient number of similar questions in the question-and-answer system is solved, and the recall rate is improved.
Patent Information
- Application Number
- CN202211665508.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-12-23
AI Technical Summary
In existing response systems, the number of similar questions in the question-and-answer knowledge base is small, resulting in low recall and an inability to effectively answer user questions.
By finding the first and second relevant knowledge points of user questions from the question-and-answer knowledge base, extracting sentence templates and storing them in the cache, generating similar questions and supplementing them to the question-and-answer knowledge base, the number of similar questions is increased.
This increased the number of similar questions in the question-and-answer knowledge base, thereby improving the recall rate of response information.
Smart Images

Figure CN116737886B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent response technology, and in particular to a method and apparatus for generating similar questions, a storage medium and an electronic device. Background Technology
[0002] Currently, after a user asks a question, the response system searches for the most relevant similar question among all similar questions corresponding to each knowledge point pre-stored in the question-and-answer knowledge base. When the highest relevance is greater than the response threshold, the system recalls the response information corresponding to that highest relevance in the question-and-answer knowledge base and responds to the user's question based on the response information.
[0003] In existing technologies, the recall of response information relies entirely on similar questions about knowledge points pre-stored in the question-and-answer knowledge base. However, the similar questions stored in the question-and-answer knowledge base are manually written, resulting in a small number of similar questions and thus a low recall rate. Therefore, how to provide a technical solution that can automatically supplement similar questions about knowledge points to improve the recall rate is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, and electronic device for generating similar questions, with the aim of supplementing similar questions on knowledge points to improve recall.
[0005] To achieve the above objectives, this application provides the following technical solution:
[0006] A method for generating similar questions includes:
[0007] Obtaining user questions;
[0008] The system searches for a first relevant knowledge point and a second relevant knowledge point related to the user's question from various knowledge points included in a pre-defined question-and-answer knowledge base; wherein the first relevant knowledge point is more relevant to the user's question than the second relevant knowledge point is to the user's question.
[0009] If a first relevant knowledge point is found for the user question, and the user question includes a business term corresponding to the first relevant knowledge point, then based on the business term of the first relevant knowledge point, a sentence template for the user question is extracted, and if the extracted sentence template does not match the sentence template stored in the cache, the extracted sentence template is stored in the cache.
[0010] Based on the sentence templates stored in the cache, similar questions for the first relevant knowledge point and similar questions for the second relevant knowledge point are generated, and the generated similar questions are stored in the question-and-answer knowledge base.
[0011] Optionally, in the above method, the step of searching for the first and second relevant knowledge points of the user's question from the various knowledge points included in the preset question-and-answer knowledge base includes:
[0012] Based on the user's question, a preset number of similar questions are retrieved from each similar question corresponding to each knowledge point in the preset question-and-answer knowledge base;
[0013] Calculate the relevance between the user's question and each retrieved similar question;
[0014] The maximum relevance is determined from the relevance between the user's question and each of the retrieved similar questions;
[0015] If the maximum relevance is greater than the first relevance threshold, then the knowledge point corresponding to the similar question corresponding to the maximum relevance is determined as the first relevant knowledge point;
[0016] If the maximum relevance is not greater than the first relevance threshold, then when the maximum relevance is greater than the second relevance threshold, the knowledge point corresponding to the similar question corresponding to the maximum relevance is determined as the second relevance knowledge point; wherein, the second relevance threshold is less than the first relevance threshold;
[0017] For each similar question retrieved, excluding the similar question corresponding to the maximum relevance, if the relevance between the similar question and the user's question is greater than the second relevance threshold, then the knowledge point corresponding to the similar question is determined as the second relevant knowledge point.
[0018] Optionally, in the above method, generating similar questions for the first related knowledge point and similar questions for the second related knowledge point based on the various sentence templates stored in the cache includes:
[0019] Iterate through each sentence template in the cache in sequence, and perform the first operation on each sentence template encountered in the iteration;
[0020] The first operation includes:
[0021] If the sentence template matches the user question, the template counter of the sentence template is incremented. If a first relevant knowledge point of the user question is found, a similar question for the first relevant knowledge point is generated based on the sentence template and the business words corresponding to the first relevant knowledge point. If a second relevant knowledge point of the user question is found, a candidate question for each second relevant knowledge point is generated based on the current count result of the template counter, the sentence template, and the business words corresponding to each second relevant knowledge point. For each candidate question, if the candidate question passes the semantic validity check, the candidate question is determined as a similar question for the corresponding second relevant knowledge point.
[0022] Optionally, in the above method, generating similar questions for the first related knowledge point based on the sentence template and preset business terms corresponding to the first related knowledge point includes:
[0023] If there is no supplementary identification information for the sentence template regarding the first relevant knowledge point, then the first relevant counter for the sentence template regarding the first relevant knowledge point is incremented by one, and the first total relevant counter for the sentence template regarding all knowledge points is incremented by one; the supplementary identification information for the sentence template regarding the first relevant knowledge point is used to indicate that similar questions corresponding to the sentence template have been added to the first relevant knowledge point;
[0024] Based on the current count result of the first relevant counter, the current count result of the first relevant total counter, and the character length of the sentence template, calculate the first supplementary weight of the sentence template with respect to the first relevant knowledge point;
[0025] If the first supplementary weight is greater than the first supplementary threshold, then similar questions for the first related knowledge point are generated based on the sentence template and the preset business terms corresponding to the first related knowledge point.
[0026] Optionally, in the above method, generating alternative questions for each second related knowledge point based on the current counting result of the template counter, the sentence template, and the business terms corresponding to each second related knowledge point includes:
[0027] If there is no supplementary identification information for each second related knowledge point in the sentence template, then the second related counter for each second related knowledge point in the sentence template is incremented by one, and the total second related counter for all knowledge points in the sentence template is incremented by one; the supplementary identification information for the second related knowledge point in the sentence template is used to indicate that similar questions corresponding to the sentence template have been added to the second related knowledge point;
[0028] The second supplementary weight is calculated based on the current count result of the second relevant counter for each second relevant knowledge point of the sentence template, the current count result of the second relevant total counter, the current count result of the template counter, and the character length of the sentence template;
[0029] If the second supplementary weight is greater than the second supplementary threshold, then based on the sentence template and the business terms corresponding to each second related knowledge point, alternative questions for each second related knowledge point are generated.
[0030] Optionally, in the above method, determining that the candidate questions pass semantic validity verification includes:
[0031] Using a pre-built syntax verification model, the candidate questions are subjected to syntax verification to obtain the syntax verification results of the candidate questions;
[0032] If the syntax verification result satisfies the preset verification rules, the relevance between the candidate questions and each target similar question is calculated; wherein, the target similar question is the similar question corresponding to the second relevant knowledge point of the preset candidate question;
[0033] If the relevance of the candidate question to each target similar question is greater than the second relevance threshold, then the candidate question is determined to have passed the semantic legality check.
[0034] Optionally, after generating similar questions for the first relevant knowledge point, the above method further includes:
[0035] Generate supplementary identification information for the sentence template regarding the first relevant knowledge point, and store the generated supplementary identification information;
[0036] After determining the candidate questions as similar questions to the corresponding second relevant knowledge points, the method further includes:
[0037] Generate supplementary identification information for the sentence template regarding the second relevant knowledge point, and store the generated supplementary identification information.
[0038] A similar question generation device, comprising:
[0039] The first acquisition unit is used to acquire user questions;
[0040] The search unit is used to search for a first relevant knowledge point and a second relevant knowledge point of the user question from various knowledge points included in a preset question-and-answer knowledge base; wherein, the first relevant knowledge point is more relevant to the user question than the second relevant knowledge point is to the user question.
[0041] The extraction unit is configured to, if a first relevant knowledge point of the user question is found, and the user question includes a business term corresponding to the first relevant knowledge point, extract a sentence template of the user question based on the business term of the first relevant knowledge point, and store the extracted sentence template in the cache if the extracted sentence template does not match the sentence template stored in the cache.
[0042] The generation unit is used to generate similar questions for the first related knowledge point and similar questions for the second related knowledge point based on the various sentence templates stored in the cache, and to store the generated similar questions in the question-and-answer knowledge base.
[0043] A storage medium storing an instruction set, wherein the instruction set, when executed by a processor, implements the similar problem generation method described above.
[0044] An electronic device, comprising:
[0045] Memory, used to store at least one set of instructions;
[0046] A processor is configured to execute a set of instructions stored in the memory, thereby implementing the similar problem generation method described above.
[0047] Compared with the prior art, this application has the following advantages:
[0048] This application provides a method, apparatus, storage medium, and electronic device for generating similar questions, comprising: upon obtaining a user question, searching for first and second relevant knowledge points of the user question from various knowledge points included in a question-and-answer knowledge base; extracting sentence templates of the user question based on business terms of the first relevant knowledge points and storing them in a cache to supplement the sentence templates in the cache; and generating similar questions of the first and second relevant knowledge points based on the various sentence templates in the cache and storing them in the question-and-answer knowledge base, thereby automatically supplementing the similar questions of the first and second relevant knowledge points in the question-and-answer knowledge base, thereby increasing the number of similar questions in the question-and-answer knowledge base and thus improving the recall rate of subsequent response information. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0050] Figure 1A flowchart of a similarity problem generation method provided in this application;
[0051] Figure 2 Another flowchart of a similar problem generation method provided in this application;
[0052] Figure 3 Another flowchart of a similar problem generation method provided in this application;
[0053] Figure 4 Another flowchart of a similar problem generation method provided in this application;
[0054] Figure 5 Another flowchart of a similar problem generation method provided in this application;
[0055] Figure 6 Another flowchart of a similar problem generation method provided in this application;
[0056] Figure 7 Example diagram of a similar problem generation method provided in this application;
[0057] Figure 8 A schematic diagram of a similar problem generation device provided in this application;
[0058] Figure 9 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation
[0059] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0060] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0061] It should be noted that the concepts of "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0062] It should be noted that the terms "a" and "a plurality of" used in this application disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0063] This application can be used in a wide variety of general-purpose or special-purpose computing environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor devices, distributed computing environments including any of the above devices, etc.
[0064] This application provides a method for generating similar questions, which can be applied to a response system. The flowchart of the method is shown below. Figure 1 As shown, it specifically includes:
[0065] S101, User Acquisition Issues.
[0066] In this embodiment, the user's question is obtained. Specifically, in response to the user's trigger command, a user question input interface is generated, and the user's question is obtained through the user question input interface.
[0067] The user's trigger command can be a command generated by the user through triggering the relevant function keys in the response system.
[0068] S102. Search for the first and second relevant knowledge points of the user's question from the various knowledge points included in the preset question and answer knowledge base.
[0069] In this embodiment, a question-and-answer knowledge base is preset, which stores the mapping relationship between business, knowledge points, similar questions and answers. For example, the mapping relationship between business, knowledge points, similar questions and answers is shown in the first mapping table Table 1:
[0070]
[0071] Table 1 First Mapping Table
[0072] In this embodiment, a business term corresponding to each knowledge point is preset in the database table. The business term includes both business nouns and business verbs. For example, the mapping relationship between knowledge points and business nouns and verbs is shown in the second mapping table, Table 2:
[0073] Knowledge Points Business terms (.*(N)) Business verbs (.*(V)) How to obtain electronic invoices electronic invoice Take, open Electronic invoice issuance time Invoice time open Check order progress Order progress check Check service order progress Service Request Progress check ...... ...... ......
[0074] Table 2 Second Mapping Table
[0075] In the second mapping table, N represents business noun tags, V represents business verb tags, and .* represents regular expression wildcards.
[0076] In this implementation, the system searches for the first and second relevant knowledge points of the user's question from the various knowledge points included in the pre-set question knowledge base. The first relevant knowledge point is more relevant to the user's question than the second relevant knowledge point. It should be noted that the degree of relevance can be calculated using similarity.
[0077] See Figure 2 The process of searching for the first and second relevant knowledge points of a user's question from various knowledge points included in a pre-set question knowledge base specifically includes the following steps:
[0078] S201. Based on the user's question, retrieve a preset number of similar questions from each similar question corresponding to each knowledge point in the preset question-and-answer knowledge base.
[0079] In this embodiment, based on the user's question, a search engine is used to retrieve a preset number of similar questions from each similar question corresponding to each knowledge point included in a preset question-and-answer knowledge base. Preferably, the search engine can be Elasticsearch, and the preset number can be 100.
[0080] Specifically, Elasticsearch performs word segmentation on the user's question and, based on the segmentation results, retrieves the top 100 similar questions from the question-and-answer knowledge base that match the segmentation results.
[0081] S202. Calculate the relevance between the user's question and each retrieved similar question.
[0082] In this embodiment, the relevance between the user's question and each retrieved similar question is calculated. Specifically, for each retrieved similar question, the similarity between the similar question and the user's question is calculated, thereby obtaining the relevance between the similar question and the user's question.
[0083] S203. Determine the maximum relevance among the relevance between the user's question and each of the retrieved similar questions.
[0084] In this embodiment, based on the relevance between the user's question and each of the retrieved similar questions, the similar questions are sorted in descending order of relevance, and the similar question ranked first among the sorted similar questions is determined to have the highest relevance to the user's question.
[0085] S204. Determine whether the maximum correlation is greater than the first correlation threshold. If yes, proceed to S205; otherwise, proceed to S206.
[0086] In this embodiment, it is determined whether the maximum correlation degree is greater than the first correlation threshold. Preferably, the first correlation threshold can be 0.9.
[0087] S205. The knowledge points corresponding to the similar questions with the highest degree of relevance are identified as the first relevant knowledge points.
[0088] In this embodiment, if the maximum relevance is greater than the first relevance threshold, the knowledge point corresponding to the similar question with the maximum relevance is determined as the first relevant knowledge point.
[0089] S206. Determine whether the maximum correlation is greater than the second correlation threshold. If yes, proceed to S207. If no, end directly.
[0090] In this embodiment, if the maximum correlation is not greater than the first correlation threshold, it is further determined whether the maximum correlation is greater than the second correlation threshold, wherein the second correlation threshold is less than the first correlation threshold, and preferably, the second correlation threshold can be 0.3.
[0091] If the maximum relevance is not greater than the second relevance threshold, it means that the relevance of all retrieved similar questions to the user's question is less than the second relevance threshold. In other words, there is neither a first-relevance knowledge point nor a second-relevance knowledge point for the user's question in the knowledge base, and the process ends directly.
[0092] S207. The knowledge points corresponding to the similar questions with the highest degree of relevance are identified as the second relevant knowledge points.
[0093] In this embodiment, if the maximum relevance is not greater than the first relevance threshold, but the maximum relevance is greater than the second relevance threshold, then the knowledge point corresponding to the similar question with the maximum relevance is determined as the second relevance knowledge point.
[0094] S208. For each similar question retrieved, excluding the one with the highest relevance, determine whether the relevance between the similar question and the user's question is greater than the second relevance threshold. If yes, proceed to S209; otherwise, end directly.
[0095] In this embodiment, for each similar question retrieved, excluding the similar question corresponding to the highest relevance, it is determined whether the relevance between the similar question and the user's question is greater than a second relevance threshold. If the relevance is not greater than the second relevance threshold, the knowledge point corresponding to the similar question is not determined as a second relevance knowledge point, and the judgment process for the similar question ends.
[0096] S209. For each similar question retrieved, excluding the similar question corresponding to the highest degree of relevance, the knowledge point corresponding to that similar question is determined as the second relevant knowledge point.
[0097] In this embodiment, for each similar question retrieved, excluding the similar question corresponding to the highest relevance, if the relevance is greater than the second relevance threshold, then the knowledge point corresponding to the similar question is determined as the second relevance knowledge point.
[0098] In this embodiment, a preset number of similar questions are retrieved from the knowledge base, and the relevance between the retrieved similar questions and the user's question is calculated. Based on the relevance, it is determined whether there are first and second relevant knowledge points for the user's question in the knowledge base.
[0099] S103. Determine whether the first relevant knowledge point of the user's problem has been found. If not, proceed to S104. If yes, proceed to S105.
[0100] In this embodiment, it is determined whether the first relevant knowledge point of the user's question has been found.
[0101] S104. Based on the sentence templates stored in the cache, generate similar questions for the first relevant knowledge point and similar questions for the second relevant knowledge point, and store the generated similar questions in the question-and-answer knowledge base.
[0102] In this embodiment, if no first relevant knowledge point for the user question is found, or if the first relevant knowledge point for the user question is found but the user question does not include the business term of the first relevant knowledge point, or if there is a sentence template in the cache that matches the sentence template of the extracted user question, or if the extracted sentence template has been written into the cache, then based on the various sentence templates stored in the cache, similar questions for the first relevant knowledge point and similar questions for the second relevant knowledge point are generated.
[0103] In this embodiment, the process of generating similar questions for the first relevant knowledge point and similar questions for the second relevant knowledge point based on the sentence templates stored in the cache specifically includes:
[0104] The process iterates through each sentence template in the cache, performing a first operation on each encountered template. This first operation includes: if a sentence template matches the user question, incrementing the template counter; if a first relevant knowledge point is found, generating similar questions based on the sentence template and the corresponding business terms; if a second relevant knowledge point is found, generating candidate questions for each second relevant knowledge point based on the current counter count, the sentence template, and the corresponding business terms; and for each candidate question, determining it as a similar question to the corresponding second relevant knowledge point if it passes semantic validity verification.
[0105] See Figure 3 The first operation specifically includes the following steps:
[0106] S301. Determine whether the sentence template matches the user's question. If yes, execute S302. If no, end the operation on the sentence template.
[0107] In this embodiment, it is determined whether the sentence template matches the user's question; specifically, it is determined whether the sentence template matches the regular expression of the user's question.
[0108] In this embodiment, if the sentence template matches the user question, step S302 is executed; if the sentence template does not match the user question, the operation on the sentence template is terminated.
[0109] S302, Increment the template counter of the sentence template by one.
[0110] In this embodiment, if the sentence template matches the user's question, the template counter of the sentence template is incremented by one.
[0111] It should be noted that for each sentence template in the cache, there are preset template counters, first and second related knowledge bases for each knowledge point of the sentence template, and first and second total related counters for all knowledge base points of the sentence template.
[0112] S303. Determine whether the first relevant knowledge point of the user's problem has been found. If yes, proceed to S304; otherwise, proceed to S305.
[0113] In this embodiment, it is determined whether the first relevant knowledge point of the user's question has been found.
[0114] S304. Based on the sentence template and the business terms corresponding to the first relevant knowledge point, generate similar questions for the first relevant knowledge point.
[0115] In this embodiment, if the first relevant knowledge point of the user's question is found, then similar questions of the first relevant knowledge point are generated based on the sentence template and the business terms corresponding to the first relevant knowledge point.
[0116] See Figure 4 The process of generating similar questions for the first relevant knowledge point based on sentence templates and business terms corresponding to the first relevant knowledge point specifically includes:
[0117] S401. Determine if there is any supplementary identification information for the first relevant knowledge point in the sentence template. If yes, end directly; otherwise, execute S402.
[0118] In this embodiment, it is determined whether there is supplementary identification information of the sentence template regarding the first relevant knowledge point. The supplementary identification information of the sentence template regarding the first relevant knowledge point is used to indicate that similar questions corresponding to the sentence template have been supplemented for the first relevant knowledge point. That is, similar questions of the sentence template regarding the first relevant knowledge point have been generated and the similar questions have been stored in the question-and-answer knowledge base.
[0119] In this embodiment, if there is no supplementary identification information for the first relevant knowledge point in the sentence template, then step S402 is executed; if there is supplementary identification information for the first relevant knowledge point in the sentence template, then the process ends directly.
[0120] S402. Increment the count of the first relevant counter for the sentence template regarding the first relevant knowledge point, and increment the count of the total first relevant counter for all knowledge points of the sentence template.
[0121] In this embodiment, if there is no supplementary identification information for the sentence template regarding the first relevant knowledge point, the first relevant counter for the sentence template regarding the first relevant knowledge point is incremented by one, and the total first relevant counter for the sentence template regarding all knowledge points is also incremented by one. The result of the first relevant counter can be represented by ResponseCount(LM, Knowledge). Incrementing the first relevant counter for the sentence template regarding the first relevant knowledge point is equivalent to executing ResponseCount(LM, Knowledge) + 1; the result of the total first relevant counter can be represented by ResponseTotalCount(LM). Incrementing the total first relevant counter for the sentence template regarding all knowledge points is equivalent to executing ResponseTotalCount(LM) + 1.
[0122] Here, LM represents sentence templates, and Knowledge represents knowledge points.
[0123] S403. Based on the current counting result of the first relevant counter, the current counting result of the first relevant total counter, and the character length of the sentence template, calculate the first supplementary weight of the sentence template with respect to the first relevant knowledge point.
[0124] In this embodiment, based on the current counting result of the first relevant counter, the current counting result of the first total relevant counter, and the character length of the sentence template, the first supplementary weight of the sentence template with respect to the first relevant knowledge point is calculated using the first calculation formula.
[0125] The first calculation formula is:
[0126]
[0127] Where EffectiveLM(LM, Knowledge) represents the first supplementary weight of the sentence template with respect to the first relevant knowledge point, ResponseCount(LM, Knowledge) represents the current count result of the first relevant counter, Len(LM) represents the character length of the sentence template, and ResponseTotalCount(LM) represents the current count result of the first relevant total counter.
[0128] S404. Determine whether the first supplementary weight is greater than the first supplementary threshold. If yes, execute S405. If no, end directly.
[0129] In this embodiment, it is determined whether the first supplementary weight is greater than the first supplementary threshold. Preferably, the first supplementary threshold is 2.5.
[0130] In this embodiment, if the first supplementary weight is greater than the first supplementary threshold, then step S405 is executed; if the first supplementary weight is not greater than the first supplementary threshold, then the process ends directly.
[0131] S405. Based on the sentence template and the business terms corresponding to the first relevant knowledge point, generate similar questions for the first relevant knowledge point.
[0132] In this embodiment, if the first supplementary weight is greater than the first supplementary threshold, then based on the sentence template and the business words corresponding to the first related knowledge point, similar questions for the first related knowledge point are generated. Specifically, the business verb identifiers and regular expression wildcards in the sentence template are replaced with the business verbs corresponding to the first related knowledge point, and the business noun identifiers and regular expression wildcards in the sentence template are replaced with the business nouns corresponding to the first related knowledge point, thereby obtaining similar questions for the first related knowledge point.
[0133] For example, the process of generating similar questions for the first relevant knowledge point based on the sentence template and the business terms corresponding to the first relevant knowledge point mentioned in this embodiment is illustrated as follows:
[0134] The sentence template is "I want to...*(V)...*(N)", the first relevant knowledge point is "electronic invoice acquisition method", the business verb corresponding to the first relevant knowledge point is "take, issue", and the business noun is "electronic invoice". Then, the similar questions generated for the first relevant knowledge point are "I want to issue an electronic invoice" and "I want to take an electronic invoice".
[0135] S305. Determine whether a second relevant knowledge point for the user's question has been found. If yes, execute S305. If no, end the operation on the sentence template.
[0136] In this embodiment, if no first relevant knowledge point for the user's question is found, it is further determined whether a second relevant knowledge point for the user's question is found. If yes, step S305 is executed; otherwise, the operation on the sentence template is terminated.
[0137] S306. Based on the current counting result of the template counter, the sentence template, and the business terms corresponding to each second related knowledge point, generate alternative questions for each second related knowledge point.
[0138] In this embodiment, if a second relevant knowledge point for a user's question is found, then based on the current count result of the template counter, the sentence template, and the business terms corresponding to each second relevant knowledge point, alternative questions for each second relevant knowledge point are generated.
[0139] See Figure 5 The process of generating alternative questions for each second related knowledge point based on the current count result of the template counter, the sentence template, and the business terms corresponding to each second related knowledge point includes the following steps:
[0140] S501. Determine whether there is supplementary identification information for each second relevant knowledge point in the sentence template. If yes, proceed directly; otherwise, execute S502.
[0141] In this embodiment, it is determined whether there is supplementary identification information for each second related knowledge point of the sentence template. The supplementary identification information for the second related knowledge point of the sentence template is used to indicate that similar questions corresponding to the sentence template have been supplemented for the second related knowledge point. That is, similar questions for the second related knowledge point of the sentence template have been generated and the similar questions have been stored in the question-and-answer knowledge base.
[0142] In this embodiment, if there is no supplementary identification information for each second related knowledge point in the sentence template, then step S502 is executed; if there is supplementary identification information for any second related knowledge point in the sentence template, then the process ends directly.
[0143] S502, increment the second relevant counter of the sentence template for each second relevant knowledge point by one, and increment the total second relevant counter of the sentence template for all knowledge points by one.
[0144] In this embodiment, if there is no supplementary identification information for the second relevant knowledge point in the sentence template, the second relevant counter for each second relevant knowledge point in the sentence template is incremented by one, and the total second relevant counter for all knowledge points in the sentence template is incremented by one. The result of the second relevant counter can be represented by RelativeCount(LM, Knowledge), which increments the first relevant counter for the second relevant knowledge point in the sentence template by one, i.e., RelativeCount(LM, Knowledge) + 1; the result of the total second relevant counter can be represented by RelativeTotalCount(LM), which increments the total first relevant counter for all knowledge points in the sentence template by one, i.e., RelativeTotalCount(LM) + 1.
[0145] Here, LM represents sentence templates, and Knowledge represents knowledge points.
[0146] S503. Calculate the second supplementary weight based on the current count result of the second relevant counter for each second relevant knowledge point of the sentence template, the current count result of the total second relevant counter, the current count result of the template counter, and the character length of the sentence template.
[0147] Based on the current count result of the second relevant counter for each second relevant knowledge point of the sentence template, the current count result of the total second relevant counter, the current count result of the template counter, and the character length of the sentence template, the second supplementary weight is calculated using the second calculation formula.
[0148] The second calculation formula is as follows:
[0149]
[0150] Wherein, RelativeEffectiveLM(LM, RelativeKnowledge[0...n]) represents the second supplementary weight, RelativeTotalCount(LM) represents the current count result of the second relevance total counter, Len(LM) represents the character length of the sentence template, TriggerCount(LM) represents the current count result of the template counter, and Variance(LM, RelativeKnowledge[0...n]) represents the variance of the current count result of the second relevance counter for each second relevance knowledge point of the sentence template.
[0151] in,
[0152]
[0153] Where n represents the number of second relevant knowledge points, RelativeCount i This represents the current count result of the second-related counter for the i-th second-related knowledge point in the sentence template.
[0154] S504. Determine whether the second supplementary weight is greater than the second supplementary threshold. If yes, execute S505. If no, end directly.
[0155] In this embodiment, it is determined whether the second supplementary weight is greater than the second supplementary threshold. If not, the process ends; if yes, step S505 is executed. Preferably, the second supplementary threshold is 1.
[0156] S505. Based on the sentence template and the business terms corresponding to each second related knowledge point, generate alternative questions for each second related knowledge point.
[0157] In this embodiment, for each second related knowledge point, if the second supplementary weight is greater than the second supplementary threshold, then based on the sentence template and the business words corresponding to the second related knowledge point, similar questions for the second related knowledge point are generated. Specifically, the business verb identifiers and regular expression wildcards in the sentence template are replaced with the business verbs corresponding to the second related knowledge point, and the business noun identifiers and regular expression wildcards in the sentence template are replaced with the business nouns corresponding to the second related knowledge point, thereby obtaining similar questions for the second related knowledge point.
[0158] The process of generating alternative questions for each of the second relevant knowledge points mentioned above is illustrated with an example below:
[0159] The sentence template is "I want to...*(V)...*(N)", and the calculated second supplementary weight is 1.126. The second relevant knowledge points are "checking order progress" and "checking service order progress". Therefore, the candidate question for "checking order progress" is "I want to check the order progress", and the similar question for "checking service order progress" is "I want to check the service order progress".
[0160] S307. For each candidate question, determine whether the candidate question passes the semantic validity check. If yes, execute S308. If no, end the judgment process for the candidate question.
[0161] In this embodiment, for each candidate question, it is determined whether the candidate question passes the semantic validity check. Specifically, this includes the following steps:
[0162] Using a pre-built syntax validation model, the candidate questions are validated to obtain the syntax validation results of the candidate questions;
[0163] If the syntax verification result meets the preset verification rules, the relevance between the candidate questions and each target similar question is calculated; where the target similar questions are the similar questions corresponding to the second relevant knowledge points of the preset candidate questions;
[0164] If the relevance of the candidate question to each target similar question is greater than the second relevance threshold, then the candidate question is determined to have passed the semantic validity check.
[0165] In this embodiment, a pre-built syntax verification model is used to perform syntax verification on the candidate questions to obtain the syntax verification results of the candidate questions. Preferably, the syntax verification model is a sequence-to-sequence seq2seq model + attention model.
[0166] In this embodiment, it is determined whether the syntax check result meets the preset check rules. Specifically, it is determined whether the syntax check result is less than the syntax error threshold. Preferably, the syntax error threshold is 0.8.
[0167] In this embodiment, if the syntax verification result meets the preset verification rules, the relevance between the candidate questions and each target similar question is calculated. Specifically, the similarity between the candidate questions and each target similar question is calculated. The target similar question refers to the similar question corresponding to the second relevant knowledge point of the preset candidate question.
[0168] In this embodiment, it is determined whether the relevance between the candidate question and each target similar question is no greater than a second relevance threshold. If so, the candidate question is determined to have passed the semantic validity check. Preferably, the second relevance threshold is 0.3.
[0169] For example, for the alternative question A, "I want to check the order progress," the pre-defined similar questions (i.e., target similar questions) corresponding to the second relevant knowledge point of alternative question A are "Check order progress" and "Where is my order?". The syntax validation result obtained by the syntax validation model is 0.11, and the calculated relevance between the alternative question and each target similar question is 0.39. Therefore, alternative question A is determined to pass the semantic validity check. For the alternative question B, "I want to check the service order progress," the pre-defined similar questions (i.e., target similar questions) corresponding to the second relevant knowledge point of alternative question B are "Check service order progress" and "My service order progress." The syntax validation result obtained by the syntax validation model is 0.12, and the calculated relevance between the alternative question and each target similar question is 0.87. Therefore, alternative question B is determined to pass the semantic validity check.
[0170] S308. For each candidate question, determine the candidate question as a similar question to the corresponding second relevant knowledge point.
[0171] In this embodiment, for each candidate question, if the candidate question passes the semantic validity check, then the candidate question is determined as a similar question to the corresponding second related knowledge point.
[0172] S309. Store the generated similar questions in the question-and-answer knowledge base.
[0173] In this embodiment, the generated similar questions are stored in the question-and-answer knowledge base. Specifically, the generated similar questions are stored in the similar question storage location corresponding to the knowledge point of the similar question in the knowledge base.
[0174] It should be noted that the generated similar questions include similar questions on the first related knowledge point and similar questions on the second related knowledge point.
[0175] S105. Determine whether the user's question includes the business term corresponding to the first relevant knowledge point. If not, proceed to S104; if yes, proceed to S106.
[0176] In this embodiment, each knowledge point in the preset question-and-answer knowledge base corresponds to a business term, which includes business nouns and business verbs.
[0177] In this embodiment, it is determined whether the user's question includes business terms corresponding to the first relevant knowledge point. Specifically, it is determined whether the user's question includes business nouns and business verbs corresponding to the first relevant knowledge point.
[0178] S106. Based on the business terms of the first relevant knowledge point, extract the sentence template of the user's question.
[0179] In this embodiment, if the user question includes business terms related to the first relevant knowledge point, that is, if the user question includes both business verbs and business nouns related to the first relevant knowledge point, then the sentence template of the user question is extracted based on the business terms related to the first relevant knowledge point.
[0180] Specifically, based on business verb tags, business noun tags, and regular expression wildcards, the business words of the first relevant knowledge points included in the user question are replaced accordingly. That is, the business verbs of the first relevant knowledge points included in the user question are replaced with business verb tags and regular expression wildcards, and the business nouns of the first relevant knowledge points included in the user question are replaced with business noun tags and regular expression wildcards, thereby obtaining the sentence template of the user question.
[0181] For example, the process of extracting sentence templates for user questions is illustrated below:
[0182] The user question is "I want to issue an e-invoice". The first relevant knowledge point found for the user question is "e-invoice acquisition method". The business verb in the business term of the first relevant knowledge point is "get, issue", and the business noun is "e-invoice". The sentence template for extracting the user question is "I want to.*(V) a.*(N)".
[0183] S107. Determine whether the extracted sentence template does not match any of the sentence templates stored in the cache. If yes, execute S108; otherwise, execute S104.
[0184] In this embodiment, after extracting the sentence template of the user's question, it is determined whether the extracted sentence template matches all the sentence templates stored in the cache, that is, whether the sentence templates stored in the cache are all different from the extracted sentence templates.
[0185] In this embodiment, if there is a sentence template in the sentence template stored in the cache that matches the extracted sentence template, that is, if there is a sentence template in the sentence template stored in the cache that is the same as the extracted sentence template, then the sentence model will not be written into the cache, and step S104 will be executed.
[0186] S108. Store the extracted sentence templates in the cache and execute S104.
[0187] In this embodiment, if the extracted sentence template does not match the sentence template stored in the cache, that is, if the extracted sentence template is different from the sentence template stored in the cache, then the extracted sentence template is stored in the cache.
[0188] In this embodiment, after storing the sentence template in the cache, step S104 is executed.
[0189] The similar question generation method provided in this application involves, upon obtaining a user's question, searching for first and second relevant knowledge points from various knowledge points included in the question-and-answer knowledge base, extracting sentence templates for the user's question based on the business terms of the first relevant knowledge points and storing them in a cache, thereby supplementing the sentence templates in the cache. Based on the various sentence templates in the cache, similar questions for the first and second relevant knowledge points are generated and stored in the question-and-answer knowledge base, thus automatically supplementing the similar questions for the first and second relevant knowledge points in the question-and-answer knowledge base, thereby increasing the number of similar questions in the question-and-answer knowledge base and improving the recall rate of subsequent response information.
[0190] The similar problem generation method provided in this application embodiment may further include the following steps after step S304:
[0191] Generate supplementary identification information about the first relevant knowledge point in the sentence template, and store the generated supplementary identification information.
[0192] In this embodiment, after generating similar questions for the first relevant knowledge point, supplementary identification information of the sentence template regarding the first relevant knowledge point can also be generated and the generated similar questions can be stored. The supplementary identification information of the sentence template regarding the first relevant knowledge point is used to indicate that similar questions corresponding to the supplementary sentence template have been added for the first relevant knowledge point, thereby avoiding the need to repeatedly add similar questions corresponding to the supplementary sentence template for the first relevant knowledge point in the future.
[0193] The similar problem generation method provided in this application embodiment may further include the following steps after step S308:
[0194] Generate supplementary identification information about the second relevant knowledge point in the sentence template, and store the generated supplementary identification information.
[0195] In this embodiment, after identifying the candidate questions as similar questions to the corresponding second related knowledge points, supplementary identification information about the second related knowledge points can be generated for the sentence templates, and the generated similar questions can be stored. The supplementary identification information about the second related knowledge points for the sentence templates is used to indicate that similar questions corresponding to the supplementary sentence templates for the second related knowledge points have been added, thereby avoiding the need to repeatedly add similar questions corresponding to the supplementary sentence templates for the second related knowledge points in the future.
[0196] See Figure 6 The similar problem generation method proposed in the above-described embodiments of this application may further include the following steps after step S102:
[0197] S601. If the first relevant knowledge point of the user's question is found, the response information corresponding to the first relevant knowledge point in the question-and-answer knowledge base is obtained.
[0198] In this embodiment, if the first relevant knowledge point of the user's question is found in the question-and-answer knowledge base, the response information corresponding to the first relevant knowledge point in the question-and-answer knowledge base is obtained.
[0199] S602. Respond to user questions based on response information.
[0200] In this embodiment, after obtaining the response information corresponding to the first relevant knowledge point, the user's question is answered based on the response information. Specifically, the information is visualized to answer the user's question.
[0201] The similar question generation method provided in this application generates similar questions for the first and second related knowledge points of the user question after each user question is obtained. The generated similar questions supplement the similar questions in the question-and-answer knowledge base, thereby improving the recall rate of response information and thus improving the user experience.
[0202] See Figure 7 The specific implementation process of the similar problem generation method mentioned in the above embodiments of this application is illustrated by the following example:
[0203] After a user asks a question, the response system searches for the first and second relevant knowledge points of the user's question from the various knowledge points included in the QA knowledge base (i.e., the question-and-answer knowledge base mentioned above). After completing the search, the system responds to the user based on the search results and generates similar questions through the similar question generation module, and stores the generated similar questions in the QA knowledge base.
[0204] The process of responding to users based on the search results includes: if the first relevant knowledge point of the user's question is found, then responding to the user's question based on the response information corresponding to the first relevant knowledge point.
[0205] The similar question generation module generates similar questions based on the business nouns and verbs corresponding to the knowledge points in the business module. The process includes:
[0206] 1. Extract sentence templates: If the user's corpus matches a knowledge point (similarity score is higher than the response threshold), extract sentence templates from the user's corpus and cache them.
[0207] a) First, ensure that the user corpus contains both business verbs and business nouns that hit the knowledge points, and includes "continue"; otherwise, skip this step.
[0208] b) Replace the business verbs and nouns that match the knowledge points with wildcards and tags to get the sentence template (LM);
[0209] c) Then put the sentence template into the Redis cache.
[0210] 2. Update statistics: Regardless of whether the knowledge point is hit, count the number of times the sentence template is triggered: (LM: sentence template, Knowledge: knowledge point).
[0211] a) Read all sentence templates from the cache, and match them against the user's sentence corpus according to the template regular expression. If one or more sentence templates are matched, iterate through the templates and update the count. Otherwise, skip this step.
[0212] b) If the user's corpus matches a certain sentence pattern template and hits a knowledge point (similarity score higher than the response threshold), then
[0213] i. Increment the number of times this template hits this knowledge point by 1: ResponseCount(LM, Knowledge) + 1;
[0214] ii. The total number of times this template hits the knowledge points is incremented by 1: ResponseTotalCount(LM) + 1.
[0215] 3. Supplement similar questions to hit knowledge points: If the user's corpus hits a knowledge point and the sentence hits a sentence template, calculate the effective supplement weight of the sentence template for the hit knowledge point (the knowledge point directly hit by the sentence template). If it is greater than the supplement threshold, then directly supplement similar questions to the knowledge point.
[0216] a) Calculate the effective supplementary weight of the knowledge points in the sentence of the sentence template (LM) (EffectiveLM(LM, Knowledge)):
[0217] Weight calculation formula:
[0218] The number of times the template hits a single knowledge point (i.e., the count result of the first relevant counter mentioned above), ResponseCount(LM, Knowledge);
[0219] The total number of times the template hits the knowledge points (i.e., the count result of the first relevant total counter mentioned above), ResponseTotalCount(LM);
[0220] Template length (i.e., the character length mentioned above), Len(LM);
[0221] The effective supplementary weight formula for the template (i.e., the first supplementary weight mentioned above),
[0222]
[0223] b) If the weight is greater than the direct supplementation threshold (i.e. the first supplementation threshold mentioned above, preferably 2.5), then the sentence template and business words are directly replaced and added to the similar questions of the knowledge point and stored in the question-and-answer knowledge base.
[0224] c) Record that this template has been added to this knowledge point, and this template will no longer trigger the addition of similar questions to this knowledge point in the future.
[0225] 4. Supplementing similar questions related to relevant knowledge points: If this sentence matches the sentence template, calculate the relevance supplementation weight of the sentence template for multiple related knowledge points (knowledge points that the sentence template may be related to). If it is greater than the supplementation threshold, similar questions are supplemented to multiple related knowledge points after semantic legality verification.
[0226] a) Calculate the relevance supplement weight (RelativeEffectiveLM(LM,RelativeKnowledge)) between the sentence template (LM) and the related knowledge points (RelativeKnowledge[0..n]) to determine whether it can cover and supplement all similar problems of related knowledge points;
[0227] Weight calculation formula:
[0228] The cumulative number of times the template is triggered (i.e., the count result of the template counter mentioned above): TriggerCount(LM);
[0229] The number of times the template exceeds the relevant threshold (i.e., the count result of the second relevant total counter mentioned above), RelativeTotalCount(LM);
[0230] The template is for the number of times a single knowledge point exceeds the relevance threshold (i.e., the count result of the second relevance counter mentioned above), RelativeCount(LM, Knowledge);
[0231] The variance of the number of times the template exceeds the relevance threshold for each knowledge point (i.e., the variance of the current count result of the second relevance counter for each second relevance knowledge point mentioned above):
[0232]
[0233] The length of a single template, Len(LM);
[0234] Template relevance supplementary weight formula (i.e., the second supplementary weight mentioned above),
[0235]
[0236] b) If the relevance supplementation threshold (1) is greater than the threshold, fill in the business terms of each relevant knowledge point to generate alternative questions;
[0237] c) Iterate through all candidate questions and perform semantic validity checks;
[0238] i. The candidate corpus is processed through a general Chinese grammar check model (seq2seq+attention model) to identify grammatical errors. If the error exceeds the grammar error threshold (0.8), the candidate corpus is discarded.
[0239] The deep semantic similarity matching model is invoked to match the candidate corpus with similar questions of the target knowledge point. The similarity must be greater than the business relevance threshold (0.3), otherwise the candidate corpus is discarded.
[0240] d) Add the validated candidate corpora to the list of similar questions for the corresponding knowledge points and store them in the question-and-answer knowledge base;
[0241] e) Record that this template has been added to this knowledge point, and this template will no longer trigger the addition of similar questions to this knowledge point in the future.
[0242] It should be noted that although the operations are described in a specific order, this should not be interpreted as requiring these operations to be executed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.
[0243] It should be understood that the various steps described in the method embodiments disclosed in this application may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this application is not limited in this respect.
[0244] and Figure 1 Corresponding to the method described above, this application also provides a similar question generation apparatus for generating similar questions. Figure 1 The specific implementation of the method is shown in the following structural diagram. Figure 8 As shown, it specifically includes:
[0245] The first acquisition unit 801 is used to acquire user questions;
[0246] The search unit 802 is used to search for a first relevant knowledge point and a second relevant knowledge point of the user question from various knowledge points included in a preset question-and-answer knowledge base; wherein, the first relevant knowledge point is more relevant to the user question than the second relevant knowledge point is to the user question.
[0247] The extraction unit 803 is used to extract a sentence template of the user question based on the business words corresponding to the first relevant knowledge point if a first relevant knowledge point of the user question is found and the user question includes business words corresponding to the first relevant knowledge point, and to store the extracted sentence template in the cache if the extracted sentence template does not match the sentence template stored in the cache.
[0248] The generation unit 804 is used to generate similar questions for the first related knowledge point and similar questions for the second related knowledge point based on the various sentence templates stored in the cache, and to store the generated similar questions in the question-and-answer knowledge base.
[0249] The similar question generation device provided in this application, upon obtaining a user's question, searches for first and second relevant knowledge points from various knowledge points included in the question-and-answer knowledge base. It then extracts sentence templates for the user's question based on the business terms of the first relevant knowledge points and stores them in a cache, thus supplementing the cached sentence templates. Based on these cached sentence templates, it generates similar questions for the first and second relevant knowledge points and stores them in the question-and-answer knowledge base. This automatically supplements the similar questions for the first and second relevant knowledge points in the question-and-answer knowledge base, thereby increasing the number of similar questions in the knowledge base and ultimately improving the recall rate of subsequent response information.
[0250] In one embodiment of this application, based on the foregoing scheme, the lookup unit 802 is specifically used for:
[0251] Based on the user's question, a preset number of similar questions are retrieved from each similar question corresponding to each knowledge point in the preset question-and-answer knowledge base;
[0252] Calculate the relevance between the user's question and each retrieved similar question;
[0253] The maximum relevance is determined from the relevance between the user's question and each of the retrieved similar questions;
[0254] If the maximum relevance is greater than the first relevance threshold, then the knowledge point corresponding to the similar question corresponding to the maximum relevance is determined as the first relevant knowledge point;
[0255] If the maximum relevance is not greater than the first relevance threshold, then when the maximum relevance is greater than the second relevance threshold, the knowledge point corresponding to the similar question corresponding to the maximum relevance is determined as the second relevance knowledge point; wherein, the second relevance threshold is less than the first relevance threshold;
[0256] For each similar question retrieved, excluding the similar question corresponding to the maximum relevance, if the relevance between the similar question and the user's question is greater than the second relevance threshold, then the knowledge point corresponding to the similar question is determined as the second relevant knowledge point.
[0257] In one embodiment of this application, based on the foregoing scheme, when the generation unit 804 generates similar questions for the first related knowledge point and similar questions for the second related knowledge point based on the various sentence templates stored in the cache, it is specifically used for:
[0258] Iterate through each sentence template in the cache in sequence, and perform the first operation on each sentence template encountered in the iteration;
[0259] The first operation includes:
[0260] If the sentence template matches the user question, the template counter of the sentence template is incremented. If a first relevant knowledge point of the user question is found, a similar question for the first relevant knowledge point is generated based on the sentence template and the business words corresponding to the first relevant knowledge point. If a second relevant knowledge point of the user question is found, a candidate question for each second relevant knowledge point is generated based on the current count result of the template counter, the sentence template, and the business words corresponding to each second relevant knowledge point. For each candidate question, if the candidate question passes the semantic validity check, the candidate question is determined as a similar question for the corresponding second relevant knowledge point.
[0261] In one embodiment of this application, based on the foregoing scheme, the generation unit 804 generates similar questions for the first related knowledge point based on the sentence template and the preset business terms corresponding to the first related knowledge point, specifically for:
[0262] If there is no supplementary identification information for the sentence template regarding the first relevant knowledge point, then the first relevant counter for the sentence template regarding the first relevant knowledge point is incremented by one, and the first total relevant counter for the sentence template regarding all knowledge points is incremented by one; the supplementary identification information for the sentence template regarding the first relevant knowledge point is used to indicate that similar questions corresponding to the sentence template have been added to the first relevant knowledge point;
[0263] Based on the current count result of the first relevant counter, the current count result of the first relevant total counter, and the character length of the sentence template, calculate the first supplementary weight of the sentence template with respect to the first relevant knowledge point;
[0264] If the first supplementary weight is greater than the first supplementary threshold, then similar questions for the first related knowledge point are generated based on the sentence template and the preset business terms corresponding to the first related knowledge point.
[0265] In one embodiment of this application, based on the foregoing scheme, when generating alternative questions for each second related knowledge point based on the current counting result of the template counter, the sentence template, and the business terms corresponding to each second related knowledge point, the generation unit 804 is specifically used for:
[0266] If there is no supplementary identification information for each second related knowledge point in the sentence template, then the second related counter for each second related knowledge point in the sentence template is incremented by one, and the total second related counter for all knowledge points in the sentence template is incremented by one; the supplementary identification information for the second related knowledge point in the sentence template is used to indicate that similar questions corresponding to the sentence template have been added to the second related knowledge point;
[0267] The second supplementary weight is calculated based on the current count result of the second relevant counter for each second relevant knowledge point of the sentence template, the current count result of the second relevant total counter, the current count result of the template counter, and the character length of the sentence template;
[0268] If the second supplementary weight is greater than the second supplementary threshold, then based on the sentence template and the business terms corresponding to each second related knowledge point, alternative questions for each second related knowledge point are generated.
[0269] In one embodiment of this application, based on the foregoing scheme, when the generation unit 804 determines that the candidate question has passed the semantic validity check, it is specifically used for:
[0270] Using a pre-built syntax verification model, the candidate questions are subjected to syntax verification to obtain the syntax verification results of the candidate questions;
[0271] If the syntax verification result satisfies the preset verification rules, the relevance between the candidate questions and each target similar question is calculated; wherein, the target similar question is the similar question corresponding to the second relevant knowledge point of the preset candidate question;
[0272] If the relevance of the candidate question to each target similar question is greater than the second relevance threshold, then the candidate question is determined to have passed the semantic legality check.
[0273] In one embodiment of this application, based on the foregoing solution, it can also be configured as follows:
[0274] The first generation unit is used to generate supplementary identification information of the sentence template regarding the first relevant knowledge point, and to store the generated supplementary identification information;
[0275] The second generation unit is used to generate supplementary identification information of the sentence template regarding the second relevant knowledge point, and to store the generated supplementary identification information.
[0276] This application also provides a storage medium storing an instruction set, wherein, when the instruction set is executed, a similar problem generation method as disclosed in any of the above embodiments is performed.
[0277] This application also provides an electronic device, the structural schematic diagram of which is shown below. Figure 9 As shown, it specifically includes a memory 901 for storing at least one set of instructions; and a processor 902 for executing the set of instructions stored in the memory, thereby implementing the similar problem generation method disclosed in any of the embodiments above by executing the set of instructions.
[0278] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
[0279] While several specific implementation details are included in the foregoing discussion, these should not be construed as limiting the scope of the disclosure herein. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0280] The above description is merely a preferred embodiment disclosed in this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A method for generating similarity questions, characterized in that, include: Obtaining user questions; The system searches for a first relevant knowledge point and a second relevant knowledge point related to the user's question from various knowledge points included in a pre-defined question-and-answer knowledge base; wherein the first relevant knowledge point is more relevant to the user's question than the second relevant knowledge point is to the user's question. If a first relevant knowledge point is found for the user question, and the user question includes a business term corresponding to the first relevant knowledge point, then based on the business term of the first relevant knowledge point, a sentence template for the user question is extracted, and if the extracted sentence template does not match the sentence template stored in the cache, the extracted sentence template is stored in the cache. The process involves sequentially traversing each sentence template in the cache and performing a first operation on each encountered sentence template. The first operation includes: if the sentence template matches the user question, incrementing the template counter of the sentence template; if a first relevant knowledge point for the user question is found, generating a similar question for the first relevant knowledge point based on the sentence template and the corresponding business terms; if a second relevant knowledge point for the user question is found, generating candidate questions for each second relevant knowledge point based on the current count of the template counter, the sentence template, and the corresponding business terms; for each candidate question, if the candidate question passes semantic validity verification, determining the candidate question as a similar question for the corresponding second relevant knowledge point; and storing the generated similar questions in the question-answering knowledge base.
2. The method according to claim 1, characterized in that, The step of searching for the first and second relevant knowledge points of the user's question from the various knowledge points included in the preset question-and-answer knowledge base includes: Based on the user's question, a preset number of similar questions are retrieved from each similar question corresponding to each knowledge point in the preset question-and-answer knowledge base; Calculate the relevance between the user's question and each retrieved similar question; The maximum relevance is determined from the relevance between the user's question and each of the retrieved similar questions; If the maximum relevance is greater than the first relevance threshold, then the knowledge point corresponding to the similar question corresponding to the maximum relevance is determined as the first relevant knowledge point; If the maximum relevance is not greater than the first relevance threshold, then when the maximum relevance is greater than the second relevance threshold, the knowledge point corresponding to the similar question corresponding to the maximum relevance is determined as the second relevance knowledge point; wherein, the second relevance threshold is less than the first relevance threshold; For each similar question retrieved, excluding the similar question corresponding to the maximum relevance, if the relevance between the similar question and the user's question is greater than the second relevance threshold, then the knowledge point corresponding to the similar question is determined as the second relevant knowledge point.
3. The method according to claim 1, characterized in that, The step of generating similar questions for the first relevant knowledge point based on the sentence template and the business terms corresponding to the first relevant knowledge point includes: If there is no supplementary identification information for the sentence template regarding the first relevant knowledge point, then the first relevant counter for the sentence template regarding the first relevant knowledge point is incremented by one, and the first total relevant counter for the sentence template regarding all knowledge points is incremented by one; the supplementary identification information for the sentence template regarding the first relevant knowledge point is used to indicate that similar questions corresponding to the sentence template have been added to the first relevant knowledge point; Based on the current count result of the first relevant counter, the current count result of the first relevant total counter, and the character length of the sentence template, calculate the first supplementary weight of the sentence template with respect to the first relevant knowledge point; If the first supplementary weight is greater than the first supplementary threshold, then similar questions for the first related knowledge point are generated based on the sentence template and the preset business terms corresponding to the first related knowledge point.
4. The method according to claim 1, characterized in that, Based on the current count result of the template counter, the sentence template, and the business terms corresponding to each second related knowledge point, the candidate questions for each second related knowledge point are generated, including: If there is no supplementary identification information for each second related knowledge point in the sentence template, then the second related counter for each second related knowledge point in the sentence template is incremented by one, and the total second related counter for all knowledge points in the sentence template is incremented by one; the supplementary identification information for the second related knowledge point in the sentence template is used to indicate that similar questions corresponding to the sentence template have been added to the second related knowledge point; The second supplementary weight is calculated based on the current count result of the second relevant counter for each second relevant knowledge point of the sentence template, the current count result of the second relevant total counter, the current count result of the template counter, and the character length of the sentence template; If the second supplementary weight is greater than the second supplementary threshold, then based on the sentence template and the business terms corresponding to each second related knowledge point, alternative questions for each second related knowledge point are generated.
5. The method according to claim 1, characterized in that, The determination of the candidate questions through semantic validity verification includes: Using a pre-built syntax verification model, the candidate questions are subjected to syntax verification to obtain the syntax verification results of the candidate questions; If the syntax verification result satisfies the preset verification rules, the relevance between the candidate questions and each target similar question is calculated; wherein, the target similar question is the similar question corresponding to the second relevant knowledge point of the preset candidate question; If the relevance of the candidate question to each target similar question is greater than the second relevance threshold, then the candidate question is determined to have passed the semantic legality check.
6. The method according to claim 1, characterized in that, After generating similar questions for the first relevant knowledge point, the method further includes: Generate supplementary identification information for the sentence template regarding the first relevant knowledge point, and store the generated supplementary identification information; After determining the candidate questions as similar questions to the corresponding second relevant knowledge points, the method further includes: Generate supplementary identification information for the sentence template regarding the second relevant knowledge point, and store the generated supplementary identification information.
7. A similar problem generation device, characterized in that, include: The first acquisition unit is used to acquire user questions; The search unit is used to search for a first relevant knowledge point and a second relevant knowledge point of the user question from various knowledge points included in a preset question-and-answer knowledge base; wherein, the first relevant knowledge point is more relevant to the user question than the second relevant knowledge point is to the user question. The extraction unit is configured to, if a first relevant knowledge point of the user question is found, and the user question includes a business term corresponding to the first relevant knowledge point, extract a sentence template of the user question based on the business term of the first relevant knowledge point, and store the extracted sentence template in the cache if the extracted sentence template does not match the sentence template stored in the cache. A generation unit is configured to sequentially traverse each sentence template in the cache and perform a first operation on each traversed sentence template. The first operation includes: when the sentence template matches the user question, incrementing the template counter of the sentence template; if a first relevant knowledge point of the user question is found, generating a similar question for the first relevant knowledge point based on the sentence template and the business words corresponding to the first relevant knowledge point; if a second relevant knowledge point of the user question is found, generating a candidate question for each second relevant knowledge point based on the current count result of the template counter, the sentence template, and the business words corresponding to each second relevant knowledge point; for each candidate question, if it is determined that the candidate question passes the semantic validity check, identifying the candidate question as a similar question for the corresponding second relevant knowledge point; and storing the generated similar questions in the question-answering knowledge base.
8. A storage medium, characterized in that, The storage medium stores an instruction set, wherein the instruction set, when executed by a processor, implements the similar problem generation method as described in any one of claims 1-6.
9. An electronic device, characterized in that, include: Memory, used to store at least one set of instructions; A processor is configured to execute a set of instructions stored in the memory, thereby implementing the similar problem generation method as described in any one of claims 1-6.
Citation Information
Patent Citations
Method for expanding question and answer knowledge base, storage medium and terminal
CN110019304A
Response method and device, server and storage medium
CN111737425A