Intelligent dialogue method and device based on text matching and intent recognition fusion processing

By integrating Bi-LSTM and multilayer perceptron text matching and intent recognition models, the problem of non-standard user responses in robot follow-up systems was solved, improving the accuracy of semantic understanding and the intelligence of human-computer dialogue, and enhancing the service experience.

CN115238050BActive Publication Date: 2025-10-21BEIJING AIYISHENG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210734681.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2025-10-21
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

Existing chatbot response systems struggle to effectively integrate text matching and intent recognition when dealing with non-standard user responses, resulting in insufficient accuracy in semantic understanding.

Method used

We employ a text matching model and an intent recognition model based on Bi-LSTM and multilayer perceptron. Through fine-grained interaction and heuristic training, we fuse the text matching and intent recognition models and use the fusion output to select the appropriate model, thereby improving the semantic understanding accuracy of the question-answering process.

Benefits of technology

It improves the accuracy of semantic understanding during robot follow-up visits and the intelligence of the human-computer dialogue system, thereby enhancing the service experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115238050B_ABST
    Figure CN115238050B_ABST
Patent Text Reader

Abstract

The application discloses an intelligent dialogue method and device based on text matching and intention recognition fusion processing, and the method comprises the following steps: setting at least one intention recognition category, and acquiring an answer text for a current question; if the current question is a fill-in-the-blank question, intention recognition is performed by using an intention recognition model, and processing logic of a corresponding intention is entered; if the current question is a selection question, intention recognition model and text matching model are simultaneously used for fusion processing, a model is selected as an adaptive model according to a fusion output result, and judgment processing is performed by using the adaptive model. The application fuses the text matching model and the intention recognition model, improves the accuracy of semantic understanding in the question and answer process, and greatly improves the intelligence and service experience of the man-machine dialogue system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to natural language processing, and in particular to an intelligent dialogue method and device based on the fusion processing of text matching and intent recognition. The method aims to achieve more intelligent semantic understanding and dialogue logic control in a task-based human-computer dialogue system through a fusion model of text matching and intent recognition, and to be applied to various robot return dialogue tasks. Background Art

[0002] Text matching is one of the most fundamental tasks in the field of Natural Language Processing (NLP), widely used in specific tasks such as information retrieval and question-answering systems. Traditional text matching methods include determining similarity based on lexical overlap (such as edit distance) and learning relationships based on manually defined features. These methods have limited model representation capabilities and struggle to leverage truly effective information and features in the text. Deep learning methods are currently widely used in text matching tasks. Compared to traditional methods, deep text matching models can automatically extract effective features from text by learning from massive amounts of data, and then perform matching based on these features using different structural similarity calculations. Deep text matching far surpasses traditional methods in performance.

[0003] Intent recognition is a classification task that identifies a sentence as having a predetermined intent. Traditional intent recognition methods primarily rely on templates and statistical features, but are unable to handle non-standard text. Current deep learning methods, such as convolutional networks, extract text representations and offer higher performance.

[0004] Conducting follow-up interviews and questionnaire surveys with target audiences is a common requirement in many industry scenarios, such as satisfaction surveys in the service industry and follow-up on postoperative recovery in hospitals. Considering user experience, follow-up success rate, and service costs, AI robots are increasingly being used to make phone calls and conduct follow-up interviews through human-machine dialogue. Robot follow-up conversations are centered around a pre-set questionnaire, which typically consists of multiple-choice and fill-in-the-blank questions. Matching user responses to the correct options in the multiple-choice questions is a semantic matching problem. However, users often do not answer according to the pre-set questions. For example, when a user suddenly responds with phrases like "I don't have time right now, I'll talk to you later" or "I didn't hear you clearly, please say it again," the robot needs to identify the user's intent and initiate appropriate processing logic. Since it's impossible to predict whether each user's response is a response to a pre-set option or an expression of a specific intent, semantic understanding in robot follow-up conversations cannot be simply categorized as a text matching task. Fusion of text matching and intent recognition may improve processing accuracy, but to date, no relevant research has been conducted. Summary of the Invention

[0005] To solve the above problems, the present invention discloses an intelligent dialogue method based on text matching and intention recognition fusion processing, comprising the following steps:

[0006] Step S1: Set at least one intent recognition category and obtain the answer text for the current question;

[0007] Step S2: If the current question is a fill-in-the-blank question, the intent recognition model is used to perform intent recognition, and the intent recognition result of the answer text is output. If the intent recognition result does not belong to any intent recognition category, the answer text is stored and recorded; if the intent recognition result belongs to one of the intent recognition categories, the corresponding intent processing logic is entered;

[0008] If the current question is a multiple-choice question, the intent recognition model and the text matching model are fused together, and a model is selected as the adaptation model based on the fusion output result. The adaptation model is used to output the text matching similarity or the intent recognition result of the answer text. Based on the output text matching similarity, it is determined whether the current question has been answered, thereby determining whether to proceed to the next question. Alternatively, based on the output intent recognition result of the answer text, if it belongs to any intent recognition category, the processing logic of the corresponding intent is entered.

