A method and device for generating an intention knowledge base

By generating and testing intention rule clusters, the problem of manual configuration of intention knowledge base construction in the intelligent question-and-answer system is solved, and efficient and accurate intention knowledge base generation and maintenance are achieved.

CN111753554BActive Publication Date: 2025-02-07WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010595059.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-28
Publication Date
2025-02-07
Estimated Expiration
2040-06-28

AI Technical Summary

Technical Problem

In the existing intelligent question and answer system, the construction of the intention knowledge base requires manual configuration, resulting in large workload, increased complexity, difficulty in maintaining, and low accuracy of identification of new intention rules.

Method used

The rules that will eventually be added to the intent rules cluster to be joined and test it by generating each set of rules in the intent rules cluster to be added to the intent knowledge base. This method includes sample enhancement, word segmentation, intent rule generation and automated testing to ensure the optimality of new intent rule and high recognition accuracy.

Benefits of technology

The need for manual direct participation in the update and optimization of the intent knowledge base reduces the degree of manual intervention, improves the accuracy of the identification of new intent rules, and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111753554B_ABST
    Figure CN111753554B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of financial technology (Fintech), and discloses a method and device for generating an intent knowledge base, the method comprising: generating an intent rule cluster to be added according to an intent sample to be added; performing a test of adding the intent knowledge base for at least one rule group in the intent rule cluster, and adding the rule group to the intent knowledge base when the test requirements are met; the present invention generates an intent rule cluster to be added, and adds each group of rules in the intent rule cluster to be added that meet the test requirements to the intent knowledge base, thereby solving the problem that the construction of the intent knowledge base requires manual configuration and a large workload, and humans do not directly participate in the updating and optimization of the intent knowledge base, reducing the degree of human intervention and liberating human maintenance costs. At the same time, it also ensures that the newly added intent rules are optimal, thereby improving the recognition accuracy of the newly added intent rules.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular to a method and device for generating an intent knowledge base. Background Art

[0002] With the development of computer technology, more and more technologies (such as distributed architecture, cloud computing or big data) are applied in the financial field. The traditional financial industry is gradually transforming into financial technology, and big data technology is no exception. However, due to the security and real-time requirements of the financial and payment industries, higher requirements are also placed on big data technology.

[0003] In the existing intelligent question-answering system, for each round of interaction between the question-answering robot and the user, it is necessary to identify the corresponding intention based on the user's conversation text, and then search and select different speech templates to respond based on the corresponding intention. In the process of identifying the intention based on the text of the user's speech, there are currently three commonly used methods:

[0004] 1. Construction of semantic intent knowledge base;

[0005] 2. Implementation of text intent classification model;

[0006] 3. Construction of text semantic similarity model.

[0007] For the construction of the semantic intent knowledge base, the existing intent rule generation requires manual configuration. On the one hand, the workload is large and the degree of manual intervention is high. On the other hand, as the complexity of the recognized intent increases, it will become very difficult to manually configure intent rules in batches, test and maintain the semantic intent knowledge base. If a new rule set that is the same or similar to the existing rules is added, the knowledge base will become more redundant and complicated, thus falling into a vicious cycle that is even more difficult to maintain.

[0008] In addition, after generating intent rules, it is necessary to manually test whether the new rules are accurate, whether the addition of new rules affects the recognition of existing rules, etc. It is difficult to achieve comprehensive coverage of manual testing of intent recognition, the testing process lacks automation, and the process from testing to the final function launch is long. At the same time, there is no guarantee that the newly added intent rules are optimal, resulting in low recognition accuracy of the newly added intent rules. Summary of the invention

[0009] The present application provides a method and device for generating an intent knowledge base, so as to solve the problem of how to generate an intent knowledge base accurately and efficiently without manual work.

[0010] In a first aspect, an embodiment of the present application provides a method for generating an intent knowledge base, the method comprising:

[0011] Generate an intent rule cluster to be added according to the intent sample to be added; the intent rule cluster includes multiple rule groups for the same intent to be added, wherein each rule group includes at least one intent rule;

[0012] For at least one rule group in the intent rule cluster, a test of adding the intent knowledge base is performed, and when the test requirements are met, the rule group is added to the intent knowledge base; wherein the test of adding the intent knowledge base includes:

[0013] In the testing phase, the rule group is added to the intention knowledge base to obtain a test intention knowledge base;

[0014] The first test result of the first test sample set and the second test result of the second test sample set are determined respectively through the test intention knowledge base; the first test sample set is tested for the existing intentions in the intention knowledge base; the second test sample set is tested for the intentions to be added in the test intention knowledge base; the first test result and the second test result are used to determine whether the test requirements are met.

