Task-oriented 1+n based multi-turn dialogue method and system
By introducing domain classification and previous turn intent recognition models into a task-oriented multi-turn dialogue system, and using TextCNN and bidirectional LSTM-CRF models to process natural language, the correctness problem of multi-turn dialogue systems is solved, achieving efficient user interaction experience and accurate dialogue responses.
Patent Information
- Application Number
- CN202211317437.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-26
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2042-10-26
AI Technical Summary
Existing task-oriented multi-turn dialogue systems lack domain classification and previous turn intent recognition models, resulting in insufficient dialogue accuracy and user interaction experience.
We employ a task-oriented dialogue domain classification model and a previous-turn intent recognition model. We use TextCNN and bidirectional LSTM-CRF models for text vectorization to identify the domain, intent, and slots. We combine this with a chatter source service for responses to ensure the correctness and performance of multi-turn dialogues.
It improved the accuracy of domain recognition and intent recognition to 99.2%, with a response time within 10ms and a slot semantic filling accuracy of 92.3%, thus enhancing the user interaction experience and the performance of the dialogue system.
Smart Images

Figure CN115525753B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence interaction, in particular, to a task-oriented 1+N-based multi-turn dialogue method and system. BACKGROUND
[0002] Natural language is the crystallization of human wisdom. It is the expectation of people to interact with computers in the form of natural language for a long time. With the development of natural language processing technology and the rise of deep learning methods, human-computer dialogue system has become a new research hotspot. Human-computer dialogue system can be divided into task-oriented dialogue system, casual dialogue system and question and answer dialogue system according to function. Task-oriented dialogue system is a typical human-computer dialogue system, which aims to help users complete some specific tasks, and has very important research significance and application value. Natural language is the main tool for people to express emotions and ideas, and is an important carrier of human thinking. The most common natural language application scenario is dialogue. People hope to control machines through natural language, and even realize the dialogue and communication between machines and humans. Using natural language as the medium of input and output will enable users to obtain a more natural and friendly human-computer interaction experience, thereby providing convenient services for human life. With the vigorous development of artificial intelligence technology in recent years, the realization of dialogue system based on natural language has gradually become one of the popular researches in the field of artificial intelligence, and has been highly valued and widely concerned by the industry and academia.
[0003] Patent document CN108228764A (application number: CN201711440063.9) discloses a single-turn dialogue and multi-turn dialogue fusion method, characterized by: the steps include: S01), obtaining multi-modal input information input by a user; S02), performing entity information extraction and structured slicing processing on the input information to obtain structured text information; S03), extracting user intent based on the structured text information; S04), fusing a single-turn dialogue system and a multi-turn dialogue system based on historical information, structured text information and user intent, and adaptively judging to generate a dialogue mode conforming to the real intent of the user; S05), constructing a dialogue scene based on the user intent and the dialogue mode to obtain structured guiding questions or answers; S06), generating corresponding natural language questions or answers based on the structured guiding questions or answers. However, the present application does not guarantee the correctness of the task-oriented multi-turn dialogue by adopting a domain classification model of the task-oriented dialogue and an intent recognition model of the previous turn. SUMMARY
[0004] In view of the defects in the prior art, the purpose of the present application is to provide a task-oriented 1+N-based multi-turn dialogue method and system.
[0005] According to the task-oriented 1+N-based multi-turn dialogue method provided by the present application, the method comprises:
[0006] Step S1: constructing a domain classification model, an intent recognition model and a word slot semantic filling model of a task-oriented dialogue according to business requirements;
[0007] Step S2: performing a single-turn dialogue task, obtaining the domain of the text through the domain classification model, if the domain of the text is not a preset domain, replying through a casual source service;
[0008] If the domain is a preset domain, first, identifying the corresponding intent of the text through the intent recognition model, then filling the word slot of the text through the word slot semantic filling model, extracting the word slot of the text, and giving a reply through the source service corresponding to the intent using the word slot;
[0009] Step S3: performing a multi-turn dialogue, the user text entering the intent recognition model and the domain classification model of the previous turn dialogue at the same time, if the intent identified by the current text through the intent recognition model of the previous turn dialogue is consistent with the intent identified by the previous turn dialogue Figure One , then entering a multi-turn dialogue task to give a reply;
[0010] If the intent identified by the current text through the intent recognition model of the previous turn dialogue is inconsistent with the intent identified by the previous turn dialogue, the multi-turn dialogue task is switched to a single-turn dialogue task, and the reply is given by jumping to step S2.
[0011] Preferably, in the step S1:
[0012] According to business requirements, collect corresponding user corpus and preprocess;
[0013] Step S1.1: corpus collection: collecting user corpus through online logs in a production environment;
[0014] Step S1.2: corpus preprocessing: cleaning user corpus without actual semantics;
[0015] Step S1.3: defining corresponding domains, corresponding intents and word slot labels according to the user corpus: determining the domain corresponding to the corpus through the user corpus, and defining corresponding intents and word slot labels in combination with business requirements;
[0016] The domains include a task-oriented dialogue domain, a casual dialogue domain and a question and answer dialogue domain, the task-oriented dialogue domain helps users complete a specific task through natural language interaction, the casual dialogue domain simulates human chatting behavior, and the question and answer dialogue domain aims to answer specific questions of users based on specific knowledge to help users obtain information they are interested in;
[0017] Labeling domains, intents and word slots: labeling corresponding domains, intents and word slots according to user corpus information;
[0018] Step S1.4: training and optimizing the domain classification model, the intent recognition model, and the word slot semantic filling model:
[0019] The corpus of each domain is divided according to the ratio of 8:1:1, 8 parts of each domain corpus are used as the training set, 1 part of each domain corpus is used as the validation set, and another 1 part of each domain corpus is used as the test set;
[0020] Step S1.5: optimization of the domain classification, intent recognition, and word slot semantic filling models:
[0021] Through the results of the test set, the recognition effect of the model on each domain corpus is analyzed, and the model is iteratively optimized in terms of corpus tactics, algorithm, and parameters.
[0022] Preferably, in the step S2:
[0023] The domain classification, intent recognition, and word slot semantic filling models are inferred;
[0024] For the domain classification model, a TextCNN model is used to input the text and output the domain corresponding to the text, to obtain and process the input language text information, to perform vectorization processing based on the character sentence to obtain an initial vector based on the character sentence, to perform multiple convolution kernel processing, multiple window pooling processing, RELU activation function processing, and cascade processing to obtain an optimized character sentence vector, to perform partial element discarding and transformation to obtain a target vector based on the character sentence, and to perform calculation through the full connection layer of the neural network to identify the text domain and the corresponding text domain probability corresponding to the language text information;
[0025] For the intent recognition model, intent recognition is a subtask of domain recognition, and a TextCNN model is also used to input the text and output the intent corresponding to the text; the purpose of intent recognition is to extract the actual intent of the user; the input language text information is obtained and processed, vectorization processing based on the character sentence is performed to obtain an initial vector based on the character sentence; multiple convolution kernel processing, multiple window pooling processing, RELU activation function processing, and cascade processing are performed to obtain an optimized character sentence vector; partial element discarding and transformation are performed to obtain a target vector based on the character sentence; and calculation is performed through the full connection layer of the neural network to identify the text intent and the corresponding text intent probability corresponding to the language text information;
[0026] For the slot semantic filling model, input text, output slot; the purpose of slot filling is to analyze the entity information contained in natural language; obtain and process the input language text information, perform vectorization processing based on character sentences to obtain an initial vector based on character sentences; perform bidirectional LSTM optimization processing and cascade processing to obtain an optimized character sentence vector; perform partial element discarding and transformation to obtain a target vector based on character sentences; calculate through the full connection layer of the neural network to identify the slot value corresponding to the language text slot information, and finally obtain a legal slot through CRF;
[0027] The domain, intent and corresponding slot of the user corpus are identified through the domain classification, intent recognition and slot semantic filling model;
[0028] The text spoken by the user obtains a certain domain through the domain classification model. If the domain is not in the preset domain category, the chat source service is used to reply, otherwise, the intent of the domain is identified through the intent recognition model, the corresponding slot of the intent is extracted through the slot semantic filling model, and the slot is used to give a reply through the source service corresponding to the intent;
[0029] Single round dialogue evaluation index: the domain, intent and all slots corresponding to the user text are correct, and the evaluation indexes of domain classification, intent recognition and slot semantic filling are as follows:
[0030] Domain classification task: the domain classification accuracy Pdomain is used to evaluate the domain classification model:
[0031] Pdomain= the number of sentences classified correctly by the domain classification / the total number of sentences
[0032] Intent recognition task: the classification accuracy Pintent of intent recognition is used to evaluate the intent recognition model:
[0033] Pintent= the number of sentences classified correctly by the intent recognition / the total number of sentences
[0034] Slot filling task: the sentence-level slot filling accuracy Pslot is used to evaluate the slot filling model:
[0035] Pslot= the number of sentences filled correctly by the slot / the total number of sentences
[0036] Preferably, in the step S3:
[0037] Multi-round task discrimination: when multi-round dialogue, the text spoken by the user enters the intent recognition model and the domain classification model of the previous round at the same time, if the intent identified by the current text through the intent recognition model of the previous round and the intent of the previous round are the same, the current text is determined to be in the same domain, and the current text is input into the slot semantic filling model of the previous round to fill the slot, otherwise, the current text is input into the domain classification model to determine the domain of the current text, and the current text is input into the slot semantic filling model of the domain to fill the slot; Figure OneIf the intent is correct, the multi-round is entered, the corresponding word slot semantic filling model of the intent is extracted through the corresponding word slot semantic filling model of the intent, and the word slot is used to give a reply through the corresponding source service of the intent. If the intent identified by the current text through the intent recognition model of the last round is inconsistent with the last round intent, the multi-round dialogue task is switched to a single round, and a corresponding reply is given.
[0038] Multi-round dialogue evaluation index: the domain, intent and sentence-level word slot corresponding to the text of each round of the user are correct, and the evaluation index of the multi-round dialogue is as follows:
[0039] The multi-round accuracy Pmrd is used to evaluate the multi-round dialogue system:
[0040] Pmrd=multi-round dialogue correct number / multi-round dialogue total number
[0041] Preferably, the dialogue state includes single-round dialogue and multi-round dialogue, the dialogue state is stored in the Redis database of Aliyun in the form of key and value, and the storage time is a constant k, k is a custom timer, and the dialogue state is emptied if the storage time is the constant k.
[0042] The value of the key is a semantic result, and the value of the value is a classification result domain, an intent recognition result intent and a word slot extraction result slots.
[0043] When the single-round dialogue is performed, the semantic result values domain, intent and slots of the user text are filled with corresponding values, and when the multi-round dialogue is performed, the semantic result values domain, intent and slots of the new user text are updated.
[0044] According to the multi-round dialogue system based on 1+N for task, the system comprises:
[0045] Module M1: constructing a domain classification model, an intent recognition model and a word slot semantic filling model of a task type dialogue according to business requirements;
[0046] Module M2: performing a single-round dialogue task, obtaining the domain of the text through the domain classification model, and replying through a casual source service if the domain of the text is not a preset domain;
[0047] If the domain is a preset domain, the corresponding intent of the text is first identified through the intent recognition model, then the word slot of the text is filled through the word slot semantic filling model, the word slot of the text is extracted, and the word slot is used to give a reply through the corresponding source service of the intent.
[0048] Module M3: carry out multi-round dialogue, the user text enters the intent recognition model and the domain classification model of the previous round of dialogue at the same time, if the current text is identified by the intent recognition model of the previous round of dialogue and the intent identified by the previous round of dialogue is inconsistent, then enter the multi-round dialogue task to give a reply; Figure One
[0049] If the current text is identified by the intent recognition model of the previous round and the intent identified by the previous round of dialogue is inconsistent, then the multi-round dialogue task is switched to a single-round dialogue task, and the reply is given by jumping to module M2.
[0050] Preferably, in the module M1:
[0051] According to the business needs, the corresponding user corpus is collected and preprocessed;
[0052] Module M1.1: corpus collection: collect user corpus through production environment online log;
[0053] Module M1.2: corpus preprocessing: clean the user corpus without actual semantics;
[0054] Module M1.3: define the corresponding domain, the corresponding intent, and the word slot label according to the user corpus: determine the domain corresponding to the corpus through the user corpus, and define the corresponding intent and word slot label in combination with the business needs;
[0055] The domain includes: task-oriented dialogue domain, casual dialogue domain, and question and answer type dialogue domain, the task-oriented dialogue domain helps the user to complete a certain specific task through natural language interaction; the casual dialogue domain simulates the chatting behavior of a person; the question and answer type dialogue domain aims to answer the specific questions of the user based on specific knowledge, so as to help the user to obtain the information he is interested in;
[0056] Annotate the domain, the intent and the word slot: annotate the corresponding domain, the intent and the word slot according to the user corpus information;
[0057] Module M1.4: training and optimization of domain classification model, intent recognition model, and word slot semantic filling model:
[0058] The corpus of each domain is divided according to the ratio of 8:1:1, 8 parts of each domain corpus are used as the training set, 1 part of each domain corpus is used as the validation set, and another 1 part of each domain corpus is used as the test set;
[0059] Module M1.5: optimization of domain classification, intent recognition and word slot semantic filling model:
[0060] Through the results of the test set, the recognition effect of the model on each domain corpus is analyzed, and the model is iteratively optimized in terms of corpus tactics, algorithm and parameters.
[0061] Preferably, in the module M2:
[0062] Reasoning is performed on the field classification, intent recognition and slot semantic filling models;
[0063] For the field classification model, a TextCNN model is used to input a text and output a field corresponding to the text, language text information is acquired and processed, vectorization processing based on a character sentence is performed to obtain an initial vector based on the character sentence, a plurality of convolution kernel processing, a plurality of window pooling processing, RELU activation function processing and cascade processing are performed to obtain an optimized character sentence vector, partial element discarding and transformation are performed to obtain a target vector based on the character sentence, and full connection layers of a neural network are calculated to identify a text field and a corresponding text field probability corresponding to the language text information;
[0064] For the intent recognition model, intent recognition is a subtask of field recognition, a TextCNN model is also used to input a text and output an intent corresponding to the text, the purpose of intent recognition is to extract an actual intent of a user, language text information is acquired and processed, vectorization processing based on a character sentence is performed to obtain an initial vector based on the character sentence, a plurality of convolution kernel processing, a plurality of window pooling processing, RELU activation function processing and cascade processing are performed to obtain an optimized character sentence vector, partial element discarding and transformation are performed to obtain a target vector based on the character sentence, and full connection layers of a neural network are calculated to identify a text intent and a corresponding text intent probability corresponding to the language text information;
[0065] For the slot semantic filling model, a text is input and a slot is output, the purpose of slot filling is to analyze entity information contained in a natural language, language text information is acquired and processed, vectorization processing based on a character sentence is performed to obtain an initial vector based on the character sentence, bidirectional LSTM optimization processing and cascade processing are performed to obtain an optimized character sentence vector, partial element discarding and transformation are performed to obtain a target vector based on the character sentence, full connection layers of a neural network are calculated to identify a slot value corresponding to language text slot information, and finally a legal slot is obtained through CRF;
[0066] The field, intent and corresponding slot of the user corpus are identified through the field classification, intent recognition and slot semantic filling models;
[0067] Text spoken by a user is obtained through a field classification model to obtain a certain field, if the field is not in a preset field category, a reply is given through a casual source service, otherwise, an intent of the field is identified through an intent recognition model, a slot corresponding to the intent is extracted through a slot semantic filling model, and a reply is given through a source service corresponding to the intent using the slot;
[0068] Single round of dialogue evaluation index: the domain, intent and all slots corresponding to the user text are correct, and the evaluation indexes of domain classification, intent recognition and slot semantic filling are as follows:
[0069] Domain classification task: use the domain classification accuracy Pdomain to evaluate the domain classification model:
[0070] Pdomain= The number of correct domain classification sentences / total number of sentences
[0071] Intent recognition task: use the classification accuracy Pintent of intent recognition to evaluate the intent recognition model:
[0072] Pintent= The number of correct intent recognition sentences / total number of sentences
[0073] Slot filling task: use the sentence-level slot filling accuracy Pslot to evaluate the slot filling model:
[0074] Pslot= The number of correct slot filling sentences / total number of sentences
[0075] Preferably, in the module M3:
[0076] Multi-round task discrimination: when multi-round dialogue, the text spoken by the user enters the intent recognition model and the domain classification model of the previous round at the same time, if the intent recognized by the current text through the intent recognition model of the previous round is consistent with the intent of the previous round, then enter the multi-round, extract the slots corresponding to the intent through the slot semantic filling model corresponding to the intent, and give a reply using the slots through the source service corresponding to the intent, if the intent recognized by the current text through the intent recognition model of the previous round is inconsistent with the intent of the previous round, then the multi-round dialogue task is switched to single round, and the corresponding reply is performed; Figure One
[0077] Multi-round dialogue evaluation index: the domain, intent and sentence-level slot corresponding to the text of each round of user are correct, and the evaluation index of multi-round dialogue is as follows:
[0078] Use multi-round accuracy Pmrd to evaluate the multi-round dialogue system:
[0079] Pmrd= The number of correct multi-round dialogues / the total number of multi-round dialogues
[0080] Preferably, the dialogue state includes single round dialogue and multi-round dialogue, the dialogue state is stored in the Redis database of Aliyun in the form of key and value and the storage time is a constant k, k is a custom timer, if the dialogue state storage time is a constant k, the dialogue state will be released and emptied;
[0081] Wherein, the value of key is semantic result, and the value of value is classification result domain, intent recognition result intent and word slot extraction result slots;
[0082] When single round conversation, semantic result value domain, intent and slots of user text are filled with corresponding values, when multi-round conversation, new user text updates semantic result domain, intent and slots values of last round.
[0083] Compared with prior art, the application has the following beneficial effects:
[0084] 1. The application ensures the correctness of task-oriented multi-round conversation and has good performance by adopting domain classification model of task-oriented conversation and intent recognition model of last round, and improves the interactive experience of users.
[0085] 2. The application has domain recognition and intent recognition accuracy of about 99.2%, response time of about 10ms, word slot semantic filling model accuracy of about 92.3%, response time of about 20ms, ensures the correctness and performance of single round conversation, and improves the interactive experience of users. BRIEF DESCRIPTION OF DRAWINGS
[0086] Other features, objects and advantages of the application will become more apparent after reading the following detailed description of non-limiting embodiments with reference to the following drawings:
[0087] Figure 1 It is a pipeline task-oriented conversation system framework;
[0088] Figure 2 It is a TextCNN domain recognition and intent recognition model;
[0089] Figure 3 It is a Bi-LSTM-CRF word slot semantic filling model;
[0090] Figure 4 It is a task-oriented 1+N-based conversation system single round technical flow chart;
[0091] Figure 5 It is a task-oriented 1+N-based conversation system multi-round technical flow chart;
[0092] Figure 6 It is a neural network implementation mode schematic diagram of the application implementation domain classification method;
[0093] Figure 7 It is a neural network implementation mode schematic diagram of the application implementation text intent recognition method;
[0094] Figure 8An implementation mode schematic diagram of an implementation mode of a neural network for realizing a text slot semantic filling method of the application. DETAILED DESCRIPTION
[0095] The application will be described in detail below with specific examples. The following examples will help those skilled in the art to further understand the application, but do not limit the application in any form. It should be noted that for those skilled in the art, without departing from the concept of the application, a number of changes and improvements can be made. These are within the scope of the application.
[0096] Example 1
[0097] According to the task-oriented 1+N-based multi-round dialogue method provided by the application, as shown in Figures 1-8 , comprising:
[0098] Step S1: constructing a task-oriented dialogue domain classification model, an intent recognition model and a slot semantic filling model according to business requirements;
[0099] Specifically, in the step S1:
[0100] According to the business requirements, the corresponding user corpus is collected and preprocessed;
[0101] Step S1.1: corpus collection: collecting user corpus through online logs in production environment;
[0102] Step S1.2: corpus preprocessing: cleaning user corpus without actual semantics;
[0103] Step S1.3: defining corresponding domain, corresponding intent and slot label according to the user corpus: determining the domain corresponding to the corpus through the user corpus, and defining the corresponding intent and slot label in combination with the business requirements;
[0104] The domain includes a task-oriented dialogue domain, a casual dialogue domain and a question and answer dialogue domain. The task-oriented dialogue domain helps users complete a specific task through natural language interaction. The casual dialogue domain simulates human chatting behavior. The question and answer dialogue domain aims to answer specific questions of users based on specific knowledge to help users obtain information they are interested in.
[0105] Labeling domain, intent and slot: labeling the corresponding domain, intent and slot according to the user corpus information;
[0106] Step S1.4: training and optimizing the domain classification model, the intent recognition model and the slot semantic filling model:
[0107] Each field corpus is divided into 8:1:1, 8 parts of each field corpus as the training set, 1 part of each field corpus as the validation set, and another 1 part of each field corpus as the test set;
[0108] Step S1.5: Optimization of domain classification, intent recognition and slot semantic filling model:
[0109] Through the results of the test set, analyze the recognition effect of the model on each field corpus, and iteratively optimize the model from corpus rhetoric, algorithm and parameters.
[0110] Step S2: Perform a single round of dialogue task, obtain the domain of the text through the domain classification model, if the domain of the text is not the preset domain, reply through the casual source service;
[0111] If the domain is a preset domain, first identify the corresponding intent of the text through the intent recognition model, and then fill the slots of the text through the slot semantic filling model, extract the slots of the text, and use the slots to give a reply through the source service corresponding to the intent;
[0112] Specifically, in the step S2:
[0113] Reasoning is performed on the domain classification, intent recognition and slot semantic filling model;
[0114] For the domain classification model, the TextCNN model is used to input the text, and the domain corresponding to the text is output. The input language text information is acquired and processed, vectorization processing based on character sentences is performed to obtain an initial vector based on character sentences; a plurality of convolution kernel processing, a plurality of window pooling processing, a RELU activation function processing and a cascade processing are performed to obtain an optimized character sentence vector; partial element discarding and transformation are performed to obtain a target vector based on character sentences; calculation is performed through the full connection layer of the neural network to identify the text domain and the corresponding text domain probability corresponding to the language text information;
[0115] For the intent recognition model, intent recognition is a subtask of domain recognition, and the TextCNN model is also used to input the text and output the intent corresponding to the text. The purpose of intent recognition is to extract the actual intent of the user; the input language text information is acquired and processed, vectorization processing based on character sentences is performed to obtain an initial vector based on character sentences; a plurality of convolution kernel processing, a plurality of window pooling processing, a RELU activation function processing and a cascade processing are performed to obtain an optimized character sentence vector; partial element discarding and transformation are performed to obtain a target vector based on character sentences; calculation is performed through the full connection layer of the neural network to identify the text intent and the corresponding text intent probability corresponding to the language text information;
[0116] For the slot semantic filling model, input text, output slot; the purpose of slot filling is to analyze the entity information contained in natural language; obtain and process the input language text information, perform vectorization processing based on character sentences to obtain an initial vector based on character sentences; perform bidirectional LSTM optimization processing and cascade processing to obtain an optimized character sentence vector; perform partial element discarding and transformation to obtain a target vector based on character sentences; calculate through the full connection layer of the neural network to identify the slot value corresponding to the language text slot information, and finally obtain a legal slot through CRF;
[0117] The domain, intent and corresponding slot of the user corpus are identified through the domain classification, intent recognition and slot semantic filling model;
[0118] The text spoken by the user is obtained through the domain classification model in a certain domain, if the domain is not in the preset domain category, then the chat source service is used to reply, otherwise, the intent recognition model is used to identify a certain intent in the domain, the slot semantic filling model is used to extract the corresponding slot of the intent, and the slot is used to give a reply through the source service corresponding to the intent;
[0119] Single round of dialogue evaluation index: the domain, intent and all slots corresponding to the user text are correct, and the evaluation indexes of domain classification, intent recognition and slot semantic filling are as follows:
[0120] Domain classification task: the domain classification accuracy Pdomain is used to evaluate the domain classification model:
[0121] Pdomain= the number of sentences classified correctly by the domain classification / the total number of sentences
[0122] Intent recognition task: the classification accuracy Pintent of intent recognition is used to evaluate the intent recognition model:
[0123] Pintent= the number of sentences classified correctly by the intent recognition / the total number of sentences
[0124] Slot filling task: the sentence-level slot filling accuracy Pslot is used to evaluate the slot filling model:
[0125] Pslot= the number of sentences filled correctly by the slot / the total number of sentences
[0126] Step S3: perform multi-round dialogue, the user text enters the intent recognition model and the domain classification model of the previous round of dialogue, if the intent identified by the current text through the intent recognition model of the previous round of dialogue and the intent identified by the previous round of dialogue are the same Figure One , then enter the multi-round dialogue task to give a reply;
[0127] If the current text is identified by the intent recognition model of the previous round and the intent identified by the previous round of dialogue is inconsistent, the multi-round dialogue task is switched to a single-round dialogue task, and the reply is given in step S2.
[0128] Specifically, in the step S3:
[0129] Multi-round task discrimination: when multi-round dialogue, the text spoken by the user is simultaneously entered into the intent recognition model and the domain classification model of the previous round. If the current text is identified by the intent recognition model of the previous round and the intent of the previous round is inconsistent, the multi-round is entered, the corresponding word slot of the intent is extracted by the word slot semantic filling model corresponding to the intent, and the reply is given by the source service corresponding to the intent using the word slot. If the current text is identified by the intent recognition model of the previous round and the intent of the previous round is inconsistent, the multi-round dialogue task is switched to a single round, and the corresponding reply is given; Figure One
[0130] Multi-round dialogue evaluation index: the domain, intent and sentence-level word slot corresponding to each round of text of the user are all correct, and the evaluation index of the multi-round dialogue is as follows:
[0131] The multi-round accuracy Pmrd is used to evaluate the multi-round dialogue system:
[0132] Pmrd = number of correct multi-round dialogues / total number of multi-round dialogues
[0133] Specifically, the dialogue state includes single-round dialogue and multi-round dialogue, and the dialogue state is stored in the Redis database of Aliyun in the form of key and value and the storage time is a constant k, k is a self-defined timer. If the dialogue state storage time is a constant k, the dialogue state will be released and emptied;
[0134] Wherein, the value of key is semantic result, and the value of value is classification result domain, intent recognition result intent and word slot extraction result slots.
[0135] When single-round dialogue, the semantic result value domain, intent and slots of the user text are filled with corresponding values, when multi-round dialogue, the new user text updates the semantic result domain, intent and slots values of the previous round.
[0136] Embodiment 2:
[0137] Embodiment 2 is a preferred example of embodiment 1, which more specifically illustrates the present application.
[0138] The task-oriented 1+N multi-turn dialogue method provided by the present application can be understood by those skilled in the art as a specific implementation of a task-oriented 1+N multi-turn dialogue system, that is, the task-oriented 1+N multi-turn dialogue system can be implemented by executing the steps of the task-oriented 1+N multi-turn dialogue method.
[0139] The task-oriented 1+N multi-turn dialogue system provided by the present application comprises:
[0140] Module M1: constructing a domain classification model, an intent recognition model and a word slot semantic filling model of a task-oriented dialogue according to business requirements;
[0141] Specifically, in the module M1:
[0142] According to the business requirements, the corresponding user corpus is collected and preprocessed;
[0143] Module M1.1: corpus collection: collecting user corpus through online logs in the production environment;
[0144] Module M1.2: corpus preprocessing: cleaning user corpus without actual semantics;
[0145] Module M1.3: defining corresponding domains, intents and word slot labels according to the user corpus: determining the domain corresponding to the corpus through the user corpus, and defining corresponding intents and word slot labels in combination with business requirements;
[0146] The domain includes a task-oriented dialogue domain, a casual dialogue domain and a question and answer dialogue domain. The task-oriented dialogue domain helps users complete a specific task through natural language interaction. The casual dialogue domain simulates human chatting behavior. The question and answer dialogue domain aims to answer specific questions of users based on specific knowledge to help users obtain information they are interested in.
[0147] Labeling domains, intents and word slots: labeling corresponding domains, intents and word slots according to user corpus information;
[0148] Module M1.4: training and optimizing the domain classification model, the intent recognition model and the word slot semantic filling model:
[0149] The corpus of each domain is divided according to the ratio of 8:1:1. Eight parts of each domain corpus are used as the training set, one part of each domain corpus is used as the validation set, and one part of each domain corpus is used as the test set.
[0150] Module M1.5: optimization of the domain classification, intent recognition and word slot semantic filling models:
[0151] Through the results of the test set, analyze the recognition effect of the model on each field corpus, and optimize the model from corpus rhetoric, algorithm and parameter iteration.
[0152] Module M2: performing a single round of dialogue task, obtaining the field to which the text belongs through the field classification model, if the field to which the text belongs is not a preset field, replying through the casual chat source service;
[0153] If the field is a preset field, first, identify the corresponding intent of the text through the intent recognition model, and then fill the slots of the text through the slot semantic filling model, extract the slots of the text, and use the slots to give a reply through the source service corresponding to the intent;
[0154] Specifically, in the module M2:
[0155] Reasoning is performed on the field classification, intent recognition and slot semantic filling models;
[0156] For the field classification model, a TextCNN model is used to input the text and output the field corresponding to the text, acquire and process the input language text information, perform vectorization processing based on the character sentence to obtain an initial vector based on the character sentence, perform multiple convolution kernel processing, multiple window pooling processing, RELU activation function processing and cascade processing to obtain an optimized character sentence vector, perform partial element discarding and transformation to obtain a target vector based on the character sentence, and perform calculation through a fully connected layer of a neural network to identify the text field corresponding to the language text information and the corresponding text field probability;
[0157] For the intent recognition model, intent recognition is a subtask of field recognition, and a TextCNN model is also used to input the text and output the intent corresponding to the text; the purpose of intent recognition is to extract the actual intent of the user; acquire and process the input language text information, perform vectorization processing based on the character sentence to obtain an initial vector based on the character sentence, perform multiple convolution kernel processing, multiple window pooling processing, RELU activation function processing and cascade processing to obtain an optimized character sentence vector, perform partial element discarding and transformation to obtain a target vector based on the character sentence, and perform calculation through a fully connected layer of a neural network to identify the text intent corresponding to the language text information and the corresponding text intent probability;
[0158] For the slot semantic filling model, input text, output slot; the purpose of slot filling is to analyze the entity information contained in natural language; obtain and process the input language text information, perform vectorization processing based on character sentences to obtain an initial vector based on character sentences; perform bidirectional LSTM optimization processing and cascade processing to obtain an optimized character sentence vector; perform partial element discarding and transformation to obtain a target vector based on character sentences; calculate through the full connection layer of the neural network to identify the slot value corresponding to the language text slot information, and finally obtain a legal slot through CRF;
[0159] The domain, intent and corresponding slot of the user corpus are identified through the domain classification, intent recognition and slot semantic filling model;
[0160] The text spoken by the user obtains a certain domain through the domain classification model, if the domain is not in the preset domain category, then the chat source service is used to reply, otherwise, the intent recognition model is used to identify a certain intent of the domain, the slot semantic filling model is used to extract the corresponding slot of the intent, and the slot is used to give a reply through the source service corresponding to the intent;
[0161] Single round dialogue evaluation index: the domain, intent and all slots corresponding to the user text are correct, and the evaluation indexes of domain classification, intent recognition and slot semantic filling are as follows:
[0162] Domain classification task: the domain classification accuracy Pdomain is used to evaluate the domain classification model:
[0163] Pdomain= the number of sentences classified correctly by the domain classification / the total number of sentences
[0164] Intent recognition task: the classification accuracy Pintent of intent recognition is used to evaluate the intent recognition model:
[0165] Pintent= the number of sentences classified correctly by the intent recognition / the total number of sentences
[0166] Slot filling task: the sentence-level slot filling accuracy Pslot is used to evaluate the slot filling model:
[0167] Pslot= the number of sentences filled correctly by the slot / the total number of sentences
[0168] Module M3: multi-round dialogue, user text enters the intent recognition model and domain classification model of the previous round of dialogue at the same time, if the intent recognized by the current text through the intent recognition model of the previous round of dialogue and the intent recognized by the previous round of dialogue are the same Figure One , then enter the multi-round dialogue task to give a reply;
[0169] If the current text is identified by the intent recognition model of the last round and the intent identified by the last round of dialogue is inconsistent, the multi-round dialogue task is switched to a single-round dialogue task, and the module M2 is jumped to give a reply.
[0170] Specifically, in the module M3:
[0171] Multi-round task discrimination: when multi-round dialogue, the text of the user speaking enters the intent recognition model and the domain classification model of the last round at the same time, if the current text is identified by the intent recognition model of the last round and the intent of the last round is inconsistent, it enters multi-round, extracts the corresponding word slot of the intent through the word slot semantic filling model corresponding to the intent, and gives a reply through the source service corresponding to the intent using the word slot, if the current text is identified by the intent recognition model of the last round and the intent of the last round is inconsistent, the multi-round dialogue task is switched to a single round, and the corresponding reply is performed. Figure One
[0172] Multi-round dialogue evaluation index: the domain, intent and sentence-level word slot corresponding to each round of text of the user are all correct, and the evaluation index of multi-round dialogue is as follows:
[0173] The multi-round accuracy Pmrd is used to evaluate the multi-round dialogue system:
[0174] Pmrd=multi-round dialogue correct number / multi-round dialogue total number
[0175] Specifically, the dialogue state includes single-round dialogue and multi-round dialogue, the dialogue state is stored in the Redis database of Aliyun in the form of key and value and the storage time is a constant k, k is a custom timer, if the dialogue state storage time is a constant k, the dialogue state will be released and emptied;
[0176] Among them, the value of key is semantic result, and the value of value is classification result domain, intent recognition result intent and word slot extraction result slots.
[0177] When single-round dialogue, the semantic result value domain, intent and slots of the user text are filled with corresponding values, when multi-round dialogue, the new user text updates the semantic result domain, intent and slots values of the last round.
[0178] Embodiment 3:
[0179] Embodiment 3 is a preferred example of embodiment 1, which further illustrates the present application.
[0180] Step 1: constructing a domain classification model of task-based dialogue according to business requirements
[0181] Step 2: constructing an intent recognition model of task-based dialogue according to business requirements
[0182] Step 3: Construct a slot semantic filling model for task-oriented dialogue based on business requirements.
[0183] Step 4: During the first round of dialogue, the user's spoken text is classified into a domain by the domain classification model. If the domain is "other", the user replies through the chat source service. Otherwise, the user identifies an intent in the domain by the intent recognition model, extracts the corresponding slots for the intent by the slot semantic filling model, and finally uses the slots to give a reply through the source service corresponding to the intent.
[0184] Step 5: During multi-turn dialogues, the user's spoken text simultaneously enters the intent recognition model and domain classification model of the previous turn. If the intent identified by the current text through the intent recognition model of the previous turn matches the intent identified in the previous turn... Figure One If the intent is correct, the process proceeds to a multi-round round. The slots corresponding to the intent are extracted using the slot semantic filling model, and the corresponding slots are used to provide a response through the source service corresponding to the intent. If the intent identified by the intent recognition model in the previous round is inconsistent with the intent in the previous round, the multi-round round is switched to a single round, and step three is performed to provide the corresponding response.
[0185] Product: In-vehicle intelligent voice dialogue system
[0186] Business requirements: This system needs both single-turn and multi-turn dialogues.
[0187] Key skills: navigation, music, and vehicle control, etc.
[0188] Three models: domain classification model, intent recognition model, and slot semantic filling model.
[0189] The "Other" field means that all other fields are considered "other" fields. For example, an in-vehicle intelligent dialogue system may have navigation, music, vehicle control, and "other" fields. Here, "other" refers to fields other than navigation, music, and vehicle control, such as weather and casual conversation.
[0190] Casual chat source services: Source services refer to application interfaces. For example, navigation source services include Gaode Maps, Baidu Maps, and Tencent Maps; music source services include iQiyi, QQ Music, and Kugou Music; and casual chat source services include Ali Chat, Tencent Chat, and Baidu Chat. A casual chat source service provides a service or interface for casual chat skills. The input is a casual chat phrase, and the output is a corresponding reply. For example: Input: I want to chat with you; Output: Master, I've been waiting for you for a long time.
[0191] Previous round domain: specifically refers to the round before the current round.
[0192] Model building:
[0193] 1: Collecting corresponding user corpus according to business needs and preprocessing;
[0194] Specifically, corpus collection:
[0195] By collecting user corpus through production environment online logs, our vehicle-mounted voice dialogue system has been operated on actual vehicles. For example: our new energy vehicles all have vehicle-mounted voice intelligent dialogue robots.
[0196] Corpus preprocessing:
[0197] Corpus preprocessing: cleaning dirty, messy and non-semantic user corpus. For example: one word, one symbol and non-semantic sentence.
[0198] 2: Defining corresponding domain, corresponding intent, and word slot label according to the user corpus;
[0199] Specifically, in 2, defining domain, intent and word slot label:
[0200] Through user corpus, the domain corresponding to these corpus can be known, and combined with business needs to define corresponding intent and word slot label.
[0201] Annotating domain, intent and word slot:
[0202] For example: user corpus has: 1. Today's weather in Shanghai; 2. Navigate to People's Square; 3. Play Jay Chou's Double Sickle. The corresponding intent is: 1. Weather; 2. Navigation; 3. Music. The corresponding word slot is: 1. Date and city name; 2. Departure and destination; 3. Performers and song name.
[0203] 3: Training and optimizing domain classification model, intent recognition model, and word slot semantic filling model;
[0204] Specifically, in 3, training of domain classification, intent recognition, and word slot semantic filling model:
[0205] First, the corpus of each domain is divided according to the ratio of 8:1:1, second, 8 parts of each domain corpus are used as the training set, 1 part of each domain corpus is used as the validation set, and another 1 part of each domain corpus is used as the test set.
[0206] Optimization of domain classification, intent recognition and word slot semantic filling model:
[0207] Through the results of the test set, the recognition effect of the model on each domain corpus is analyzed, and the model is iteratively optimized in terms of corpus tactics, algorithm and parameters.
[0208] 4: Reasoning of domain classification, intent recognition and word slot semantic filling model;
[0209] Specifically, in 4, the reasoning of the domain classification, intent recognition and slot semantic filling models:
[0210] For the domain classification model, the input is the text, and the output is the domain corresponding to the text. For example, the input of the domain classification model: Today's weather, the model reasoning result is that the domain corresponding to the text is weather_domain.
[0211] Intent recognition is a subtask of domain recognition, and the task is very similar.
[0212] For the intent recognition model, the input is the text, and the output is the intent corresponding to the text. For example, the input of the intent recognition model: Today's weather, the model reasoning result is that the intent corresponding to the text is weather_intent.
[0213] For the slot semantic filling model, the input is the text, and the output is the slot. For example, the input of the slot semantic filling model: What is the weather like in Shanghai tomorrow, the model reasoning result is that the date slot is tomorrow, and the city name slot is Shanghai.
[0214] 5: Identify the intent of the user corpus and extract the corresponding slot through the domain classification, intent recognition and slot semantic filling models.
[0215] Single round task: The text spoken by the user is obtained through the domain classification model to obtain a certain domain, if the domain is other, then the reply is made through the casual source service, otherwise, the intent recognition model is used to identify a certain intent in the domain, then the slot semantic filling model is used to extract the slot corresponding to the intent, and finally the slot is used to reply through the source service corresponding to the intent.
[0216] Multi-round dialogue:
[0217] For example, the user said "Today's weather is how" in the first sentence, and "Beijing" in the next sentence. The second user wants to ask today's weather in Beijing. The traditional multi-round dialogue may identify the current semantic as Baidu Beijing, and may enter the encyclopedia, which cannot proceed multi-round and affect the user experience.
[0218] For another example, the user said "Today's weather is how" in the first sentence, and "The weather in Shanghai is very good" in the next sentence. The meaning of the sentence is casual chat, but the traditional multi-round dialogue may identify the current semantic as today's weather in Shanghai, and cannot switch to a new task, which also affects the user experience.
[0219] Specifically, in 5, multi-round task discrimination:
[0220] When multi-round dialogue, the text spoken by the user enters the intent recognition model and the domain classification model of the last round at the same time, if the intent identified by the current text through the intent recognition model of the last round is different from the intent of the last round, and the current text through the domain classification model of the last round is different from the domain of the last round, then the current text is a new task.Figure One If the current text is consistent with the identified intent of the previous round, the system enters the multi-round, extracts the corresponding slots of the intent through the word slot semantic filling model corresponding to the intent, and gives a reply through the source service corresponding to the intent. If the current text is not consistent with the identified intent of the previous round, the multi-round is switched to a single round, and the corresponding reply is given in step three.
[0221] The dialogue state is stored in the Redis database of Ali Cloud in the form of key and value, and the storage time is a constant k, k is a custom timer. If the storage time of the dialogue state is the constant k, the dialogue state will be released and emptied. The value of the key is the semantic result, and the value of the value is the classification result domain, the intent recognition result intent, and the slot extraction result slots. When the single-round dialogue, the semantic result value domain, intent, and slots of the user text are filled with the corresponding values. When the multi-round dialogue, the new user text updates the semantic result domain, intent, and slots values of the previous round.
[0222] For example:
[0223] Single-round dialogue: Today's weather in Beijing
[0224] The semantic result value value of the key of the Redis database is:
[0225] domain: weather
[0226] intent: weather_search
[0227] slots:
[0228] City: Beijing
[0229] Date: Today
[0230] When the multi-round dialogue: Tomorrow
[0231] At this time, the semantic result value value of the key of the Redis database is updated to:
[0232] domain: weather
[0233] intent: weather_search
[0234] slots:
[0235] City: Beijing
[0236] Date: Tomorrow
[0237] When the multi-round dialogue: Xi'an
[0238] At this time, the semantic result value value of the key of the Redis database is updated as:
[0239] domain: weather
[0240] intent: weather_search
[0241] slots:
[0242] City: Xi'an
[0243] Date: tomorrow
[0244] Single-round dialogue evaluation indicators: the user text corresponds to the correct domain, intent, and all slots. The evaluation indicators for domain classification, intent recognition, and slot semantic filling are as follows:
[0245] Domain classification task: This paper uses the domain classification accuracy (Pdomain) to evaluate the domain classification model.
[0246] Pdomain = number of correctly classified sentences / total number of sentences (1)
[0247] Intent recognition task: This paper uses the classification accuracy of intent recognition (Pintent) to evaluate the intent recognition model
[0248] Pintent = number of correctly recognized sentences / total number of sentences (2)
[0249] Slot filling task: This paper uses the sentence-level slot filling accuracy (Pslot) to evaluate the slot filling model.
[0250] Pslot = number of correctly filled slots / total number of sentences (3)
[0251] Multi-round dialogue evaluation indicators: the user text in each round corresponds to the correct domain, intent, and sentence-level slot.
[0252] Multi-round task: This paper uses the multi-round accuracy (Pmrd) to evaluate the multi-round dialogue system.
[0253] Pmrd = number of correctly recognized multi-round dialogues / total number of multi-round dialogues (4)
[0254] Those skilled in the art know that, in addition to implementing the system, device and each module thereof provided by the present application in the form of pure computer readable program code, the same program can also be implemented in the form of logic gate, switch, special integrated circuit, programmable logic controller and embedded microcontroller, etc. by logically programming the method steps. Therefore, the system, device and each module thereof provided by the present application can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures in the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing methods and structures in the hardware component.
[0255] The specific embodiments of the present application are described above. It needs to be understood that the present application is not limited to the specific embodiments described above, and various changes or modifications can be made by those skilled in the art within the scope of the claims, which does not affect the essential content of the present application. The embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily without conflict.
Claims
1. A 1+N based multi-turn task-oriented dialogue method, characterized in that, Comprise: Step S1: according to the business requirement constructs the domain classification model of task type dialogue, intent recognition model and word slot semantic filling model; Step S2: carry out single round dialogue task, obtain the domain of text through domain classification model, if the domain of text is not preset domain, reply through idle chat source service; If the domain is the preset domain, first, identify the corresponding intent of the text through the intent recognition model, then fill the word slot of the text through the word slot semantic filling model, extract the word slot of the text, and use the word slot to give a reply through the source service corresponding to the intent; Step S3: carry out multi round dialogue, user text enters the intent recognition model and domain classification model of the last round dialogue, if the intent identified by the current text through the intent recognition model of the last round dialogue is consistent with the intent identified by the last round dialogue, then enter the multi round dialogue task to give a reply; If the intent identified by the current text through the intent recognition model of the last round dialogue is not consistent with the intent identified by the last round dialogue, then the multi round dialogue task is switched to single round dialogue task, and jump to step S2 to give a reply.
2. The 1+N based multi-turn task-oriented dialogue method according to claim 1, wherein, In the step S1: According to the business requirement, collect corresponding user corpus and preprocess; Step S1.1: corpus collection: collect user corpus through production environment online log; Step S1.2: corpus preprocessing: clean user corpus without actual semantics; Step S1.3: define corresponding domain, corresponding intent and word slot label according to the user corpus: determine the domain corresponding to the corpus through the user corpus, and define corresponding intent and word slot label combined with business requirement; The domain includes: task-oriented dialogue domain, idle chat type dialogue domain and question and answer type dialogue domain, the task-oriented dialogue domain helps users complete a certain specific task through natural language interaction; The idle chat type dialogue domain simulates human chatting behavior; The question and answer type dialogue domain aims to answer specific questions of users based on specific knowledge to help users obtain information they are interested in; Label domain, intent and word slot: label corresponding domain, intent and word slot according to user corpus information; Step S1.4: train and optimize domain classification model, intent recognition model and word slot semantic filling model: Divide the corpus of each domain according to the ratio of 8:1:1, take 8 parts of each domain corpus as training set, take 1 part of each domain corpus as validation set, and take 1 part of each domain corpus as test set; Step S1.5: optimization of domain classification, intent recognition and word slot semantic filling model: Through the result of test set, analyze the recognition effect of the model on each domain corpus, and iteratively optimize the model from corpus tactics, algorithm and parameter.
3. The task-oriented 1+N based multi-turn dialogue method according to claim 1, wherein, In the step S2: Reason the domain classification, intent recognition and word slot semantic filling model; For the domain classification model, use the TextCNN model to input the text, output the domain corresponding to the text, obtain and process the input language text information, and perform vectorization processing based on character sentence to obtain the initial vector based on character sentence; The multiple convolution kernel processing, multiple window pooling processing, RELU activation function processing and cascade processing are performed to obtain an optimized character sentence vector; partial element discarding and transformation are performed to obtain a target character sentence vector; and full connection layer calculation of a neural network is performed to identify a text field corresponding to the language text information and a corresponding text field probability; For the intent recognition model, intent recognition is a subtask of field recognition, and a TextCNN model is also used to input the text and output the intent corresponding to the text; The purpose of intent recognition is to extract the actual intent of the user; The input language text information is acquired and processed, and character sentence-based vectorization processing is performed to obtain an initial character sentence-based vector; The multiple convolution kernel processing, multiple window pooling processing, RELU activation function processing and cascade processing are performed to obtain an optimized character sentence vector; partial element discarding and transformation are performed to obtain a target character sentence vector; and full connection layer calculation of a neural network is performed to identify a text intent corresponding to the language text information and a corresponding text intent probability; For the slot semantic filling model, the input text is output as a slot; the purpose of slot filling is to analyze the entity information contained in the natural language; the input language text information is acquired and processed, and character sentence-based vectorization processing is performed to obtain an initial character sentence-based vector; bidirectional LSTM optimization processing and cascade processing are performed to obtain an optimized character sentence vector; partial element discarding and transformation are performed to obtain a target character sentence vector; full connection layer calculation of a neural network is performed to identify a slot value corresponding to the language text slot information, and finally a legal slot is obtained through CRF; The domain, intent and corresponding slot of the user corpus are identified through the domain classification, intent recognition and slot semantic filling models; If the text spoken by the user obtains a certain domain through the domain classification model, and the domain is not in the preset domain category, a reply is given through the casual source service, otherwise, a certain intent of the domain is identified through the intent recognition model, the slot corresponding to the intent is extracted through the slot semantic filling model, and a reply is given through the source service corresponding to the intent using the slot; Single-round dialogue evaluation indicators: the domain, intent and all slots corresponding to the user text are correct, and the evaluation indicators of the domain classification, intent recognition and slot semantic filling are as follows: The domain classification task is evaluated by using the domain classification accuracy Pdomain: Pdomain=number of correctly classified sentences / total number of sentences The intent recognition task is evaluated by using the classification accuracy Pintent of the intent recognition model: Pintent=number of correctly recognized sentences / total number of sentences The slot filling task is evaluated by using the sentence-level slot filling accuracy Pslot: Pslot=number of correctly filled sentences / total number of sentences.
4. The task-oriented 1+N based multi-turn dialogue method of claim 1, wherein, In the step S3: Multi-round task discrimination: when multi-round dialogue, the text spoken by the user enters the intent recognition model and the domain classification model of the previous round at the same time. If the intent recognized by the current text through the intent recognition model of the previous round is consistent with the intent of the previous round, then enter the multi-round, extract the corresponding slots of the intent through the slot semantic filling model corresponding to the intent, and give a reply using the slots through the source service corresponding to the intent. If the intent recognized by the current text through the intent recognition model of the previous round is inconsistent with the intent of the previous round, then the multi-round dialogue task is switched to single round, and the corresponding reply is given; Multi-round dialogue evaluation index: the domain, intent and sentence-level slots corresponding to each round of user text are correct, and the evaluation index of multi-round dialogue is as follows: Use multi-round accuracy Pmrd to evaluate the multi-round dialogue system: Pmrd=multi-round dialogue correct number / multi-round dialogue total number.
5. The task-oriented 1+N multi-round dialogue method according to claim 1, characterized in that: The dialogue state includes single round dialogue and multi-round dialogue, and the dialogue state is stored in the Redis database of Ali Cloud in the form of key and value and the storage time is a constant k, k is a custom timer, and if the dialogue state storage time is a constant k, the dialogue state will be released and emptied; Wherein, the value of key is semantic result, and the value of value is classification result domain, intent recognition result intent and slot extraction result slots; When single round dialogue, the semantic result value domain, intent and slots of user text are filled with corresponding values, and when multi-round dialogue, the new user text updates the semantic result domain, intent and slots values of the previous round.
6. A task-oriented 1+N based multi-turn dialogue system, characterized in that, It includes: Module M1: according to the business requirements, build the domain classification model, intent recognition model and slot semantic filling model of task-oriented dialogue; Module M2: perform single round dialogue task, obtain the domain of the text through the domain classification model, if the domain of the text is not the preset domain, reply through the chatting source service; If the domain is a preset domain, first identify the corresponding intent of the text through the intent recognition model, then fill the slots of the text through the slot semantic filling model, extract the slots of the text, and give a reply using the slots through the source service corresponding to the intent; Module M3: multi-round dialogue, user text enters the intent recognition model and domain classification model of the previous round at the same time, if the intent recognized by the current text through the intent recognition model of the previous round is consistent with the intent recognized by the previous round, then enter the multi-round dialogue task to give a reply; If the intent recognized by the current text through the intent recognition model of the previous round is inconsistent with the intent recognized by the previous round, then the multi-round dialogue task is switched to single round dialogue task, and jump to module M2 to give a reply.
7. The task-oriented 1+N based multi-turn dialogue system according to claim 6, wherein, In the module M1: According to the business requirements, collect the corresponding user corpus and preprocess it; Module M1.1: corpus collection: collect user corpus through online logs in production environment; Module M1.2: corpus preprocessing: clean the user corpus without actual semantics; Module M1.3: defining corresponding domains, corresponding intents, and word slot labels according to the user corpus: determining the domain corresponding to the corpus through the user corpus, and defining the corresponding intent and word slot label in combination with the business demand; The domain includes: a task-oriented dialogue domain, a casual dialogue domain, and a question-and-answer dialogue domain. The task-oriented dialogue domain helps users complete a specific task through natural language interaction. The casual dialogue domain simulates human chatting behavior. The question-and-answer dialogue domain aims to answer specific questions of users based on specific knowledge to help users obtain information they are interested in. Labeling domains, intents, and word slots: labeling the corresponding domains, intents, and word slots according to the user corpus information; Module M1.4: training and optimizing the domain classification model, the intent recognition model, and the word slot semantic filling model: The corpus of each domain is divided into 8:1:1 proportions. 8 parts of each domain corpus are used as the training set, 1 part of each domain corpus is used as the validation set, and another 1 part of each domain corpus is used as the test set. Module M1.5: optimization of the domain classification, intent recognition, and word slot semantic filling models: Through the results of the test set, the recognition effect of the model on each domain corpus is analyzed, and the model is iteratively optimized in terms of corpus tactics, algorithm, and parameters.
8. The task-oriented 1+N based multi-turn dialogue system of claim 6, wherein, In the module M2: Reasoning on the domain classification, intent recognition, and word slot semantic filling models; For the domain classification model, the TextCNN model is used to input the text, output the domain corresponding to the text, obtain and process the input language text information, perform vectorization processing based on the character sentence to obtain the initial vector based on the character sentence, perform multiple convolution kernel processing, multiple window pooling processing, RELU activation function processing, and cascade processing to obtain the optimized character sentence vector, and perform partial element discarding and transformation to obtain the target vector based on the character sentence. The full connection layer of the neural network is calculated to identify the text domain and the corresponding text domain probability corresponding to the language text information; For the intent recognition model, intent recognition is a subtask of domain recognition. The TextCNN model is also used to input the text, and the intent corresponding to the text is output. The purpose of intent recognition is to extract the actual intent of the user. Obtain and process the input language text information, perform vectorization processing based on the character sentence to obtain the initial vector based on the character sentence, perform multiple convolution kernel processing, multiple window pooling processing, RELU activation function processing, and cascade processing to obtain the optimized character sentence vector, and perform partial element discarding and transformation to obtain the target vector based on the character sentence. The full connection layer of the neural network is calculated to identify the text intent and the corresponding text intent probability corresponding to the language text information. For the slot semantic filling model, input text, and output slot; the purpose of slot filling is to analyze the entity information contained in natural language; obtain and process the input language text information, perform character sentence-based vectorization processing to obtain the initial character sentence-based vector; perform bidirectional LSTM optimization processing and cascade processing to obtain the optimized character sentence-based vector; perform partial element discarding and transformation to obtain the target character sentence-based vector; calculate through the full connection layer of the neural network to identify the slot value corresponding to the language text slot information, and finally obtain the legal slot through CRF; The domain, intent, and corresponding slot of the user corpus are identified through the domain classification, intent recognition, and slot semantic filling models; If the domain obtained by the user's text through the domain classification model is not in the preset domain category, the user's text is replied through the casual source service; otherwise, the intent of the domain is identified through the intent recognition model, the slot corresponding to the intent is extracted through the slot semantic filling model, and the reply is given through the source service corresponding to the intent using the slot; Single-round dialogue evaluation indicators: the domain, intent, and all slots corresponding to the user's text are correct, and the evaluation indicators of domain classification, intent recognition, and slot semantic filling are as follows: Domain classification task: the domain classification accuracy Pdomain is used to evaluate the domain classification model: Pdomain=number of domain classification correct sentences / sentence total number Intent recognition task: the classification accuracy Pintent of intent recognition is used to evaluate the intent recognition model: Pintent=number of intent recognition correct sentences / sentence total number Slot filling task: the sentence-level slot filling accuracy Pslot is used to evaluate the slot filling model: Pslot=number of slot filling correct sentences / sentence total number.
9. The task-oriented 1+N based multi-turn dialogue system of claim 6, wherein, In the module M3: Multi-round task discrimination: when the multi-round dialogue, the user's text enters the intent recognition model and the domain classification model of the last round at the same time, if the intent identified by the current text through the intent recognition model of the last round is consistent with the last round intent, then enter the multi-round, extract the slot corresponding to the intent through the slot semantic filling model corresponding to the intent, and give a reply through the source service corresponding to the intent using the slot, if the intent identified by the current text through the intent recognition model of the last round is not consistent with the last round intent, then the multi-round dialogue task is switched to single round, and the corresponding reply is performed; Multi-round dialogue evaluation indicators: the domain, intent, and sentence-level slot corresponding to the user's text in each round are correct, and the evaluation indicators of the multi-round dialogue are as follows: The multi-round accuracy Pmrd is used to evaluate the multi-round dialogue system: Pmrd=number of multi-round dialogue corrects / total number of multi-round dialogues.
10. The task-oriented 1+N-based multi-round dialogue system of claim 6, characterized in that: The dialogue state includes single-round dialogue and multi-round dialogue, the dialogue state is stored in the Redis database of Ali Cloud in the form of key and value, and the storage time is a constant k, k is a custom timer, and if the dialogue state storage time is a constant k, the dialogue state will be released and emptied; Wherein, the value of key is semantic result, and the value of value is classification result domain, intent recognition result intent and word slot extraction result slots; When single round conversation, the semantic result value domain, intent and slots of user text are filled with corresponding values, and when multi-round conversation, new user text updates the semantic result domain, intent and slots values of the last round.
Citation Information
Patent Citations
Fusion method of single dialogue and multiple dialogues
CN108228764A
Task type multi-round dialogue method and system for office scene
CN112199486A
Intelligent customer service method and device, equipment and storage medium
CN112487810A