[0009] Optionally, the text matching model includes a first word embedding vector layer, a first Bi-LSTM module, a second Bi-LSTM module, a first pooling layer, a first multilayer perceptron, and a first softmax layer connected in sequence, and the second pooling layer and the comparison module are connected in sequence from the output branch of the first Bi-LSTM module. The process of training the text matching model is as follows:

[0010] Step S211: Obtain an annotated answer text and a preset option text library, wherein the preset option text library contains matching text and non-matching text for the question answer, wherein the answer text and the matching text constitute a first text pair, and the answer text and the non-matching text constitute a second text pair, and use the pre-trained first embedded word vector layer to perform word vector mapping on the answer text, the matching text, and the non-matching text to obtain corresponding embedded word vectors respectively;

[0011] Step S212: The embedded word vectors corresponding to the answer text, the matching text, and the unmatched text are each passed through the first Bi-LSTM module to obtain the corresponding first-layer hidden word vectors.

[0012] In step S213, the first hidden layer word vectors are input into the second pooling layer to obtain sentence representations. The comparison module calculates the vector similarity and positive example matching score of the sentence representations of the first text pair. The comparison module also calculates the vector similarity and negative example matching score of the sentence representations of the second text pair. The gradient of the comparison loss function is then returned to increase the positive example matching score and decrease the negative example matching score, thereby pre-optimizing the text matching model.

[0013] Step S214: Interact the first-layer hidden word vectors in the first text pair and the second text pair to obtain the second-layer hidden word vectors;

[0014] In step S215, the second-layer hidden word vector is input into the second Bi-LSTM module to obtain the third-layer hidden word vector, and the third-layer hidden word vector is input into the first pooling layer. The maximum pooling is performed to obtain the sentence representation. The first multi-layer perceptron calculates the vector similarity of the sentence representation of the first text pair and the second text pair respectively, and inputs the first softmax layer to output the probability value that the answer text belongs to the matching text, as well as the matching loss. Through continuous iteration, the matching loss is reduced to obtain a text matching model.

[0015] Optionally, the intent recognition model includes a second word embedding vector layer, a third Bi-LSTM module, a third pooling layer, a second multi-layer perceptron, and a second softmax layer.

[0016] The training process of the intent recognition model is:

[0017] Step S221: Input the label text and answer text in the intent label library into the second word embedding vector layer, the third Bi-LSTM module, and the third pooling layer in sequence to obtain sentence representations of the answer text and label text;

[0018] Step S222: Input the sentence representation of the answer text into the second multi-layer perceptron and the second softmax layer in sequence to obtain the classification result and classification loss, and calculate the similarity loss using the sentence representation of the label text and the sentence representation of the answer text;

[0019] In step S223, the gradient is returned to the classification loss and the similarity loss, and the trained intent recognition model is obtained through continuous iteration.

[0020] Optionally, the method of simultaneously fusing the intent recognition model and the text matching model and selecting a model as the adaptation model based on the fusion output result includes:

[0021] Step S21, initializing the scores of the intent recognition model and the text matching model;

[0022] Step S22: Use the following three methods to score the intent recognition model and the text matching model, and select the model with the highest score as the adaptation model. The three methods include:

[0023] Method A obtains the text matching credibility of the text matching model output result and the intent recognition credibility of the intent recognition model output result, compares them with the corresponding credibility thresholds, and outputs the corresponding bonus points of the text matching model and intent recognition model. If the text matching credibility is greater than the text matching credibility threshold and the intent recognition credibility is less than the intent recognition credibility threshold, the text matching model is given a bonus point sa; otherwise, the intent recognition model is given a bonus point sb.

[0024] Method B uses a third multi-layer perceptron to calculate the text representation change vector of the answer text in the text matching model after the first word vector embedding layer, the first Bi-LSTM module, and the second pooling layer output sentence representation, and the answer text in the intent recognition model after the second embedding word vector layer, the third Bi-LSTM module, and the third pooling layer output sentence representation, and the sentence representation of the answer text after the third word vector embedding output sentence representation. The two text representation change vectors are concatenated as a new feature vector, and the new feature vector is adapted to a binary classification of the text matching model or the intent recognition model, and the probability of the text matching model and the intent recognition model being applicable is output;

[0025] Method C concatenates the sentence representations of the text matching model and the intent recognition model to obtain a joint representation. A fourth multilayer perceptron is then used to perform binary classification on whether the adaptation model is the text matching model or the intent recognition model, outputting the hypothesized prior probabilities of the applicable text matching model and the intent recognition model.

[0026] The assumed prior probability of method C is processed with the output results of methods A and B in a weighted summation manner to obtain the final score of the text matching model and the final score of the intent recognition model.

[0027] Optionally, in method C, the joint representation and the question text are concatenated and input into the corresponding fifth multilayer perceptron and sixth multilayer perceptron respectively, thereby outputting two vectors, and the two vectors are weightedly fused using the assumed prior probability, and the vector obtained by the weighted fusion is binary classified to determine whether the text constitutes a question-answer relationship with the question, and the assumed prior probability is updated through gradient backpropagation and continuous iteration.