[0015] The above solution can solve the problem of manual configuration and heavy workload in the construction of intent knowledge base by generating the intent rule cluster to be added and adding each group of rules in the intent rule cluster to the intent knowledge base for testing to determine the rules that will be finally added to the intent knowledge base. Humans are not directly involved in the update and optimization of the intent knowledge base, which reduces the degree of human intervention and liberates the cost of human maintenance. At the same time, it also ensures that the newly added intent rules are optimal, thereby improving the recognition accuracy of the newly added intent rules.

[0016] Optionally, when all rule groups in the intent rule cluster do not meet the test requirements, the intent rules in the intent rule cluster are regrouped to obtain new rule groups, and at least one rule group in the intent rule cluster is returned to execute the test step of adding the intent knowledge base.

[0017] The above solution, by redividing the intent rule cluster when all rule groups do not meet the requirements, adds new intent rules while ensuring that the newly added intent rules are optimal and that the maximum coverage of test intent recognition is correct.

[0018] Optionally, based on the intent sample to be added, generate an intent rule cluster to be added, including:

[0019] Performing sample enhancement on the intended sample to be added to obtain an enhanced sample; each intended sample and each enhanced sample corresponds to a rule group respectively;

[0020] For each sample, the sample is segmented, and the intention rule corresponding to each segmented word is determined; the sample includes an intention sample and an enhanced sample.

[0021] The above scheme increases the number of newly added intent rules by performing sample enhancement on intent samples, thereby ensuring the accuracy of the intent rules finally added to the intent knowledge base.

[0022] Optionally, performing sample enhancement on the intent sample to be added includes:

[0023] The intent sample to be added is enhanced by a supervised data enhancement method and an unsupervised data enhancement method, wherein the supervised data enhancement method includes at least one of the following: sentence rewriting, sentence back translation and synonym replacement.

[0024] The above scheme performs supervised data enhancement through sentence rewriting, sentence back translation and synonym replacement, which enriches the tested intent rules and improves the accuracy of the intent rules finally added to the intent knowledge base.

[0025] Optionally, the meeting of test requirements includes:

[0026] Determine that the semantic recognition accuracy in the second test result is not less than the semantic recognition accuracy in the first test result, and the semantic recognition recall rate in the second test result is not less than the semantic recognition recall rate in the first test result.

[0027] The above scheme can efficiently generate intent rules that meet the requirements by presetting test requirements, thereby improving the efficiency of intent knowledge base generation.

[0028] Optionally, determining the first test result of the first test sample set and the second test result of the second test sample set respectively through the test intention knowledge base includes:

[0029] For any sample in the first test sample set or the second test sample set, determine the matching intent of the test sample through the test intention knowledge base; determine the matching degree corresponding to the test sample according to the matching intent and the marking intention of the test sample; determine the test result of the test sample set according to the matching degree of multiple test samples.

[0030] The above scheme determines the matching degree corresponding to the test sample according to the matching intent and the marking intent of the test sample, thereby ensuring the accuracy of the intent rule matching the intent ID.

[0031] In a second aspect, an embodiment of the present application provides a method for identifying a conversation intention, the method comprising:

[0032] Get the text to be recognized in the conversation;

[0033] Determining the intent of the text to be recognized through an intent knowledge base; the intent knowledge base is constructed through the above-mentioned intent knowledge base generation method;

[0034] According to the intention of the text to be recognized, a response text of the text to be recognized is determined.

[0035] The above solution introduces the middleware of intent knowledge base, and adopts the reverse thinking approach to match the user's conversation text intent ID through intent rules, and then retrieves the final answer speech template based on the intent ID. In the multi-round conversation process, the intent ID can be matched and identified based on the intention rules of the user's conversation text. The corresponding speech template and conversation process can be easily retrieved and called from the intent knowledge base to respond to customers' questions and answers in a timely and correct manner.

[0036] In a third aspect, an embodiment of the present application provides a device for generating an intent knowledge base, the device comprising:

[0037] A generating module, used to generate a rule cluster of the intent to be added according to the intent sample to be added; the intent rule cluster includes multiple rule groups for the same intent to be added, wherein each rule group includes at least one intent rule;

[0038] A processing module is used to perform a test of adding an intent knowledge base to at least one rule group in the intent rule cluster, and add the rule group to the intent knowledge base when the test requirements are met; wherein the test of adding the intent knowledge base includes: in the test phase, adding the rule group to the intent knowledge base to obtain a test intent knowledge base; through the test intent knowledge base, determining a first test result of a first test sample set and a second test result of a second test sample set respectively; the first test sample set is a test for an existing intent in the intent knowledge base; the second test sample set is a test for the intent to be added in the test intent knowledge base; the first test result and the second test result are used to determine whether the test requirements are met.

[0039] Optionally, the processing module is also used to: when all rule groups in the intent rule cluster do not meet the test requirements, regroup the intent rules in the intent rule cluster to obtain new rule groups, return at least one rule group in the intent rule cluster, and execute the test step of adding the intent knowledge base.