[0028] Optionally, the interaction between texts refers to calculating the cosine similarity between any word vector h in text A and all word vectors in text B and normalizing them as weights. All word vectors in text B are added according to this weight, and the obtained word vector is spliced ​​to the word vector h, and then restored to the original dimension using MLP, that is, a new h is obtained as the new representation of the word vector. All word vectors in text A and text B are operated in this way to complete all interactions between texts.

[0029] Optionally, when training a text matching model, the median of all similarity scores during the training process is taken as the text matching credibility threshold; when training an intent recognition model, the median of all probabilities corresponding to the intent recognition categories predicted during the training process is taken as the intent recognition credibility threshold;

[0030] Among them, sa is the similarity score output by the text matching model * 0.1, and sb is the predicted intent recognition category probability output by the intent recognition model * 0.1.

[0031] Optionally, the label text in the intent label library adopts heuristic textual labels, and by studying the training set data, a heuristic template corresponding to each category of unmatched text is obtained, and the heuristic template contains keywords of most data in the category.

[0032] The present invention also provides an intelligent dialogue device based on text matching and intention recognition fusion processing, comprising:

[0033] The question acquisition module sets at least one intent recognition category and obtains the answer text for the current question;

[0034] The question judgment module is used to use the intent recognition model to perform intent recognition if the current question is a fill-in-the-blank question, and output the intent recognition result of the answer text. If the intent recognition result does not belong to any intent recognition category, the answer text is stored and recorded; if the intent recognition result belongs to one of the intent recognition categories, the corresponding intent processing logic is entered;

[0035] If the current question is a multiple-choice question, the intent recognition model and the text matching model are fused together, and a model is selected as the adaptation model based on the fusion output result. The adaptation model is used to output the text matching similarity or the intent recognition result of the answer text. Based on the output text matching similarity, it is determined whether the current question has been answered, thereby determining whether to proceed to the next question. Alternatively, based on the output intent recognition result of the answer text, if it belongs to any intent recognition category, the corresponding intent processing logic is entered.

[0036] The text matching model includes a first word embedding vector layer, a first Bi-LSTM module, a second Bi-LSTM module, a first pooling layer, a first multilayer perceptron, and a first softmax layer connected in sequence, and the second pooling layer and the comparison module are connected in sequence from the output branch of the first Bi-LSTM module;

[0037] Among them, the intent recognition model includes the second word embedding vector layer, the third Bi-LSTM module, the third pooling layer, the second multi-layer perceptron and the second softmax layer.

[0038] Optionally, the method of simultaneously fusing the intent recognition model and the text matching model and selecting a model as the adaptation model based on the fusion output result includes:

[0039] Step S21, initializing the scores of the intent recognition model and the text matching model;

[0040] Step S22: Use the following three methods to score the intent recognition model and the text matching model, and select the model with the highest score as the adaptation model. The three methods include:

[0041] Method A obtains the text matching credibility of the text matching model output result and the intent recognition credibility of the intent recognition model output result, compares them with the corresponding credibility thresholds, and outputs the corresponding bonus points of the text matching model and intent recognition model. If the text matching credibility is greater than the text matching credibility threshold and the intent recognition credibility is less than the intent recognition credibility threshold, the text matching model is given a bonus point sa; otherwise, the intent recognition model is given a bonus point sb.

[0042] Method B uses a third multi-layer perceptron to calculate the text representation change vector of the answer text in the text matching model after the first word vector embedding layer, the first Bi-LSTM module, and the second pooling layer output sentence representation, and the answer text in the intent recognition model after the second embedding word vector layer, the third Bi-LSTM module, and the third pooling layer output sentence representation, and the sentence representation of the answer text after the third word vector embedding output sentence representation. The two text representation change vectors are concatenated as a new feature vector, and the new feature vector is adapted to a binary classification of the text matching model or the intent recognition model, and the probability of the text matching model and the intent recognition model being applicable is output;

[0043] Method C concatenates the sentence representations of the text matching model and the intent recognition model to obtain a joint representation. A fourth multilayer perceptron is then used to perform binary classification on whether the adaptation model is the text matching model or the intent recognition model, outputting the hypothesized prior probabilities of the applicable text matching model and the intent recognition model.

[0044] The assumed prior probability of method C is processed with the output results of methods A and B in a weighted summation manner to obtain the final score of the text matching model and the final score of the intent recognition model.

[0045] This invention addresses the problem of integrating text matching and intent recognition in the process of intelligent robot follow-up. For both subtasks, fine-grained interaction and heuristic methods are used to train a model with improved performance. Ultimately, the text matching model and intent recognition model are integrated to improve the accuracy of semantic understanding during the question-and-answer process, significantly enhancing the intelligence and service experience of the human-machine dialogue system. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 Schematic diagram of the text matching model framework according to an embodiment of the present invention;

[0047] Figure 2 Schematic diagram of the intent recognition model framework according to an embodiment of the present invention;

[0048] Figure 3 Schematic diagram of the fusion model framework of an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0050] The intelligent dialogue method based on text matching and intent recognition fusion processing of this embodiment includes the following steps:

[0051] Step S1: Set the intent recognition category and obtain the answer text for the question.

[0052] The intent recognition category refers to the determination of the intent recognition category for the answer text. In real-world data, the vast majority of answer texts are relevant to the question, with only a small portion being abnormal responses. For example, the intent recognition category could be "Need human customer service," "Contact only on weekends," or "Contact only on weekdays."