[0040] Optionally, the generating module is specifically used for:

[0041] Performing sample enhancement on the intended sample to be added to obtain an enhanced sample; each intended sample and each enhanced sample corresponds to a rule group respectively;

[0042] For each sample, the sample is segmented, and the intention rule corresponding to each segmented word is determined; the sample includes an intention sample and an enhanced sample.

[0043] Optionally, the processing module is specifically used for:

[0044] The intent sample to be added is enhanced by a supervised data enhancement method and an unsupervised data enhancement method, wherein the supervised data enhancement method includes at least one of the following: sentence rewriting, sentence back translation and synonym replacement.

[0045] Optionally, the processing module is specifically used for:

[0046] Determine that the semantic recognition accuracy in the second test result is not less than the semantic recognition accuracy in the first test result, and the semantic recognition recall rate in the second test result is not less than the semantic recognition recall rate in the first test result.

[0047] Optionally, the processing module is specifically used for:

[0048] For any sample in the first test sample set or the second test sample set, determine the matching intent of the test sample through the test intention knowledge base; determine the matching degree corresponding to the test sample according to the matching intent and the marking intention of the test sample; determine the test result of the test sample set according to the matching degree of multiple test samples.

[0049] In a fourth aspect, an embodiment of the present application provides a device for identifying a conversation intention, the device comprising:

[0050] An acquisition module is used to acquire the text to be recognized in the conversation;

[0051] A processing module is used to determine the intent of the text to be recognized through an intent knowledge base; the intent knowledge base is constructed through the above-mentioned intent knowledge base generation method; and determine the response text of the text to be recognized based on the intent of the text to be recognized.

[0052] Accordingly, an embodiment of the present invention further provides a computing device, including:

[0053] A memory for storing program instructions;

[0054] The processor is used to call the program instructions stored in the memory and execute the method for generating the above-mentioned intention knowledge base according to the obtained program.

[0055] Correspondingly, an embodiment of the present invention further provides a computer-readable non-volatile storage medium, including computer-readable instructions. When a computer reads and executes the computer-readable instructions, the computer executes the method for generating the above-mentioned intention knowledge base. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments 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.

[0057] Figure 1 A system framework for a method for generating an intention knowledge base provided by an embodiment of the present invention;

[0058] Figure 2 A schematic diagram of a flow chart of a method for generating an intention knowledge base provided by an embodiment of the present invention;

[0059] Figure 3 A schematic diagram of a flow chart of a method for generating an intention knowledge base provided by an embodiment of the present invention;

[0060] Figure 4 A flowchart of a method for identifying conversation intention provided by an embodiment of the present invention;

[0061] Figure 5 A schematic diagram of the structure of a device for generating an intention knowledge base provided by an embodiment of the present invention;

[0062] Figure 6 A schematic diagram of the structure of a device for identifying conversation intention provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all 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.

[0064] First, some terms in the present application are explained so as to be understood by those skilled in the art.

[0065] Genetic Algorithm (GA): It is a computational model of biological evolution that simulates the natural selection and Mendel genetics mechanisms in the theory of evolution. It is a method of searching for the optimal solution by simulating the natural evolution process.

[0066] AIML (Artificial Intelligence Markup Language): AIML is often used in the construction of the knowledge base of intelligent question-answering robots. AIML is essentially an XML format for defining rules for matching patterns and determining responses. In the human-computer dialogue process of intelligent question-answering robots, it is possible to match and identify the user's intention based on the content of the dialogue text, and then respond with the corresponding speech process, and conduct multiple rounds of interactive dialogue with the user.

[0067] Intent knowledge base: In the intelligent question-answering system, there are multiple text expressions under one intent. The intent knowledge base stores a large number of corresponding mapping relationships between "intent-text expressions", which are represented as mapped and structured data for easy query. The intent knowledge base requires that different text expressions under the same intent must have the same semantics.

[0068] Based on this, the embodiment of the present invention provides a method for generating an intention knowledge base. The method for generating an intention knowledge base provided by the embodiment of the present invention can be applied to Figure 1 In the system architecture shown, the system architecture includes an intent rule generator 100 , an intent rule trainer 200 , and an intent knowledge base 300 .

[0069] The intention rule generator 100 generates an intention rule cluster to be added according to the intention sample to be added;

[0070] The intent rule trainer 200 performs a test of adding at least one rule group in the intent rule cluster to the intent knowledge base 300, and adds the rule group to the intent knowledge base 300 when the test requirements are met.

[0071] Based on the system architecture shown above, Figure 2 A flowchart corresponding to a method for generating an intention knowledge base provided in an embodiment of the present invention is shown in FIG. Figure 2 As shown, the method includes:

[0072] Step 201, generating an intent rule cluster to be added according to the intent sample to be added.

[0073] It should be noted that the intent rule cluster includes multiple rule groups for the same intent to be added, wherein each rule group includes at least one intent rule.

[0074] Step 202, for at least one rule group in the intent rule cluster, perform a test of adding the rule group to the intent knowledge base, and when the test requirements are met, add the rule group to the intent knowledge base;

[0075] In the embodiment of the present application, the test of adding the intention knowledge base is as follows: Figure 3 As shown:

[0076] Step 301, in the testing phase, adding the rule group to the intent knowledge base to obtain a test intent knowledge base;

[0077] Step 302, determining a first test result of the first test sample set and a second test result of the second test sample set respectively through a test intention knowledge base;

[0078] It should be noted that the first test sample set is for testing existing intents in the intent knowledge base; the second test sample set is for testing intents to be added to the test intent knowledge base; the first test results and the second test results are used to determine whether the test requirements are met.

[0079] The above solution can solve the problem of manual configuration and heavy workload in the construction of intent knowledge base by generating the intent rule cluster to be added and adding each group of rules in the intent rule cluster to the intent knowledge base for testing to determine the rules that will be finally added to the intent knowledge base. Humans are not directly involved in the update and optimization of the intent knowledge base, which reduces the degree of human intervention and liberates the cost of human maintenance. At the same time, it also ensures that the newly added intent rules are optimal, thereby improving the recognition accuracy of the newly added intent rules.

[0080] The method for generating an intention knowledge base provided by the present invention can generate a large number of text expressions through data enhancement based on a small amount of input text expressions.

[0081] Specifically, in step 201, sample enhancement is performed on the intended sample to be added to obtain an enhanced sample.

[0082] Furthermore, the sample enhancement for the intent sample to be added may be: enhancing the intent sample to be added by supervised data enhancement and unsupervised data enhancement, wherein the supervised data enhancement includes at least one of the following: sentence rewriting, sentence back translation and synonym replacement.

[0083] That is to say, for a small number of manually entered intent samples, data enhancement of text expression can be performed based on supervised data enhancement methods such as text syntactic analysis / sentence rewriting, back translation, and synonym replacement, as well as using Google's open source UDA unsupervised data enhancement framework.

[0084] Here are some supervised data enhancement methods:

[0085] 1. Based on syntactic analysis and sentence components, the text sentence structure of the intent sample is rewritten and compressed to generate text with the same semantics.

[0086] For example, it can be done by compressing the main body of the sentence, such as simplifying it to subject, predicate and object, or by rewriting the sentence structure, such as placing the attributive or adverbial modifier before, after or inverting it.

[0087] For example, if we input the intent sample "I am very happy today", the dependency syntax analysis is "I (subject) today (time adverbial) very (adverbial) happy (core phrase)", and the result is as follows:

[0088] The first type, sentence trunk compression generates synonymous sentence text data, the result is: "I am happy", "I am very happy";

[0089] The second type, sentence rewriting to generate synonymous sentence text data results are: "I am very happy today", "I am very happy today", "I am very happy today".

[0090] 2. Back translation: Use machine translation to translate a Chinese passage into another language such as English, French or German, and then translate it back into Chinese. Back translation can often obtain text expressions with the same semantics. The back translation method can often increase the diversity of text data. Compared with replacing words, it can sometimes change the syntactic structure and retain semantic information.

[0091] For example, the input intent sample "I am very happy today" is as follows:

[0092] The first one is machine translation into English as "I had a great day", and then the English sentence is translated back into Chinese as "I had a great day today".

[0093] The second method is to machine translate it into French as "Je suis heureux aujourd'hui", and then translate this French sentence back into Chinese as "I had a great day".

[0094] The third type, machine translation into Japanese is Then translate this Japanese sentence back into Chinese as "I had a very happy day today."

[0095] 3. Synonym replacement, that is, replacing one or more phrases in the text expression of the intent sample with their synonyms, for example: replacing the phrase "okay" with "can", replacing the phrase "seems" with "seems", etc.

[0096] After the above supervised data enhancement, the recognition accuracy statistics before and after data enhancement are shown in Table 1:

[0097] Table 1

[0098]

[0099] Furthermore, each intent sample and each enhanced sample corresponds to a rule group respectively; for each sample, the sample is segmented, and the intent rule corresponding to each segmented word is determined.

[0100] It should be noted that the samples include intention samples and enhanced samples.

[0101] The above content will enhance the sample word segmentation, that is, add "*" before and after the single phrase to generate the intent rule cluster, and finally use the genetic algorithm GA's preferential selection characteristics to solve it. In each generation of generated AIML rules, the elite individuals are selected, that is, the optimal AIML rule set that satisfies the fitness function is output as the final result.