[0053] In step S2, if the question is a fill-in-the-blank question, that is, there is no preset reply option, the intent recognition model is used to perform intent recognition, and the output is the intent of the answer text. If the results of each intent recognition category are negative (that is, the intent of the answer text does not belong to any intent recognition category), the answer is directly filled in the record; if there is a positive intent recognition result in each intent recognition category (that is, the intent of the answer text belongs to one of the intent recognition categories), the processing logic of the corresponding intent is entered.

[0054] If the question is a multiple-choice question, that is, one with preset options, the intent recognition model and the text matching model are fused together, and a model is selected as the adaptation model based on the fusion output result. The adaptation model is used to output the similarity of text matching or the intent of the answer text.

[0055] The fill-in-the-blank and multiple-choice questions mentioned above are questions without pre-set options, such as "Have you used other products of this brand?" This is a fill-in-the-blank question, and the answer text should usually be "used", "No", etc. For example, "Have you used other products of this brand? A means used, and B means not used." This is a multiple-choice question with pre-set options, and the answer text should usually be A, B.

[0056] Among them, the intent recognition model and the text matching model are fused together, and a model is selected as the adaptation model based on the fusion output results, including:

[0057] Step S21 , initializing the scores of the intent recognition model and the text matching model, for example, setting the initial scores to 0.

[0058] Step S22: Use the following three methods to score the intent recognition model and the text matching model, and select the model with the highest score as the adaptation model. The three methods include:

[0059] Method A obtains the text matching credibility of the text matching model output and the intent recognition credibility of the intent recognition model output, and compares them with the corresponding credibility thresholds. If the text matching credibility is greater than the text matching credibility threshold and the intent recognition credibility is less than the intent recognition credibility threshold (note that each intent recognition category has a threshold, and the credibility of all categories must be less than the corresponding threshold), the text matching model score is increased by a certain value, sa. Otherwise, the intent recognition model score is increased by a certain value, sb.

[0060] The text matching credibility threshold and intent recognition credibility threshold are determined as follows: During model training, the credibility of each data point in the training set is recorded. The text matching credibility is the similarity score in the text matching task. The median of all similarity scores during the training process is taken as the text matching credibility threshold. The intent recognition credibility is the probability corresponding to the predicted category in the intent recognition task. The median of all probabilities corresponding to the predicted category during the training process is taken as the intent recognition credibility threshold.

[0061] Where sa is the similarity score output by the text matching model * 0.1, and sb is the predicted category probability output by the intent recognition model * 0.1. The predicted category refers to the category actually described in the training data.

[0062] Method B uses the third multi-layer perceptron to calculate the text representation change vector of the sentence representation output by the first word vector embedding layer, the first Bi-LSTM module, and the second pooling layer of the answer text in the text matching model, and the sentence representation output by the second embedding word vector layer, the third Bi-LSTM module, and the third pooling layer of the answer text in the intent recognition model, and the sentence representation output by the third word vector embedding. That is, the text representation change vector of the sentence representation of the text matching model and the original sentence representation is obtained, and the text representation change vector of the sentence representation of the intent recognition model and the original sentence representation is obtained. The two text representation change vectors are spliced ​​as a new feature vector, and the new feature vector is subjected to a binary classification of whether the adaptation model is a text matching model or an intent recognition model to determine whether the text matching model or the intent recognition model is applicable, and the output probability is added to the text matching model score and the intent recognition model score respectively.

[0063] Method C directly concatenates the sentence representations of the text matching model and the intent recognition model to obtain a joint representation, and uses the fourth multi-layer perceptron to perform binary classification of whether the adaptation model is a text matching model or an intent recognition model, to determine whether the text matching model or the intent recognition model is applicable, and uses this classification result as the assumed prior probability.

[0064] The assumed prior probability of method C is weighted and summed with the results of methods A and B to obtain the final scores for the text matching model and the intent recognition model. The final scores are used to determine whether the answer text is suitable for the text matching model or the intent recognition model.

[0065] Preferably, in method C, the joint representation and the question text are concatenated and fed into the corresponding fifth and sixth multilayer perceptrons, respectively, to output two vectors. These two vectors are then weighted and fused using an assumed prior probability. The resulting weighted fusion vector is then subjected to a binary classification to determine whether the text and the question form a question-answer relationship. Through gradient backpropagation and continuous iteration, this assumed prior probability gradually becomes more accurate.

[0066] For the binary classification task of determining whether a text forms a question-answer relationship with the question, specifically, the binary classification result can be set to 0 if it does not form a question-answer relationship with the question, and 1 if it does. The specific judgment is based on the annotations of the answer text during training. If the answer text is annotated with an unusual intent, it is considered not to form a question-answer relationship with the question; otherwise, it is considered to form a question-answer relationship. Because the original task did not include the "binary classification of whether it forms a question-answer relationship" task, but was newly constructed here, there is no labeled data. Therefore, the annotations of the answer text are used as the annotations for this binary classification task. The annotations of the answer text can only be [unusual intent] or [match], so they can be used as category labels for the newly created binary classification task.