[0102] It should be noted that in the genetic algorithm, an AIML rule, which is a single phrase with * before and after, represents a gene of an individual; multiple genes, which is a set of AIML rules, represent a single individual; and multiple individuals, which is multiple sets of AIML rules, represent a population.

[0103] The following is a detailed introduction through examples:

[0104] For example, the enhanced samples are “I am very happy today”, “I had a great time today”, “I had a happy day”, and “I had a very happy day today”, and then they are segmented and AIML rules are generated.

[0105] Specifically, taking "I am very happy today" as an example, after word segmentation, it becomes "I / today / very / happy", and then an intent rule group is generated based on this intent sample, which contains 5 rules, namely:

[0106] (1) I; *I; I*; *I*;

[0107] (2) today; *today; today*; *today*;

[0108] (3) very; *very; very*; *very*;

[0109] (4) happy; *happy; happy*; *happy*;

[0110] (5) *I am *very* happy today*;

[0111] Furthermore, in step 302, for any sample in the first test sample set or the second test sample set, the matching intent of the test sample is determined through the test intent knowledge base; the matching degree corresponding to the test sample is determined based on the matching intent and the marking intention of the test sample; and the test result of the test sample set is determined based on the matching degree of multiple test samples.

[0112] For example, before the intent samples to be added are added, the intent knowledge base contains 3 intents, as follows:

[0113] 1. Intention Figure 1 :The customer asks about the freight price, and the corresponding intent ID is R1; after data enhancement, the enhanced samples are "How much is your price", "How do you calculate the freight", "How much is it from A to B"; the intent rule cluster is: price*how much; *price*how much; price*how much*; *price*how much*; freight*calculate; *freight*calculate; freight*calculate*; *freight*calculate*; how much; *how much; how much*; *how much*;

[0114] 2. Intention Figure 2 : The customer inquires about logistics timeliness, and the corresponding intent ID is R2; after data enhancement, the enhanced samples are “How long does it take for you to get from A to B?”, “When can it arrive?”, “How many days does it usually take?”; the intent rule clusters are: How long; *How long; How long*; *How long*; When* will it arrive; *When* will it arrive; When* will* arrive*; *When* will* arrive*; How many days will it arrive; *How many days will it arrive; How many days will it arrive*; *How many days will it arrive*;

[0115] 3. Meaning Figure 3 :The customer asks when to pick up the package, and the corresponding intent ID is R3; after data enhancement, the enhanced samples are "When will you pick up the goods", "When will you pick up the package", and "What time will you pick up the package"; the intent rule cluster is: When to pick up; *When to pick up; When to pick up*; *When to pick up*; What time* to pick up; *What time* to pick up; What time* to pick up*; *What time* to pick up*;

[0116] On this basis, add the following two intentions:

[0117] 1. Intention Figure 4 : The customer asks about the air freight price, and the corresponding intent ID is R4; after data enhancement, the enhanced samples "How much is the air freight" and "What is the price of air freight" are obtained;

[0118] 2. Intention Figure 5 : The customer wants to cancel the shipment, and the corresponding intent ID is R5. After data enhancement, the enhanced samples are "I will not ship" and "Cancel it".

[0119] Among them, for Figure 4 , after word segmentation, they are "how much is your air freight" and "how much is the price of air freight". The intention rules generated are: air freight; *air freight; air freight*; *air freight*; air* freight; *air* freight; air* freight*; *air* freight*; air* freight*; air price; *air price; air price*; *air price*; air* price; *air* price; *air* price; air* price*; *air* price; air* price*; *air* price*;

[0120] From the above content, it can be seen that in the test intention knowledge base, namely R1, R2, R3, R4, and R5, the matching intentions of the test sample "How much is the air freight" are R1 and R4, and the matching intentions of the test sample "How much is the price of air freight" are R1 and R4.

[0121] Similarly, for Figure 5 , after word segmentation, they are “I / will not send / ” and “you / cancel / ”, and the intention rules generated are: don’t send; *don’t send; don’t send*; *don’t send*; cancel; *cancel; cancel*; *cancel*;

[0122] From the above content, it can be seen that in the test intention knowledge base, namely R1, R2, R3, R4, and R5, the matching intention of the test sample "I won't send it" is R5, and the matching intention of the test sample "Please cancel it" is R5.

[0123] Furthermore, in step 202 of the present application embodiment, the test requirements are met as follows:

[0124] Determine that the semantic recognition accuracy in the second test result is not less than the semantic recognition accuracy in the first test result, and that the semantic recognition recall rate in the second test result is not less than the semantic recognition recall rate in the first test result.

[0125] In a possible implementation, whether the test requirements are met can be determined by whether the fitness function is met. The definition of the fitness function (objective function) F(m) is as follows:

[0126]

[0127]

[0128]

[0129] Specifically, the recognition accuracy and recall rate of the intent knowledge base are evaluated on two parts: the intent knowledge base before the newly generated intent rules are added and the test intent knowledge base (after the newly generated intent rules are added).

[0130] It should be noted that the intent knowledge base corresponds to the existing data set D. Assuming that the recognition accuracy of the intent knowledge base tested with the existing data set D is 99%, and the recall rate is also 99%; then in each round of iterative training, the recognition accuracy of the intent knowledge base tested on the data set D needs to be greater than or equal to 99%, and the recall rate also needs to be greater than or equal to 99%.

[0131] In the embodiment of the present application, the test data of the test intention knowledge base consists of two parts: a newly generated data set, namely the second test sample set E, and an existing data set, namely the first test sample set D; the newly generated data set E is an enhanced sample set after data enhancement.

[0132] Specifically, the specific calculation steps of the fitness function during iterative training are as follows:

[0133] Assume that the generated intent rule cluster is: 10 AIML rule groups, that is, 10 individuals a1~a10, a total of 100 intent rules, that is, 100 genes. On average, a group of 10 intent rules is 1 individual and 10 genes.

[0134] Furthermore, the 10 AIML rule groups a1 to a10 are respectively added to the intent knowledge base to obtain the test intent knowledge base; then the first test sample set D and the second test sample set E are used to test the recognition accuracy A(E) and A(D), and the recall rate R(E) and R(D) of the test intent recognition library respectively.

[0135] Finally, if A(x) and R(x) are both greater than the set recognition accuracy threshold v, then the group of AIML rules an meets the conditions and can be added to the intent knowledge base later. Otherwise, an is eliminated.

[0136] Based on the above example, in the test intent knowledge base, namely R1, R2, R3, R4, and R5, there are a total of 13 sentences. The semantic recognition accuracy and semantic recognition recall are calculated as follows:

[0137] 1. The semantic recognition accuracy of the first test result is: 9 / 9=100%.

[0138] It should be noted that the existing 9 sentences will be matched in R1~R5. If the newly added R4~R5 are recognized, they will be counted as errors. For example, if the first sentence "What is your price" is recognized by both R1 and R4, the accuracy rate is: 8 / 9.

[0139] 2. The semantic recognition recall rate of the first test result is: 9 / 9=100%.

[0140] It should be noted that the existing 9 sentences will be matched in R1~R5. If the newly added R4~R5 are recognized, points will be deducted. For example, assuming that the first sentence "What is your price" is recognized by both R1 and R4, and R1 is correct, the recall rate is: [(1 / 2)+8] / 9.

[0141] 3. The recognition accuracy of the newly generated intention rule, that is, the semantic recognition accuracy of the second test result, is: 2 / 4=50%.

[0142] It can be seen from the above content that if the recognition accuracy threshold of the newly generated intent rule is set to 90%, the newly generated intent rule is eliminated because 50% is lower than 90%.

[0143] In an embodiment of the present application, when all rule groups in the intent rule cluster do not meet the test requirements, the intent rules in the intent rule cluster are regrouped to obtain new rule groups, and at least one rule group in the intent rule cluster is returned to execute the test step of adding the intent knowledge base.

[0144] From the above content, it can be seen that if all groups a1~a10 are eliminated in one round of iteration, they are redivided, 100 intention rules (100 genes) are disrupted, and the genes are recombined to obtain b1~b10.

[0145] The above solution, by redividing the intent rule cluster when all rule groups do not meet the requirements, adds new intent rules while ensuring that the newly added intent rules are optimal and that the maximum coverage of test intent recognition is correct.

[0146] In the embodiment of the present application, after each round of iterative recognition accuracy test, when the optimal intent rule is serialized and added to the intent knowledge base, three performance indicators are also batch-regressed and tested, as follows:

[0147] 1. Recognition accuracy of the intent knowledge base (before adding the newly generated intent rules): Assuming that the existing data set D has 10 dialogue texts, if all 10 dialogue texts can be matched and recognized with the correct intent ID, the recognition accuracy is 100%. If the correct intent ID is recognized for 8 dialogue texts, the recognition accuracy is 80%. The recall rate can be calculated by counting the number of correct texts recognized under the same intent ID.

[0148] 2. Test the recognition accuracy of the intent knowledge base (after adding the newly generated intent rules): It is divided into two parts: the recognition accuracy and recall of the newly generated data set E, and the recognition accuracy and recall of the existing data set D. The specific test calculation process is the same as the above calculation and will not be repeated here.

[0149] 3. Compare the recognition accuracy and recall rate of the two versions of the intent knowledge base. If the conditions are met, it can be added to the intent knowledge base.