[0067] Step S3, based on the similarity of the text matching output by the text matching model, determines whether the current question has been answered, thereby moving on to the next question, or performing corresponding processing according to the intent category identified by the intent recognition model.

[0068] The following describes the structure and training methods of the text matching model and intent recognition model.

[0069] The text matching model includes a first word embedding vector layer, a first Bi-LSTM module, a second Bi-LSTM module, a first pooling layer, a first multi-layer perceptron and a first softmax layer connected in sequence, and preferably, a branch is connected from the back of the first Bi-LSTM module to the second pooling layer and a comparison module (such as softmax).

[0070] The process of training the text matching model is as follows:

[0071] Step S211: Obtain the answer text and a preset option text library. The answer text is the text of the answer to the robot's question. The preset option text library contains the matching text and non-matching text for all the robot's question answers. Use the pre-trained embedded word vector layer to perform word vector mapping on all texts (including the answer text, matching text, and non-matching text) to obtain the hidden layer word vector. The pre-trained embedded word vector layer uses the open source pre-trained model bert-base-chinese, whose pre-training methods include MLM (occluded word prediction) and NSP (predict the next sentence).

[0072] The matching text refers to the normal response to the robot's questions. For example, if the robot asks "Are you satisfied with this product?", the matching text is "satisfied" or "unsatisfied". The unmatched text can be sentences other than the matching text that have nothing to do with the answer text, such as "Who are you?" and "I don't have time now."

[0073] In step S212, the answer text, matching text, and unmatched text are each passed through the first Bi-LSTM module separately to obtain the first layer of hidden word vectors. This process is called intra-text interaction.

[0074] In step S214, the answer text and the matching text are combined into a first text pair, and the answer text and the unmatched text are combined into a second text pair. The first-layer hidden word vectors of each pair of texts are subjected to inter-text interaction to obtain the second-layer hidden word vectors. Inter-text interaction means that, for example, for two texts A and B, a word vector h in text A is calculated with all word vectors in text B for cosine similarity and normalized. The result is used as a weight. All word vectors in text B are added according to this weight. The resulting word vector is then concatenated into h and restored to its original dimension using MLP. This new h is obtained as the new representation of the word vector. The other word vectors in texts A and B are also operated in this way, completing all inter-text interactions.

[0075] In step S215, the second-layer hidden word vectors obtained after the interaction between the texts are input into the second Bi-LSTM module to obtain the third-layer hidden word vectors. The third-layer hidden word vectors are input into the first pooling layer, where they are max-pooled to obtain sentence representations. The first multi-layer perceptron then calculates the vector similarity of the sentence representations for the first and second text pairs. This is then input into the first softmax layer to output the probability that the answer text is a matching text, as well as the matching loss. Through continuous iteration, the matching loss is reduced to obtain a text matching model.