[0150] Furthermore, after passing the batch regression test, it will be added to the intent knowledge base. The specific format is shown in Table 2. For example, to add the "C" intent, first manually configure the intent sample of the "C" intent, and then perform data enhancement to train the optimal intent rules. After passing the batch regression test, it is updated and loaded into the intent knowledge base.

[0151] Table 2

[0152]

[0153] Based on the above content, the present invention provides a method for identifying conversation intentions, such as Figure 4 As shown, the method includes:

[0154] Step 401, obtaining the text to be recognized in the conversation.

[0155] Step 402: Determine the intent of the text to be recognized through the intent knowledge base.

[0156] It should be noted that the intent knowledge base is constructed through the above-mentioned intent knowledge base generation method.

[0157] Step 403: Determine the response text of the text to be recognized according to the intention of the text to be recognized.

[0158] The above solution introduces the middleware of intent knowledge base, and adopts the reverse thinking approach to match the user's conversation text intent ID through intent rules, and then retrieves the final answer speech template based on the intent ID. In the multi-round conversation process, the intent ID can be matched and identified based on the intention rules of the user's conversation text. The corresponding speech template and conversation process can be easily retrieved and called from the intent knowledge base to respond to customers' questions and answers in a timely and correct manner.

[0159] It should be noted that the genetic algorithm in this application is an algorithm for computer simulation research on biological systems. This algorithm imitates the random global search and optimization solution process developed by the biological evolution mechanism in nature. When solving more complex combinatorial optimization problems, it can usually obtain better optimization results faster than some conventional optimization algorithms. It can also be other search and optimization algorithms, such as dynamic programming (Dynamic Programming) and other algorithms, which are not specifically limited in this application.

[0160] Based on the same inventive concept, Figure 5 An apparatus for generating an intent knowledge base provided by an embodiment of the present invention is exemplarily shown, and the apparatus may be a process for generating an intent knowledge base.

[0161] The device comprises:

[0162] A generating module 501 is used to generate a rule cluster of intent to be added according to the intent sample to be added; the intent rule cluster includes multiple rule groups for the same intent to be added, wherein each rule group includes at least one intent rule;

[0163] Processing module 502 is used to perform a test of adding an intent knowledge base to at least one rule group in the intent rule cluster, and add the rule group to the intent knowledge base when the test requirements are met; wherein the test of adding the intent knowledge base includes: in the test phase, adding the rule group to the intent knowledge base to obtain a test intent knowledge base; through the test intent knowledge base, determining a first test result of a first test sample set and a second test result of a second test sample set respectively; the first test sample set is a test for an existing intent in the intent knowledge base; the second test sample set is a test for the intent to be added in the test intent knowledge base; the first test result and the second test result are used to determine whether the test requirements are met.

[0164] Optionally, the processing module 502 is also used to: when all rule groups in the intent rule cluster do not meet the test requirements, regroup the intent rules in the intent rule cluster to obtain new rule groups, return at least one rule group in the intent rule cluster, and execute the test step of adding the intent knowledge base.

[0165] Optionally, the generating module 501 is specifically used for:

[0166] Performing sample enhancement on the intended sample to be added to obtain an enhanced sample; each intended sample and each enhanced sample corresponds to a rule group respectively;

[0167] For each sample, the sample is segmented, and the intention rule corresponding to each segmented word is determined; the sample includes an intention sample and an enhanced sample.

[0168] Optionally, the processing module 502 is specifically configured to:

[0169] The intent sample to be added is enhanced by a supervised data enhancement method and an unsupervised data enhancement method, wherein the supervised data enhancement method includes at least one of the following: sentence rewriting, sentence back translation and synonym replacement.

[0170] Optionally, the processing module 502 is specifically configured to:

[0171] Determine that the semantic recognition accuracy in the second test result is not less than the semantic recognition accuracy in the first test result, and the semantic recognition recall rate in the second test result is not less than the semantic recognition recall rate in the first test result.

[0172] Optionally, the processing module 502 is specifically configured to:

[0173] For any sample in the first test sample set or the second test sample set, determine the matching intent of the test sample through the test intention knowledge base; determine the matching degree corresponding to the test sample according to the matching intent and the marking intention of the test sample; determine the test result of the test sample set according to the matching degree of multiple test samples.

[0174] Based on the same inventive concept, Figure 6 An apparatus for identifying a conversation intention provided by an embodiment of the present invention is exemplarily shown, and the apparatus may be a process for identifying a conversation intention.

[0175] The device comprises:

[0176] An acquisition module 601 is used to acquire text to be recognized in a conversation;

[0177] Processing module 602 is used to determine the intent of the text to be recognized through an intent knowledge base; the intent knowledge base is constructed through the above-mentioned intent knowledge base generation method; and determine the response text of the text to be recognized based on the intent of the text to be recognized.

[0178] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0179] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0180] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0181] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0182] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for generating an intention knowledge base, characterized in that: The method comprises: Generate an intent rule cluster to be added according to the intent sample to be added; the intent rule cluster includes multiple rule groups for the same intent to be added, wherein each rule group includes at least one intent rule; For at least one rule group in the intent rule cluster, a test of adding the intent knowledge base is performed, and when the test requirements are met, the rule group is added to the intent knowledge base; wherein the test of adding the intent knowledge base includes: In the testing phase, the rule group is added to the intention knowledge base to obtain a test intention knowledge base; Through the test intention knowledge base, a first test result of a first test sample set and a second test result of a second test sample set are determined respectively; the first test sample set is a test for an existing intention in the intention knowledge base; the second test sample set is a test for the intention to be added in the test intention knowledge base; the first test result and the second test result are used to determine whether the test requirements are met; The generating of the intent rule cluster to be added according to the intent sample to be added includes: Performing sample enhancement on the intended sample to be added to obtain an enhanced sample; each intended sample and each enhanced sample corresponds to a rule group respectively; For each sample, the sample is segmented and the intention rule corresponding to each segmented word is determined; the sample includes an intention sample and an enhanced sample; Among them, the word segmentation of the enhanced samples includes: adding * before and after the single phrase to generate an intent rule cluster, using the genetic algorithm GA's preferential selection characteristics to solve it, and in each generation of generated AIML rules, selecting the optimal AIML rule set that meets the fitness function as the final result output.

2. The method according to claim 1, characterized in that When all rule groups in the intent rule cluster do not meet the test requirements, the intent rules in the intent rule cluster are regrouped to obtain new rule groups, and at least one rule group in the intent rule cluster is returned to execute the test step of adding the intent knowledge base.

3. The method according to claim 2, characterized in that Performing sample enhancement on the intent sample to be added includes: The intent sample to be added is enhanced by a supervised data enhancement method and an unsupervised data enhancement method, wherein the supervised data enhancement method includes at least one of the following: sentence rewriting, sentence back translation and synonym replacement.

4. The method according to any one of claims 1 to 3, characterized in that The test requirements are met, including: Determine that the semantic recognition accuracy in the second test result is not less than the semantic recognition accuracy in the first test result, and the semantic recognition recall rate in the second test result is not less than the semantic recognition recall rate in the first test result.

5. The method according to claim 1, characterized in that Determining a first test result of a first test sample set and a second test result of a second test sample set respectively through the test intention knowledge base includes: For any sample in the first test sample set or the second test sample set, determine the matching intent of the test sample through the test intention knowledge base; determine the matching degree corresponding to the test sample according to the matching intent and the marking intention of the test sample; determine the test result of the test sample set according to the matching degree of multiple test samples.

6. A method for identifying conversation intention, characterized in that: include: Get the text to be recognized in the conversation; Determining the intent of the text to be recognized through an intent knowledge base; The intention knowledge base is constructed by any method as claimed in claims 1 to 5; According to the intention of the text to be recognized, a response text of the text to be recognized is determined.

7. A device for generating an intention knowledge base, characterized in that: include: A generation module, used to generate an intent rule cluster to be added according to the intent sample to be added; The intent rule cluster includes multiple rule groups for the same intent to be added, wherein each rule group includes at least one intent rule; A processing module, used to perform a test of adding an intent knowledge base to at least one rule group in the intent rule cluster, and add the rule group to the intent knowledge base when the test requirements are met; wherein the test of adding the intent knowledge base includes: in the test phase, adding the rule group to the intent knowledge base to obtain a test intent knowledge base; through the test intent knowledge base, respectively determining a first test result of a first test sample set and a second test result of a second test sample set; the first test sample set is a test for an existing intent in the intent knowledge base; the second test sample set is a test for the intent to be added in the test intent knowledge base; the first test result and the second test result are used to determine whether the test requirements are met; The generating module is further used to perform sample enhancement on the intention sample to be added to obtain an enhanced sample; each intention sample and each enhanced sample corresponds to a rule group respectively; For each sample, the sample is segmented and the intention rule corresponding to each segmented word is determined; the sample includes an intention sample and an enhanced sample; Among them, when the generation module performs word segmentation on the enhanced samples, it is specifically used to add * before and after a single phrase to generate an intent rule cluster, and use the genetic algorithm GA's preferential selection characteristics to solve it. In each generation of generated AIML rules, the optimal AIML rule set that meets the fitness function is selected as the final result output.

8. A computing device, characterized in that include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 6 according to the obtained program.

9. A computer-readable non-volatile storage medium, characterized in that: The method comprises computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the computer is caused to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Knowledge base establishment method and apparatus

    CN108121722A

  • Data retrieval method and device based on intention understanding, equipment and storage medium

    CN110019713A