[0076] Preferably, there is also step S213, in which the first layer of hidden word vectors is also input into the second pooling layer, and the maximum pooling is performed to obtain the sentence representation, and the vector similarity of the sentence representation of the first text pair and the positive example matching score are calculated by the comparison module. The vector similarity of the sentence representation of the second text pair and the negative example matching score are calculated by the comparison module, and the gradient of the contrast loss function is returned to increase the positive example matching score and reduce the negative example matching score, and the text matching model is pre-optimized. Specifically, for example, the vectors of the sentence representations of the answer text, the matching text, and the unmatched text are E1, E2, and E3 respectively, then the positive and negative example contrast loss is -cos(E1, E2) / ((cos(E1, E2)+cos(E1, E3)). When the gradient is returned, the loss is reduced, that is, cos(E1, E2) is increased and cos(E1, E3) is reduced. If there are multiple unmatched texts, they are all calculated with the answer text after the cosine similarity is added to the denominator.

[0077] Among them, the intent recognition model includes the second word embedding vector layer, the third Bi-LSTM module, the third pooling layer, the second multi-layer perceptron and the second softmax layer.

[0078] The training process of the intent recognition model is:

[0079] In step S221, the label text and answer text in the intent label library are input into the second embedding word vector layer, the third Bi-LSTM module, and the third pooling layer in sequence to obtain the sentence representation of the answer text and the label text.

[0080] In actual data, the vast majority of answers are relevant to the question, and only a very small number are abnormal replies, resulting in extremely unbalanced training data. In order to alleviate the dependence on data scale and balance during model training, this embodiment adopts heuristic textual labels, that is, by studying the training set data, a heuristic template corresponding to each category of abnormal answers (i.e., mismatched text) is obtained. The heuristic template can contain the keywords of most data in this category, and one or more typical sentences can be manually selected as heuristic templates in each work. For example: One of the categories in the intent category is "need manual customer service", which is an intention determined by analyzing data such as "Are you manual or a robot? I want to talk to a person", "Are you a computer or a real person", etc. Therefore, the template for the category "need manual customer service" can be defined as "Are you manual or a machine?", which contains the keywords of this category.

[0081] It's important to note that for the "Need human customer service" category, you can simply use "Are you a human or a machine?" as the heuristic template. However, for some categories, the data may be fragmented, so multiple typical sentences may be needed as heuristic templates. For example, if the data for the "Need human customer service" category is fragmented, you can use multiple sentences containing keywords as heuristic templates. Of course, some data may not fit the template, but experiments have shown that performance improves as long as the template is similar to the majority of data. When training the model, for example, if the current data has intent A (i.e., belongs to category A), if the category A template consists of only one typical sentence, a Bi-LSTM network is used to obtain the textual representation of the category A template. If the category A template consists of multiple typical sentences, a Bi-LSTM network is used to obtain the textual representation of all the typical sentences and then average them to obtain the textual representation of the template.

[0082] In step S222, the similarity loss is calculated using the sentence representation of the label text and the sentence representation of the answer text. By adjusting the model parameters to narrow the cosine similarity between the label text and the answer text, the similarity loss is obtained, which is called heuristic loss.

[0083] And preferably, the answer text is also input into the second multi-layer perceptron and the second softmax layer to obtain the classification result and classification loss. By adjusting the parameters, the answer text classification is made more accurate, thereby more quickly and efficiently narrowing the cosine similarity between the label text and the answer text.

[0084] In step S223, the gradient is returned to the classification loss and the similarity loss, and the trained intent recognition model is obtained through continuous iteration.

[0085] It should be noted that the above-mentioned word vector embedding layer, Bi-LSTM module, pooling layer, multi-layer perceptron, the first and second softmax layers, etc., are only used to distinguish the expressions and are not used to indicate their differences.

[0086] The present invention also provides an intelligent dialogue device based on text matching and intention recognition fusion processing, comprising:

[0087] The question acquisition module sets at least one intent recognition category and obtains the answer text for the current question;

[0088] The question judgment module is used to use the intent recognition model to perform intent recognition if the current question is a fill-in-the-blank question, and output the intent recognition result of the answer text. If the intent recognition result does not belong to any intent recognition category, the answer text is stored and recorded; if the intent recognition result belongs to one of the intent recognition categories, the corresponding intent processing logic is entered;

[0089] If the current question is a multiple-choice question, the intent recognition model and the text matching model are fused together, and a model is selected as the adaptation model based on the fusion output result. The adaptation model is used to output the text matching similarity or the intent recognition result of the answer text. Based on the output text matching similarity, it is determined whether the current question has been answered, thereby determining whether to proceed to the next question. Alternatively, based on the output intent recognition result of the answer text, if it belongs to any intent recognition category, the corresponding intent processing logic is entered.

[0090] The text matching model includes a first word embedding vector layer, a first Bi-LSTM module, a second Bi-LSTM module, a first pooling layer, a first multilayer perceptron, and a first softmax layer connected in sequence, and the second pooling layer and the comparison module are connected in sequence from the output branch of the first Bi-LSTM module;

[0091] Among them, the intent recognition model includes the second word embedding vector layer, the third Bi-LSTM module, the third pooling layer, the second multi-layer perceptron and the second softmax layer.

[0092] Furthermore, the method of simultaneously fusing the intent recognition model and the text matching model and selecting a model as the adaptation model based on the fusion output result includes:

[0093] Step S21, initializing the scores of the intent recognition model and the text matching model;

[0094] In step S22, the adaptation model is a binary classification of a text matching model or an intent recognition model using the following three methods, and the model with the highest score is selected as the adaptation model. The three methods include:

[0095] Method A obtains the text matching credibility of the text matching model output result and the intent recognition credibility of the intent recognition model output result, compares them with the corresponding credibility thresholds, and outputs the corresponding bonus points of the text matching model and intent recognition model. If the text matching credibility is greater than the text matching credibility threshold and the intent recognition credibility is less than the intent recognition credibility threshold, the text matching model is given a bonus point sa; otherwise, the intent recognition model is given a bonus point sb.

[0096] Method B uses a third multi-layer perceptron to calculate the text representation change vector of the answer text in the text matching model after the first word vector embedding layer, the first Bi-LSTM module, and the second pooling layer output sentence representation, and the answer text in the intent recognition model after the second embedding word vector layer, the third Bi-LSTM module, and the third pooling layer output sentence representation, and the sentence representation of the answer text after the third word vector embedding output sentence representation. The two text representation change vectors are concatenated as a new feature vector, and the new feature vector is adapted to a binary classification of the text matching model or the intent recognition model, and the probability of the text matching model and the intent recognition model being applicable is output;

[0097] Method C concatenates the sentence representations of the text matching model and the intent recognition model to obtain a joint representation, and uses the fourth multi-layer perceptron for binary classification, outputting the hypothesized prior probabilities applicable to the text matching model and the intent recognition model;

[0098] The assumed prior probability of method C is processed with the output results of methods A and B in a weighted summation manner to obtain the final score of the text matching model and the final score of the intent recognition model.

[0099] Of course, the present invention may have many other embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art may make various corresponding changes and modifications based on the present invention, but these corresponding changes and modifications shall fall within the scope of protection of the claims of the present invention.

Claims

1. An intelligent dialogue method based on text matching and intention recognition fusion processing, characterized in that: The following steps are involved: Step S1: Set at least one intent recognition category and obtain the answer text for the current question; Step S2: If the current question is a fill-in-the-blank question, the intent recognition model is used to perform intent recognition, and the intent recognition result of the answer text is output. If the intent recognition result does not belong to any intent recognition category, the answer text is stored and recorded; If the intent recognition result belongs to one of the intent recognition categories, then enter the processing logic of the corresponding intent; If the current question is a multiple-choice question, the intent recognition model and the text matching model are fused together, and a model is selected as the adaptation model based on the fusion output result. The adaptation model is used to output the text matching similarity or the intent recognition result of the answer text. Based on the output text matching similarity, it is determined whether the current question has been answered, thereby determining whether to proceed to the next question. Alternatively, based on the output intent recognition result of the answer text, if it belongs to any intent recognition category, the corresponding intent processing logic is entered. The method of simultaneously fusing the intent recognition model and the text matching model and selecting a model as the adaptation model based on the fusion output result includes: Step S21, initializing the scores of the intent recognition model and the text matching model; Step S22: Use the following three methods to score the intent recognition model and the text matching model, and select the model with the highest score as the adaptation model. The three methods include: Method A obtains the text matching credibility of the text matching model output result and the intent recognition credibility of the intent recognition model output result, compares them with the corresponding credibility thresholds, and outputs the corresponding bonus points of the text matching model and intent recognition model. If the text matching credibility is greater than the text matching credibility threshold and the intent recognition credibility is less than the intent recognition credibility threshold, the text matching model is given a bonus point sa; otherwise, the intent recognition model is given a bonus point sb. Method B uses a third multi-layer perceptron to calculate the text representation change vector of the answer text in the text matching model after the first word vector embedding layer, the first Bi-LSTM module, and the second pooling layer output sentence representation, and the answer text in the intent recognition model after the second embedding word vector layer, the third Bi-LSTM module, and the third pooling layer output sentence representation, and the sentence representation of the answer text after the third word vector embedding output sentence representation. The two text representation change vectors are concatenated as a new feature vector, and the new feature vector is adapted to a binary classification of the text matching model or the intent recognition model, and the probability of the text matching model and the intent recognition model being applicable is output; Method C concatenates the sentence representations of the text matching model and the intent recognition model to obtain a joint representation. A fourth multilayer perceptron is then used to perform binary classification on whether the adaptation model is the text matching model or the intent recognition model, outputting the hypothesized prior probabilities of the applicable text matching model and the intent recognition model. The assumed prior probability of method C is processed with the output results of methods A and B in a weighted summation manner to obtain the final score of the text matching model and the final score of the intent recognition model.

2. The intelligent dialogue method based on text matching and intention recognition fusion processing according to claim 1 is characterized in that: The text matching model includes a first word embedding vector layer, a first Bi-LSTM module, a second Bi-LSTM module, a first pooling layer, a first multilayer perceptron, and a first softmax layer connected in sequence. In addition, the second pooling layer and the comparison module are connected in sequence from the output branch of the first Bi-LSTM module. The process of training the text matching model is as follows: Step S211: Obtain an annotated answer text and a preset option text library, wherein the preset option text library contains matching text and non-matching text for the question answer, wherein the answer text and the matching text constitute a first text pair, and the answer text and the non-matching text constitute a second text pair, and use the pre-trained first embedded word vector layer to perform word vector mapping on the answer text, the matching text, and the non-matching text to obtain corresponding embedded word vectors respectively; Step S212: The embedded word vectors corresponding to the answer text, the matching text, and the unmatched text are each passed through the first Bi-LSTM module to obtain the corresponding first-layer hidden word vectors. In step S213, the first hidden layer word vectors are input into the second pooling layer to obtain sentence representations. The comparison module calculates the vector similarity and positive example matching score of the sentence representations of the first text pair. The comparison module also calculates the vector similarity and negative example matching score of the sentence representations of the second text pair. The gradient of the comparison loss function is then returned to increase the positive example matching score and decrease the negative example matching score, thereby pre-optimizing the text matching model. Step S214: Interact the first-layer hidden word vectors in the first text pair and the second text pair to obtain the second-layer hidden word vectors; In step S215, the second-layer hidden word vector is input into the second Bi-LSTM module to obtain the third-layer hidden word vector, and the third-layer hidden word vector is input into the first pooling layer. The maximum pooling is performed to obtain the sentence representation. The first multi-layer perceptron calculates the vector similarity of the sentence representation of the first text pair and the second text pair respectively, and inputs the first softmax layer to output the probability value that the answer text belongs to the matching text, as well as the matching loss. Through continuous iteration, the matching loss is reduced to obtain a text matching model.

3. The intelligent dialogue method based on text matching and intention recognition fusion processing according to claim 2 is characterized in that: The intent recognition model includes the second word embedding vector layer, the third Bi-LSTM module, the third pooling layer, the second multi-layer perceptron and the second softmax layer. The training process of the intent recognition model is: Step S221: Input the label text and answer text in the intent label library into the second word embedding vector layer, the third Bi-LSTM module, and the third pooling layer in sequence to obtain sentence representations of the answer text and label text; Step S222: Input the sentence representation of the answer text into the second multi-layer perceptron and the second softmax layer in sequence to obtain the classification result and classification loss, and calculate the similarity loss using the sentence representation of the label text and the sentence representation of the answer text; In step S223, the gradient is returned to the classification loss and the similarity loss, and the trained intent recognition model is obtained through continuous iteration.

4. The intelligent dialogue method based on text matching and intention recognition fusion processing according to claim 1 is characterized in that: In method C, the joint representation and the question text are concatenated and input into the corresponding fifth and sixth multilayer perceptrons, respectively, to output two vectors. The two vectors are weighted fused using the assumed prior probability, and the vector obtained by the weighted fusion is binary classified to determine whether the text forms a question-answer relationship with the question. The assumed prior probability is updated through gradient backpropagation and continuous iteration.

5. The intelligent dialogue method based on text matching and intention recognition fusion processing according to claim 2 is characterized in that: The inter-text interaction refers to calculating the cosine similarity between any word vector h in text A and all word vectors in text B and normalizing them as weights. All word vectors in text B are added according to this weight, and the resulting word vector is concatenated to the word vector h. The MLP is then used to restore the original dimension, that is, the new h is obtained as the new representation of the word vector. All word vectors in text A and text B are operated in this way to complete all inter-text interactions.

6. The intelligent dialogue method based on text matching and intention recognition fusion processing according to claim 5 is characterized in that: When training the text matching model, the median of all similarity scores during the training process is used as the text matching confidence threshold. When training the intent recognition model, the median of all probabilities corresponding to the intent recognition categories predicted during the training process is used as the intent recognition confidence threshold. Among them, sa is the similarity score output by the text matching model 0.1, sb is the predicted intent recognition category probability output by the intent recognition model 0.

1.

7. The intelligent dialogue method based on text matching and intention recognition fusion processing according to claim 3 is characterized in that: The label texts in the intent label library adopt heuristic textual labels. By studying the training set data, a heuristic template corresponding to each category of unmatched text is obtained. The heuristic template contains keywords for most data in the category.

8. An intelligent dialogue device based on text matching and intention recognition fusion processing, characterized in that: include: The question acquisition module sets at least one intent recognition category and obtains the answer text for the current question; A question determination module is configured to, if the current question is a fill-in-the-blank question, perform intent recognition using an intent recognition model, output an intent recognition result of the answer text, and store and record the answer text if the intent recognition result does not belong to any intent recognition category; If the intent recognition result belongs to one of the intent recognition categories, then enter the processing logic of the corresponding intent; If the current question is a multiple-choice question, the intent recognition model and the text matching model are fused together, and a model is selected as the adaptation model based on the fusion output result. The adaptation model is used to output the text matching similarity or the intent recognition result of the answer text. Based on the output text matching similarity, it is determined whether the current question has been answered, thereby determining whether to proceed to the next question. Alternatively, based on the output intent recognition result of the answer text, if it belongs to any intent recognition category, the corresponding intent processing logic is entered. The text matching model includes a first word embedding vector layer, a first Bi-LSTM module, a second Bi-LSTM module, a first pooling layer, a first multilayer perceptron, and a first softmax layer connected in sequence, and the second pooling layer and the comparison module are connected in sequence from the output branch of the first Bi-LSTM module; The intent recognition model includes the second word embedding vector layer, the third Bi-LSTM module, the third pooling layer, the second multi-layer perceptron and the second softmax layer. The method of simultaneously fusing the intent recognition model and the text matching model and selecting a model as the adaptation model based on the fusion output result includes: Step S21, initializing the scores of the intent recognition model and the text matching model; Step S22: Use the following three methods to score the intent recognition model and the text matching model, and select the model with the highest score as the adaptation model. The three methods include: Method A obtains the text matching credibility of the text matching model output result and the intent recognition credibility of the intent recognition model output result, compares them with the corresponding credibility thresholds, and outputs the corresponding bonus points of the text matching model and intent recognition model. If the text matching credibility is greater than the text matching credibility threshold and the intent recognition credibility is less than the intent recognition credibility threshold, the text matching model is given a bonus point sa; otherwise, the intent recognition model is given a bonus point sb. Method B uses a third multi-layer perceptron to calculate the text representation change vector of the answer text in the text matching model after the first word vector embedding layer, the first Bi-LSTM module, and the second pooling layer output sentence representation, and the answer text in the intent recognition model after the second embedding word vector layer, the third Bi-LSTM module, and the third pooling layer output sentence representation, and the sentence representation of the answer text after the third word vector embedding output sentence representation. The two text representation change vectors are concatenated as a new feature vector, and the new feature vector is adapted to a binary classification of the text matching model or the intent recognition model, and the probability of the text matching model and the intent recognition model being applicable is output; Method C concatenates the sentence representations of the text matching model and the intent recognition model to obtain a joint representation. A fourth multilayer perceptron is then used to perform binary classification on whether the adaptation model is the text matching model or the intent recognition model, outputting the hypothesized prior probabilities of the applicable text matching model and the intent recognition model. The assumed prior probability of method C is processed with the output results of methods A and B in a weighted summation manner to obtain the final score of the text matching model and the final score of the intent recognition model.

Citation Information

Patent Citations

  • Text feature extraction method, device, chat robot and storage medium based on fusion model

    CN109508377A

  • Intention identification method and device based on text classification, equipment and storage medium

    CN110147445A