CN110232108B - Man-machine conversation method and conversation system - Google Patents
Man-machine conversation method and conversation system Download PDFInfo
- Publication number
- CN110232108B CN110232108B CN201910395865.5A CN201910395865A CN110232108B CN 110232108 B CN110232108 B CN 110232108B CN 201910395865 A CN201910395865 A CN 201910395865A CN 110232108 B CN110232108 B CN 110232108B
- Authority
- CN
- China
- Prior art keywords
- user
- behavior
- statement
- reply
- user behavior
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Mathematical Physics (AREA)
- Human Computer Interaction (AREA)
- Machine Translation (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本申请涉及人工智能技术,提供了一种人机对话方法,包括:对话系统获取用户输入的第一用户语句,其中,第一用户语句指示了第一用户行为;根据第一用户语句确定存在所述第一用户行为为异常行为;在异常行为是对话系统能够识别,但是无法执行的行为的情况下,识别异常行为无法被执行的原因,并生成对异常行为进行回复的第一回复语句,其中,第一回复语句用于提示第一用户行为不能被执行的原因;或者,在异常行为是对话系统无法识别的行为的情况下,根据第一用户语句识别用户意图,并生成对异常行为进行回复的第二回复语句,其中,第二回复语句用于提示所述对话系统不支持用户意图。
This application relates to artificial intelligence technology, and provides a method for man-machine dialogue, including: the dialogue system acquires the first user sentence input by the user, wherein the first user sentence indicates the first user behavior; The above-mentioned first user behavior is an abnormal behavior; in the case that the abnormal behavior is a behavior that can be recognized by the dialog system but cannot be executed, identify the reason why the abnormal behavior cannot be executed, and generate a first reply statement to reply to the abnormal behavior, wherein , the first reply sentence is used to prompt the reason why the first user behavior cannot be executed; or, in the case that the abnormal behavior is a behavior that cannot be recognized by the dialog system, identify the user intention according to the first user sentence, and generate a reply to the abnormal behavior The second reply sentence, wherein the second reply sentence is used to prompt that the dialog system does not support the user's intention.
Description
技术领域technical field
本申请涉及人工智能领域,尤其涉及一种人机对话方法以及对话系统。The present application relates to the field of artificial intelligence, in particular to a man-machine dialogue method and a dialogue system.
背景技术Background technique
目前对话系统可以包括两种:任务型对话系统以及聊天型对话系统。其中,任务型对话是指为了完成特定任务而进行的对话。在任务型对话中,对话系统需要根据用户语句理解用户的意图,提取用户语句中的信息,并根据提取到的信息完成用户指定的任务。Currently, there are two types of dialogue systems: task-based dialogue systems and chat-type dialogue systems. Among them, the task-based dialogue refers to the dialogue conducted to complete a specific task. In task-based dialogue, the dialogue system needs to understand the user's intention according to the user's sentence, extract the information in the user's sentence, and complete the task specified by the user according to the extracted information.
但是,本领域的技术人员在长期研究下发现,对话系统对异常行为的处理的鲁棒性非常差。However, those skilled in the art have found through long-term research that the robustness of the dialog system in dealing with abnormal behaviors is very poor.
发明内容Contents of the invention
本申请提供了一种人机对话方法以及对话系统,能够明确提示用户对话系统无法执行异常行为的原因,从而提高了对话系统对异常行为的处理的鲁棒性。The present application provides a man-machine dialogue method and a dialogue system, which can clearly prompt the user why the dialogue system cannot perform abnormal behaviors, thereby improving the robustness of the dialogue system in handling abnormal behaviors.
第一方面,提供了一种人机对话方法,包括:In the first aspect, a method for man-machine dialogue is provided, including:
对话系统获取用户输入的指示第一用户行为的第一用户语句。对话系统根据所述第一用户语句通过行为识别模型确定所述第一用户行为为异常行为。其中,所述异常行为是所述对话系统无法正常处理的行为。在所述异常行为是所述对话系统能够识别,但是无法执行的行为的情况下,对话系统识别所述异常行为无法被执行的原因,并生成对所述异常行为进行回复的第一回复语句。其中,所述第一回复语句用于提示所述第一用户行为不能被执行的原因。或者,在所述异常行为是所述对话系统无法识别的行为的情况下,对话系统根据所述第一用户语句识别用户意图,并生成对所述异常行为进行回复的第二回复语句。其中,所述第二回复语句用于提示所述对话系统不支持所述用户意图。The dialog system acquires a first user sentence input by a user indicating a first user behavior. The dialogue system determines that the first user behavior is an abnormal behavior through a behavior recognition model according to the first user statement. Wherein, the abnormal behavior is a behavior that the dialog system cannot handle normally. In the case that the abnormal behavior is a behavior that can be recognized by the dialog system but cannot be executed, the dialog system identifies a reason why the abnormal behavior cannot be executed, and generates a first reply sentence for replying to the abnormal behavior. Wherein, the first reply statement is used to prompt the reason why the first user action cannot be executed. Or, in the case that the abnormal behavior is a behavior that cannot be recognized by the dialog system, the dialog system recognizes the user's intention according to the first user sentence, and generates a second reply sentence for replying to the abnormal behavior. Wherein, the second reply sentence is used to prompt that the dialogue system does not support the user intention.
上述方案中,用户很清楚地从对话系统输出的回复语句中知道对话系统无法完成用户行为的原因,及时调整对话方向,使得对话顺利进行。In the above solution, the user clearly knows the reason why the dialogue system cannot complete the user's behavior from the reply sentence output by the dialogue system, and adjusts the direction of the dialogue in time to make the dialogue proceed smoothly.
在一些可能的设计中,对话系统可以通过如下方法生成对所述异常行为进行回复的第一回复语句:In some possible designs, the dialog system can generate a first reply statement to reply to the abnormal behavior by the following method:
对话系统根据所述异常行为无法被执行的原因查找对应的第一模板。其中,所述第一模板包含了所述第一用户行为关联的第一槽位。对话系统获取用于填充所述第一槽位的第一槽位信息。对话系统将所述第一槽位信息填入所述第一槽位,得到所述第一回复语句。The dialogue system searches for a corresponding first template according to the reason why the abnormal behavior cannot be executed. Wherein, the first template includes the first slot associated with the first user behavior. The dialogue system acquires first slot information for filling the first slot. The dialogue system fills the first slot information into the first slot to obtain the first reply sentence.
在一些可能的设计中,对话系统查找包括第二槽位的第二模板。对话系统获取所述第一用户行为的第一关联用户行为,其中,所述第一关联用户行为是与所述第一用户行为的相关度大于阈值的用户行为。对话系统将所述第一关联用户行为填入所述第二槽位,得到第三回复语句,其中,所述第三回复语句用于提示所述对话系统能够执行所述第一关联用户行为。In some possible designs, the dialog system looks for a second template that includes a second slot. The dialogue system acquires a first associated user behavior of the first user behavior, wherein the first associated user behavior is a user behavior whose degree of correlation with the first user behavior is greater than a threshold. The dialog system fills the first associated user behavior into the second slot to obtain a third reply sentence, wherein the third reply sentence is used to prompt the dialog system to perform the first associated user behavior.
上述方案中,对话系统能够根据之前的用户语句清晰地指出了与之前的用户语句相关的对话系统能够支持的用户行为,因此,能够很好地引导用户对话的方向,使得对话能够更清楚地进行。In the above solution, the dialogue system can clearly point out the user behaviors that the dialogue system can support related to the previous user statement according to the previous user statement, so it can well guide the direction of the user's dialogue, so that the dialogue can be carried out more clearly .
在一些可能的设计中,对话系统可以通过如下方法生成对所述异常行为进行回复的第二回复语句:对话系统查找第三模板,其中,所述第三模板包含了第三槽位;将所述用户意图填入所述第三槽位,得到所述第二回复语句。In some possible designs, the dialogue system can generate a second reply sentence for replying to the abnormal behavior through the following method: the dialogue system searches for a third template, wherein the third template contains a third slot; The user intends to fill in the third slot to obtain the second reply statement.
在一些可能的设计中,对话系统查找包括第二槽位的第二模板。对话系统获取用户输入的在所述第一用户语句之前的第二用户语句。其中,所述第二用户语句指示了第二用户行为。对话系统获取所述第二用户行为的第二关联用户行为。其中,所述第二关联用户行为是与所述第二用户行为的相关度大于阈值的用户行为。对话系统将所述第二关联用户行为填入所述第二槽位,得到第四回复语句。其中,所述第四回复语句用于提示所述对话系统能够执行所述第二关联用户行为。In some possible designs, the dialog system looks for a second template that includes a second slot. The dialog system acquires a second user sentence input by the user before the first user sentence. Wherein, the second user sentence indicates a second user behavior. The dialogue system obtains a second associated user behavior of the second user behavior. Wherein, the second associated user behavior is a user behavior whose degree of correlation with the second user behavior is greater than a threshold. The dialogue system fills the second associated user behavior into the second slot to obtain a fourth reply sentence. Wherein, the fourth reply sentence is used to prompt the dialogue system to perform the second associated user behavior.
上述方案中,对话系统能够根据当前的用户语句清晰地指出了与当前用户语句相关的对话系统能够支持的用户行为,因此,能够很好地引导用户对话的方向,使得对话能够更清楚地进行。In the above solution, the dialogue system can clearly point out the user behaviors that can be supported by the dialogue system related to the current user statement according to the current user statement. Therefore, it can well guide the direction of the user's dialogue, so that the dialogue can be carried out more clearly.
在一些可能的设计中,对话系统通过以下方式根据所述第一用户语句识别用户意图:In some possible designs, the dialogue system recognizes the user's intention according to the first user sentence in the following manner:
对话系统将所述第一用户语句输入用户意图识别模型,从而得到所述用户意图,其中,所述用户意图识别模型是通过已知用户语句以及已知用户意图进行训练得到的。其中,所述用户意图识别模型是分类器,所述分类器是K近邻分类器、支持向量机、决策树以及随机森林中的任意一种。The dialogue system inputs the first user sentence into a user intention recognition model to obtain the user intention, wherein the user intention recognition model is obtained by training through known user sentences and known user intentions. Wherein, the user intention recognition model is a classifier, and the classifier is any one of a K-nearest neighbor classifier, a support vector machine, a decision tree, and a random forest.
第二方面,提供了一种对话系统,包括输入模块、确定模块以及回复模块。In a second aspect, a dialogue system is provided, including an input module, a determination module and a reply module.
所述输入模块用于获取用户输入的第一用户语句,其中,所述第一用户语句指示了第一用户行为。The input module is used to acquire a first user sentence input by a user, wherein the first user sentence indicates a first user behavior.
所述确定模块用于根据所述第一用户语句通过行为识别模型确定所述第一用户行为为异常行为,其中,所述异常行为是所述对话系统无法正常处理的行为。The determining module is configured to determine that the first user behavior is an abnormal behavior through a behavior recognition model according to the first user statement, wherein the abnormal behavior is a behavior that the dialogue system cannot handle normally.
所述回复模块用于在所述异常行为是所述对话系统能够识别,但是无法执行的行为的情况下,识别所述异常行为无法被执行的原因,并生成对所述异常行为进行回复的第一回复语句,其中,所述第一回复语句用于提示所述第一用户行为不能被执行的原因。或者,The reply module is used to identify the reason why the abnormal behavior cannot be executed when the abnormal behavior is a behavior that can be recognized by the dialog system but cannot be executed, and generate a first response to the abnormal behavior. A reply sentence, wherein the first reply sentence is used to prompt the reason why the first user action cannot be executed. or,
所述回复模块还用于在所述异常行为是所述对话系统无法识别的行为的情况下,根据所述第一用户语句识别用户意图,并生成对所述异常行为进行回复的第二回复语句,其中,所述第二回复语句用于提示所述对话系统不支持所述用户意图。The reply module is also used to identify the user's intention according to the first user sentence and generate a second reply sentence for replying to the abnormal behavior when the abnormal behavior is a behavior that cannot be recognized by the dialog system , wherein the second reply sentence is used to prompt that the dialogue system does not support the user intention.
在一些可能的设计中,所述回复模块还用于根据所述异常行为无法被执行的原因查找对应的第一模板,其中,所述第一模板包含了所述第一用户行为关联的第一槽位;通过槽位识别模型获取用于填充所述第一槽位的第一槽位信息;将所述第一槽位信息填入所述第一槽位,得到所述第一回复语句。In some possible designs, the reply module is further configured to search for a corresponding first template according to the reason why the abnormal behavior cannot be executed, where the first template includes the first template associated with the first user behavior. Slot: Obtaining first slot information for filling the first slot through a slot identification model; filling the first slot information into the first slot to obtain the first reply statement.
在一些可能的设计中,所述回复模块还用于查找第二模板,其中,所述第二模板包括第二槽位;获取所述第一用户行为的第一关联用户行为,其中,所述第一关联用户行为是与所述第一用户行为的相关度大于阈值的用户行为;将所述第一关联用户行为填入所述第二槽位,得到第三回复语句,其中,所述第三回复语句用于提示所述对话系统能够执行所述第一关联用户行为。In some possible designs, the reply module is also used to search for a second template, where the second template includes a second slot; acquire the first associated user behavior of the first user behavior, where the The first associated user behavior is a user behavior whose correlation with the first user behavior is greater than a threshold; fill the first associated user behavior into the second slot to obtain a third reply statement, wherein the first associated user behavior The three reply sentences are used to prompt the dialogue system to perform the first associated user behavior.
在一些可能的设计中,所述回复模块还用于查找第三模板,其中,所述第三模板包含了第三槽位;将所述用户意图填入所述第三槽位,得到所述第二回复语句。In some possible designs, the reply module is also used to search for a third template, where the third template includes a third slot; fill the user intention into the third slot to obtain the The second reply statement.
在一些可能的设计中,所述回复模块还用于查找第二模板,其中,所述第二模板包括第二槽位;获取用户输入的第二用户语句,其中,所述第二用户语句在所述第一用户语句之前,所述第二用户语句指示了第二用户行为;获取所述第二用户行为的第二关联用户行为,其中,所述第二关联用户行为是与所述第二用户行为的相关度大于阈值的用户行为;将所述第二关联用户行为填入所述第二槽位,从而得到第四回复语句,其中,所述第四回复语句用于提示所述对话系统能够执行的与所述第二用户行为相关的行为。In some possible designs, the reply module is also used to search for a second template, where the second template includes a second slot; acquire a second user sentence input by the user, where the second user sentence is in Before the first user statement, the second user statement indicates a second user behavior; obtain a second associated user behavior of the second user behavior, wherein the second associated user behavior is related to the second user behavior A user behavior whose correlation degree of user behavior is greater than a threshold value; filling the second associated user behavior into the second slot to obtain a fourth reply sentence, wherein the fourth reply sentence is used to prompt the dialog system An executable behavior related to the second user behavior.
在一些可能的设计中,所述回复模块还用于将所述第一用户语句输入用户意图识别模型,从而得到所述用户意图,其中,所述用户意图识别模型是通过已知用户语句以及已知用户意图进行训练得到的。其中,所述用户意图识别模型是分类器,所述分类器是K近邻分类器、支持向量机、决策树以及随机森林中的任意一种。In some possible designs, the reply module is further configured to input the first user sentence into a user intention recognition model, so as to obtain the user intention, wherein the user intention recognition model is based on known user sentences and existing learned from user intent training. Wherein, the user intention recognition model is a classifier, and the classifier is any one of a K-nearest neighbor classifier, a support vector machine, a decision tree, and a random forest.
第三方面,提供了一种计算机程序产品,当所述计算机程序产品被计算设备读取并执行时,如第一方面任一项所述的方法将被执行。In a third aspect, a computer program product is provided. When the computer program product is read and executed by a computing device, the method described in any one of the first aspect will be executed.
第四方面,提供了一种计算机非瞬态存储介质,包括指令,当所述指令在计算设备上运行时,使得所述计算设备执行如第一方面任一项所述的方法。In a fourth aspect, there is provided a computer non-transitory storage medium, including instructions, and when the instructions are run on a computing device, the computing device is made to execute the method according to any one of the first aspect.
第五方面,提供了一种智能终端,包括处理器和存储器,所述处理器执行所述存储器中的代码执行如第一方面任一项所述的方法。According to a fifth aspect, an intelligent terminal is provided, including a processor and a memory, and the processor executes codes in the memory to execute the method described in any one of the first aspect.
附图说明Description of drawings
为了更清楚地说明本申请实施例或背景技术中的技术方案,下面将对本申请实施例或背景技术中所需要使用的附图进行说明。In order to more clearly illustrate the technical solutions in the embodiment of the present application or the background art, the following will describe the drawings that need to be used in the embodiment of the present application or the background art.
图1是本申请涉及的一种任务型对话的应用场景的示意图;FIG. 1 is a schematic diagram of an application scenario of a task-based dialogue involved in the present application;
图2是本申请涉及的第一种情况的异常行为的任务型对话的示意图;Fig. 2 is a schematic diagram of the task-type dialogue of the abnormal behavior involved in the first case of the present application;
图3是本申请涉及的第二种情况的异常行为的任务型对话的示意图;Fig. 3 is a schematic diagram of the task-type dialogue of the abnormal behavior involved in the second situation of the present application;
图4是本申请涉及的针对第一种情况的异常行为采用第一回复语句进行回复的示意图;Fig. 4 is a schematic diagram of using the first reply sentence to reply to the abnormal behavior in the first case involved in this application;
图5是本申请涉及的针对第一种情况的异常行为采用第一回复语句和第三回复语句进行回复的示意图;Fig. 5 is a schematic diagram of using the first reply sentence and the third reply sentence to reply to the abnormal behavior in the first case involved in this application;
图6是本申请涉及的针对第二种情况的异常行为采用第二回复语句进行回复的示意图;Fig. 6 is a schematic diagram of using the second reply sentence to reply to the abnormal behavior in the second case involved in this application;
图7是本申请涉及的针对第二种情况的异常行为采用第二回复语句和第四回复语句进行回复的示意图;Fig. 7 is a schematic diagram of using the second reply sentence and the fourth reply sentence to reply to the abnormal behavior in the second case involved in this application;
图8是本申请提供的一种计算设备的结构示意图;FIG. 8 is a schematic structural diagram of a computing device provided by the present application;
图9是本申请提供的一种计算集群的结构示意图;FIG. 9 is a schematic structural diagram of a computing cluster provided by the present application;
图10是本申请提供的一种对话系统的结构示意图。Fig. 10 is a schematic structural diagram of a dialogue system provided by the present application.
具体实施方式Detailed ways
本申请的实施例部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。The terms used in the embodiments of the present application are only used to explain specific embodiments of the present invention, and are not intended to limit the present invention.
参阅图1,图1是本申请涉及的一种任务型对话的应用场景的示意图。在该应用场景下,用户与对话系统进行任务型对话。如图1所示,图1的右边是用户输入的用户语句,图1的左边是对话系统根据用户语句输出的回复语句。首先,用户输入用户语句“订去北京的飞机票。”,然后,对话系统输出回复语句“好的,为您找到明天八点从深圳到北京的机票,您需要预订吗?”。然后,用户再输入用户语句“帮我预订吧。”,对话系统输出回复语句“好的,已为您预订机票。请问还有什么需要帮忙吗?”。用户再输入用户语句“没有了,谢谢”。应理解,图1所示的应用场景仅仅是其中一种任务型对话的示例,在实际应用中,任务型对话还可以是关于打电话的对话、关于查询地理位置的对话、关于订外卖的对话、关于询问天气的对话以及关于订酒店的对话等等,此处不作具体限定。Referring to FIG. 1 , FIG. 1 is a schematic diagram of an application scenario of a task-based dialogue involved in the present application. In this application scenario, the user conducts a task-based dialogue with the dialogue system. As shown in Figure 1, the right side of Figure 1 is the user sentence input by the user, and the left side of Figure 1 is the reply sentence output by the dialog system according to the user sentence. First, the user enters the user sentence "Book an air ticket to Beijing." Then, the dialog system outputs a reply sentence "Okay, I found a flight ticket from Shenzhen to Beijing at 8 o'clock tomorrow for you. Do you need to book it?". Then, the user enters the user sentence "Book it for me." The dialogue system outputs a reply sentence "Okay, I have booked a flight ticket for you. Is there anything else I can help you with?". The user then inputs the user sentence "No, thank you". It should be understood that the application scenario shown in FIG. 1 is only an example of one of the task-type dialogues. In practical applications, the task-type dialogue may also be a dialogue about making a phone call, a dialogue about querying a geographic location, or a dialogue about ordering food delivery. , conversations about asking about the weather, conversations about booking a hotel, etc., are not specifically limited here.
在任务型对话中,用户输入的用户语句中通常包含用户行为。其中,所述用户行为是用户向对话系统提出要求的行为。以用户语句“订去北京的机票”为例,该用户语句向对话系统提出了订机票的要求,因此,该用户语句中包含了用户行为“订机票”。应理解,上述用户行为的举例仅仅是作为一种示例,其他的实施例中,用户行为还可以是“打电话”、“查询地理位置”、“订外卖”、“询问天气”以及“订酒店”等等,此处不作具体限定。In task-based dialogs, user actions are usually included in user sentences entered by users. Wherein, the user behavior is a behavior in which the user makes a request to the dialogue system. Take the user sentence "book an air ticket to Beijing" as an example. This user sentence puts forward a request to the dialogue system to book an air ticket. Therefore, this user sentence includes the user behavior "book a flight ticket". It should be understood that the above example of user behavior is only an example. In other embodiments, user behavior can also be "calling", "querying location", "ordering food", "asking about weather" and "booking a hotel". "Etc., no specific limitation is made here.
用户行为可以是对话系统将用户语句输入行为识别模型识别得到的。在一具体的实施例中,行为识别模型可以是分类器,例如,K近邻分类器、支持向量机、决策树以及随机森林等等,此处不作具体限定。行为识别模型可以根据对话系统支持的用户行为对分类进行划分。例如,对话系统支持的用户行为包括“订机票”、“打电话”、“订外卖”、“询问天气”以及“订酒店”,那么,该行为识别模型的分类就包括“订机票”、“打电话”、“订外卖”、“询问天气”以及“订酒店”。行为识别模型根据用户输入的用户语句“订去北京的机票”,可以确定应该归入“订机票”分类,从而识别该用户语句包含的用户行为是“订机票”。The user behavior may be recognized by the dialogue system inputting user sentences into the behavior recognition model. In a specific embodiment, the behavior recognition model may be a classifier, for example, a K-nearest neighbor classifier, a support vector machine, a decision tree, a random forest, etc., which are not specifically limited here. The action recognition model can classify according to the user actions supported by the dialogue system. For example, the user behaviors supported by the dialogue system include "booking air tickets", "making phone calls", "ordering food delivery", "asking about the weather" and "booking hotels", then the classification of the behavior recognition model includes "booking air tickets", " Call," "Order Food," "Ask the Weather," and "Book a Hotel." The behavior recognition model can determine that it should be classified into the category of "booking an air ticket" according to the user sentence "book a flight ticket to Beijing" input by the user, thereby identifying that the user behavior contained in the user sentence is "booking a flight ticket".
用户语句还可以包括槽位信息。其中,槽位信息是用于填充与用户行为相关的槽的值。以用户行为“订机票”为例,与“订机票”相关的槽位包括出发时间、出发地点以及目的地点。对应于上述与“订机票”相关的槽位,在用户语句“订明天十点从深圳到北京的机票”中,槽位信息包括出发时间=“明天十点”、出发地点=“深圳”以及目的地点=“北京”等等。对话系统需要将与用户行为相关的槽位都填充满,才能执行用户行为。举个例子说明,对话系统需要将“订机票”相关的槽位出发时间、出发地点以及目的地点都填充满了,才能执行“订机票”这个用户行为。User statements can also include slot information. Wherein, the slot information is a value used to fill slots related to user behavior. Taking the user behavior "booking a flight ticket" as an example, the slots related to "booking a flight ticket" include departure time, departure location, and destination point. Corresponding to the above-mentioned slots related to "booking an air ticket", in the user sentence "book an air ticket from Shenzhen to Beijing at ten o'clock tomorrow", the slot information includes departure time = "ten o'clock tomorrow", departure location = "Shenzhen" and Destination = "Beijing" and so on. The dialogue system needs to fill up all slots related to user actions before performing user actions. For example, the dialog system needs to fill up the departure time, departure location, and destination of the slots related to "booking a flight ticket" before it can perform the user behavior of "booking a flight ticket".
对话系统可以将用户语句输入槽位识别模型从而识别槽位信息。在一具体的实施例中,槽位识别模型可以是传统机器学习模型,例如条件随机场模型,循环卷积网络,或者词典搜索方法等等,此处不作具体限定。槽位识别模型可以提取用户对话中提供的关键信息。例如,订机票槽位类型包括“出发地”和“目的地”,槽位识别模型需要提取“出发地”和“目的地”的信息。槽位识别模型根据用户输入的用户语句“我要订北京到上海的机票”,识别得到结果是“出发地:北京”和“目的地:上海”,从而给对话系统提供槽位信息。The dialogue system can input user sentences into the slot identification model to identify slot information. In a specific embodiment, the slot recognition model may be a traditional machine learning model, such as a conditional random field model, a circular convolution network, or a dictionary search method, etc., which are not specifically limited here. The slot recognition model can extract key information provided in user dialogues. For example, the slot types of ticket booking include "departure place" and "destination place", and the slot recognition model needs to extract the information of "departure place" and "destination place". The slot recognition model is based on the user sentence input by the user "I want to book a flight ticket from Beijing to Shanghai", and the recognition results are "departure: Beijing" and "destination: Shanghai", thus providing slot information to the dialogue system.
可以理解,上述行为识别模型和槽位识别模型可以分别是两个不同的模型,也可以集成在同一个模型中,此处不作具体限定。It can be understood that the above-mentioned behavior recognition model and slot recognition model may be two different models, or may be integrated into the same model, which is not specifically limited here.
用户行为可以分为正常行为和异常行为两大类。其中,对话系统是基于用户行为是否属于对话系统支持的行为以及用户行为是否能够被执行区分用户行为是正常行为还是异常行为。如果用户行为是属于对话系统支持的行为,并且,用户行为可以被执行,则该用户行为是正常行为。反之,该用户行为是异常行为。其中,异常行为可以包括两种:第一种,异常行为是属于对话系统支持的,但是,不可以被执行的用户行为。第二种,异常行为是不属于对话系统支持的行为。User behavior can be divided into two categories: normal behavior and abnormal behavior. Wherein, the dialog system distinguishes whether the user behavior is a normal behavior or an abnormal behavior based on whether the user behavior is supported by the dialog system and whether the user behavior can be executed. If the user behavior is a behavior supported by the dialog system, and the user behavior can be executed, then the user behavior is a normal behavior. On the contrary, the user behavior is an abnormal behavior. Among them, the abnormal behavior may include two types: first, the abnormal behavior is a user behavior that is supported by the dialogue system but cannot be executed. Second, abnormal behavior is behavior that is not supported by the dialogue system.
对话系统可以通过以下方式判断用户行为是否是属于对话系统支持的行为:继续以分类器为例,假设分类器将用户行为划分为“订机票”、“打电话”、“订外卖”、“询问天气”以及“订酒店”等等多个分类。那么,如果用户输入的用户语句为“订回来的高铁票”,则分类器无法将其归入上述任何一个分类,此时,对话系统可以判断用户行为不是属于对话系统支持的行为。反之,对话系统可以判断用户行为是属于对话系统支持的行为。The dialogue system can judge whether the user behavior is a behavior supported by the dialogue system in the following way: Continuing to take the classifier as an example, suppose the classifier divides the user behavior into "booking a ticket", "calling", "ordering food", "asking Weather” and “Hotel Booking” and many other categories. Then, if the user statement entered by the user is "ordered a high-speed rail ticket", the classifier cannot classify it into any of the above categories. At this time, the dialogue system can judge that the user's behavior does not belong to the behavior supported by the dialogue system. On the contrary, the dialog system can judge that the user behavior belongs to the behavior supported by the dialog system.
对话系统可以通过以下方式判断用户行为是否能够被执行。以用户语句“订明天十点从深圳到北京的机票”为例,用户行为是“订机票”,槽位信息包括出发时间=“明天十点”、出发地点=“深圳”以及目的地点=“北京”。但是,对话系统进行搜索后发现,只搜索到明天八点从深圳到北京的航班,即,用户语句的槽位信息无法和检索结果进行匹配,于是,对话系统判断用户行为不能够被执行,反之,则对话系统判断用户行为能够被执行。The dialog system can judge whether the user action can be executed in the following ways. Take the user sentence "book an air ticket from Shenzhen to Beijing at ten o'clock tomorrow" as an example, the user behavior is "book an air ticket", and the slot information includes departure time = "ten o'clock tomorrow", departure location = "Shenzhen" and destination = " Beijing". However, after the dialogue system searches, it only finds the flight from Shenzhen to Beijing at 8:00 tomorrow, that is, the slot information of the user sentence cannot be matched with the search results, so the dialogue system judges that the user's behavior cannot be executed, and vice versa , the dialog system judges that the user action can be executed.
当用户行为是正常行为时,对话系统正常输出回复语句,具体可以参见图1,此处不再展开描述。When the user's behavior is normal, the dialogue system normally outputs reply sentences, as shown in Figure 1 for details, and will not be described here.
当用户行为是异常行为时,对话系统会输出“听不懂”“不能回答您的问题”诸如此类的回复语句。对应于上述的两种异常行为,下面将分别详细介绍对话系统在这两种异常行为下输出的回复语句。When the user's behavior is abnormal, the dialog system will output reply sentences such as "I don't understand" and "Can't answer your question". Corresponding to the above two abnormal behaviors, the reply sentences output by the dialogue system under these two abnormal behaviors will be introduced in detail below.
在第一种情况中,异常行为是属于对话系统支持的,但是,不可以被执行的行为。如图2所示,图2的右边是用户输入的用户语句,图2的左边是对话系统的回复语句。首先,用户输入用户语句“订明天去北京的飞机票。”,然后,对话系统确定用户行为“订机票”是属于对话系统支持的行为,根据该用户行为查找到明天上午八点从深圳到北京的飞机票,并输出回复语句“好的,为您找到明天上午八点从深圳到北京的飞机票,您需要预订吗”。用户继续输入用户语句“帮我换一张十点的飞机票”。对话系统确定用户行为“订机票”是属于对话系统支持的行为,但是,对话系统发现槽位信息出发时间=“明天十点”无法和检索结果匹配,对话系统输出回复语句“抱歉,我好像没听懂呢”。用户无法确定对话系统无法完成用户行为的原因,不知道对话该如何继续,导致对话失败。In the first case, abnormal behaviors are behaviors that are supported by the dialog system, but cannot be executed. As shown in Figure 2, the right side of Figure 2 is the user sentence input by the user, and the left side of Figure 2 is the reply sentence of the dialogue system. First, the user enters the user sentence "Book a flight ticket to Beijing tomorrow." Then, the dialog system determines that the user behavior "booking a flight ticket" is a behavior supported by the dialog system. According to the user behavior, it is found that the flight from Shenzhen to Beijing at 8:00 am tomorrow Air ticket, and output the reply sentence "Okay, I found the air ticket from Shenzhen to Beijing at 8 o'clock tomorrow morning for you, do you need to make a reservation". The user continues to input the user sentence "help me change an air ticket at ten o'clock". The dialogue system determines that the user behavior "booking an airline ticket" is a behavior supported by the dialogue system. However, the dialogue system finds that the slot information departure time = "10 o'clock tomorrow" cannot match the search result, and the dialogue system outputs a reply sentence "Sorry, I don't seem to have I understand." The user cannot determine the reason why the dialogue system cannot complete the user's behavior, and does not know how to continue the dialogue, resulting in the failure of the dialogue.
在第二种情况中,异常行为是不属于对话系统支持的行为。如图3所示,图3的右边是用户输入的用户语句,图3的左边是对话系统的回复语句。首先,用户输入用户语句“订明天去北京的飞机票”,然后,对话系统确定“订机票”的行为是属于用户支持的行为,根据该用户行为查找到明天上午八点从深圳到北京的飞机票,并输出回复语句“好的,为您找到明天上午八点从深圳到北京的飞机票,您需要预订吗”。用户继续输入用户语句“先看看后天有没有回来的高铁票吧”,但是,对话系统确定是不属于对话系统支持的行为,于是,输出回复语句“抱歉,我好像没听懂呢”。用户无法确定对话系统无法完成用户行为的原因,不知道对话该如何继续,导致对话失败。In the second case, abnormal behavior is behavior that is not supported by the dialog system. As shown in Figure 3, the right side of Figure 3 is the user sentence input by the user, and the left side of Figure 3 is the reply sentence of the dialogue system. First, the user enters the user sentence "book a plane ticket to Beijing tomorrow", and then, the dialog system determines that the behavior of "booking a plane ticket" belongs to the behavior supported by the user, and finds out the plane from Shenzhen to Beijing at 8:00 tomorrow morning based on this user behavior ticket, and output the reply sentence "Okay, I found the plane ticket from Shenzhen to Beijing at 8:00 tomorrow morning for you, do you need to make a reservation". The user continues to input the user sentence "Let's see if there is a high-speed rail ticket coming back the day after tomorrow", but the dialogue system determines that it is not a behavior supported by the dialogue system, so it outputs the reply sentence "Sorry, I don't seem to understand it". The user cannot determine the reason why the dialogue system cannot complete the user's behavior, and does not know how to continue the dialogue, resulting in the failure of the dialogue.
上述方法中,当用户行为是异常行为时,对话系统只会简单地输出“听不懂”“不能回答您的问题”诸如此类的回复语句,导致用户陷入困惑,无法确定对话系统无法完成用户行为的原因,造成对话无法继续进行,最终导致对话失败。In the above method, when the user's behavior is abnormal, the dialogue system will simply output reply sentences such as "I don't understand" and "Can't answer your question", which makes the user confused and unable to determine whether the dialogue system cannot complete the user's behavior. cause, the dialogue cannot continue, and eventually the dialogue fails.
针对两种不同的异常行为,对话系统可以通过两种不同的方式进行处理,下面将分别进行详细的介绍。For two different abnormal behaviors, the dialog system can handle them in two different ways, which will be described in detail below.
针对于第一种异常行为,对话系统可以直接提示用户行为不能执行的原因。如图4所示,图4的右边是用户输入的用户语句,图4的左边是对话系统的回复语句。首先,用户输入用户语句“订明天去北京的飞机票。”,然后,对话系统确定用户行为“订机票”是对话系统支持的行为,根据该用户行为查找到明天上午八点从深圳到北京的飞机票,并输出回复语句“好的,为您找到明天上午八点从深圳到北京的飞机票,您需要预订吗”。用户继续输入用户语句“帮我换一张十点的飞机票”。对话系统确定用户行为“订机票”是对话系统支持的行为,但是,对话系统发现槽位信息出发时间=“明天十点”无法和检索结果匹配,对话系统输出“抱歉,该日从深圳到北京的航班只有这一班”的回复语句。用户从对话系统输出的回复语句明确知道无法执行“订机票”用户行为的原因,于是,用户继续输入用户语句“好吧,就这一张吧”。对话系统确定“订机票”的用户行为是属于对话系统支持的行为,执行“订机票”的用户行为,并输出“好吧,已为您预订航班”。For the first abnormal behavior, the dialog system can directly prompt the user why the behavior cannot be executed. As shown in Figure 4, the right side of Figure 4 is the user sentence input by the user, and the left side of Figure 4 is the reply sentence of the dialogue system. First, the user enters the user sentence "book a plane ticket to Beijing tomorrow." Then, the dialogue system determines that the user behavior "booking a plane ticket" is a behavior supported by the dialogue system. Air ticket, and output the reply sentence "Okay, I found the air ticket from Shenzhen to Beijing at 8:00 tomorrow morning for you, do you need to make a reservation?" The user continues to input the user sentence "help me change an air ticket at ten o'clock". The dialogue system determines that the user behavior "booking an airline ticket" is a behavior supported by the dialogue system. However, the dialogue system finds that the slot information departure time = "10 o'clock tomorrow" cannot match the search result, and the dialogue system outputs "Sorry, this day is from Shenzhen to Beijing There is only this one flight" reply statement. The user clearly knows the reason why the user behavior of "booking a flight ticket" cannot be executed from the reply sentence output by the dialog system, so the user continues to input the user sentence "Okay, just this one". The dialog system determines that the user behavior of "booking a flight ticket" is a behavior supported by the dialog system, executes the user behavior of "booking a flight ticket", and outputs "OK, the flight has been booked for you".
将图2和图4进行对比可以发现,在图2对应的方法中,对话系统在无法执行“帮我换一张十点的飞机票”对应的用户行为时,会输出“抱歉,我好像没听懂呢”的回复语句,导致用户陷入困惑,无法确定对话系统无法完成用户行为的原因,造成对话无法继续进行,但是,在图4对应的方法中,对话系统在无法执行“帮我换一张十点的飞机票”对应的用户行为时,会输出“抱歉,该日从深圳到北京的航班只有这一班”的回复语句,用户很清楚地从对话系统输出的回复语句中知道对话系统无法完成用户行为的原因,及时调整对话方向,对话顺利进行。Comparing Figure 2 and Figure 4, it can be found that in the method corresponding to Figure 2, when the dialogue system cannot perform the user behavior corresponding to "help me change a ten o'clock air ticket", it will output "Sorry, I don't seem to have Do you understand?" caused the user to be confused and unable to determine the reason why the dialogue system could not complete the user's behavior, resulting in the inability to continue the dialogue. When the user behaves corresponding to "an air ticket at ten o'clock", the reply sentence of "Sorry, there is only one flight from Shenzhen to Beijing that day" will be output. The user can clearly know from the reply sentence output by the dialogue system The reason why the user behavior cannot be completed, adjust the direction of the dialogue in time, and the dialogue proceeds smoothly.
在一具体的实施方式中,对话系统输出的第一回复语句“抱歉,该日从深圳到北京的航班只有这一班”可以是通过以下方式生成的:对话系统获取对应的第一模板“抱歉,该日从{出发地点}到{目的地点}的航班只有这一班”,然后,对话系统从用户语句“订明天去北京的飞机票”中获取到槽位信息目的地点为“北京”,并从全球定位系统中获取到槽位信息出发地点为“深圳”(出发地点默认为当前定位地点)。之后,对话系统将出发地点和目的地点填入第一模板中的{出发地点}以及{目的地点},从而得到“抱歉,该日从深圳到北京的航班只有这一班”。In a specific implementation, the first reply sentence output by the dialogue system "Sorry, there is only one flight from Shenzhen to Beijing on this day" can be generated in the following way: The dialogue system obtains the corresponding first template "Sorry , there is only one flight from {departure point} to {destination point} on this day", then, the dialog system obtains the slot information destination point as "Beijing" from the user sentence "book a plane ticket to Beijing tomorrow", And the starting point of the slot information obtained from the global positioning system is "Shenzhen" (the starting point is the current location by default). Afterwards, the dialogue system fills the departure point and destination point into the {departure point} and {destination point} in the first template, thus obtaining "Sorry, there is only one flight from Shenzhen to Beijing on that day".
在一具体的实施方式中,对话系统获取对应的第一模板可以是通过以下方式实现的:对话系统获得用户行为“订机票”,查询机票数据库,确定用户行为无法执行的原因为没有找到符合用户需求的航班信息,从而得到“通知无票”的系统行为。对话系统根据“通知无票”系统行为的类别,从多个模块查找到对应中的第一模板,其中,多个系统行为与多个模板之间的对应关系可以是预先设置的。In a specific implementation manner, the dialog system may acquire the corresponding first template in the following manner: the dialog system obtains the user behavior "booking an airline ticket", queries the airline ticket database, and determines that the reason why the user behavior cannot be executed is that no matching user is found. The required flight information, so as to get the system behavior of "notify that there is no ticket". According to the category of the "notification without ticket" system behavior, the dialogue system finds the corresponding first template from multiple modules, wherein the correspondence between multiple system behaviors and multiple templates may be preset.
对话系统除了能够直接提示当前用户行为不能执行的原因之外,还可以提示对话系统支持的其他用户行为,例如,对话系统可以提示与当前用户行为相关性比较大的用户行为。如图5所示,图5的右边是用户输入的用户语句,图5的左边是对话系统的回复语句。首先,用户输入用户语句“订明天去北京的飞机票。”,然后,对话系统确定用户行为“订机票”是对话系统支持的行为,根据该用户行为查找到明天上午八点从深圳到北京的飞机票,并输出回复语句“好的,为您找到明天上午八点从深圳到北京的飞机票,您需要预订吗”。用户继续输入用户语句“帮我换一张十点的飞机票”。对话系统确定用户行为“订机票”是对话系统支持的行为,但是,对话系统发现槽位信息出发时间=“明天十点”无法和检索结果匹配,对话系统输出“抱歉,该日从深圳到北京的航班只有这一班”的第一回复语句之外,还输出了“您可以继续订机票或者查询推荐机票信息”的第三回复语句。用户从对话系统输出的第一回复语句明确知道无法执行“订机票”用户行为的原因,还通过第三回复语句清楚地知道对话系统支持的其他用户行为。于是,用户继续输入用户语句“好吧,就这一张吧”。对话系统确定“订机票”的用户行为是属于对话系统支持的行为,执行“订机票”的用户行为,并输出“好吧,已为您预订航班”。In addition to directly prompting the reason why the current user behavior cannot be executed, the dialog system can also prompt other user behaviors supported by the dialog system. For example, the dialog system can prompt user behaviors that are more relevant to the current user behavior. As shown in Figure 5, the right side of Figure 5 is the user sentence input by the user, and the left side of Figure 5 is the reply sentence of the dialogue system. First, the user enters the user sentence "book a plane ticket to Beijing tomorrow." Then, the dialogue system determines that the user behavior "booking a plane ticket" is a behavior supported by the dialogue system. Air ticket, and output the reply sentence "Okay, I found the air ticket from Shenzhen to Beijing at 8:00 tomorrow morning for you, do you need to make a reservation?" The user continues to input the user sentence "help me change an air ticket at ten o'clock". The dialogue system determines that the user behavior "booking an airline ticket" is a behavior supported by the dialogue system. However, the dialogue system finds that the slot information departure time = "10 o'clock tomorrow" cannot match the search result, and the dialogue system outputs "Sorry, this day is from Shenzhen to Beijing In addition to the first reply statement of "there is only this one flight", the third reply statement of "you can continue to book air tickets or check the recommended ticket information" is also output. From the first reply sentence output by the dialog system, the user clearly knows the reason why the user behavior of "booking a flight ticket" cannot be performed, and also clearly knows other user behaviors supported by the dialog system through the third reply sentence. Therefore, the user continues to input the user sentence "well, just this one". The dialog system determines that the user behavior of "booking a flight ticket" is a behavior supported by the dialog system, executes the user behavior of "booking a flight ticket", and outputs "OK, the flight has been booked for you".
这里,对话系统清晰地指出了对话系统支持的用户行为,因此,能够很好地引导用户对话的方向,使得对话能够更清楚地进行。Here, the dialogue system clearly points out the user behaviors supported by the dialogue system, so it can well guide the direction of the user's dialogue, so that the dialogue can be carried out more clearly.
在一具体的实施方式中,对话系统输出的第三回复语句“您可以继续订机票或者查询推荐机票信息”可以是通过以下方式生成的:对话系统获取对应的第二模板“您可以继续{推荐用户行为1}或者{推荐用户行为2}”,然后,对话系统根据用户语句“帮我换一张十点的飞机票”对应的用户行为“订机票”,在用户行为列表中查找到与用户行为“订机票”相关性较大的用户行为“提供机票信息”以及“查询推荐机票信息”。之后,对话系统将“提供机票信息”和“查询推荐机票信息”填入第二模板中的{推荐用户行为1}以及{推荐用户行为2},从而得到第三回复语句“您可以继续订机票或者查询推荐机票信息”。In a specific implementation manner, the third reply sentence "You can continue to book tickets or query recommended ticket information" output by the dialogue system may be generated in the following manner: the dialogue system obtains the corresponding second template "You can continue to {recommended User Behavior 1} or {Recommended User Behavior 2}", and then, the dialogue system finds the corresponding user behavior in the user behavior list according to the user behavior "booking a flight ticket" corresponding to the user sentence "help me change a plane ticket at ten o'clock". The user behaviors of "booking air tickets" and "providing air ticket information" and "querying recommended air ticket information" are more relevant. Afterwards, the dialogue system fills in the {recommended user behavior 1} and {recommended user behavior 2} in the second template with "provide air ticket information" and "query recommended air ticket information", so as to get the third reply sentence "You can continue to book air tickets Or check the recommended air ticket information".
在一具体的实施方式中,用户行为列表可以预先设置在对话系统中。其中,用户行为列表包括对话系统能够支持的多个用户行为。在用户行为列表设置完毕之后,对话系统可以保持用户行为列表不变,也可以在使用的过程中对用户行为列表进行删除、添加以及更新用户行为等操作。在一具体的实施例中,用户行为列表可以如表1所示:In a specific implementation manner, the user behavior list can be preset in the dialogue system. Wherein, the user behavior list includes multiple user behaviors that the dialogue system can support. After the user behavior list is set, the dialogue system can keep the user behavior list unchanged, and can also delete, add, and update the user behavior list during use. In a specific embodiment, the user behavior list can be as shown in Table 1:
表1用户行为列表Table 1 User Behavior List
应理解,上述用户行为列表仅仅是一种示例,在其他的实施例中,用户行为列表还可以包括更多或者更少用户行为,并且,用户行为列表中的用户行为还可以与表1中的用户行为部分相同或者完全不同,此处不应该构成具体限定。It should be understood that the above user behavior list is only an example. In other embodiments, the user behavior list may also include more or less user behaviors, and the user behaviors in the user behavior list may also be the same as those in Table 1. User behaviors are partly the same or completely different, which should not be construed as specific limitations here.
在一具体的实施方式中,对话系统获取对应的第二模板可以是通过以下方式实现的:对话系统获得用户行为“订机票”,查询机票数据库,没有找到符合用户需求的航班信息,从而得到“提示用户行为”的系统行为。对话系统根据“提示用户行为”系统行为的类别,从多个模板查找到对应中的第二模板,其中,多个系统行为与多个模板之间的对应关系可以是预先设置的。In a specific implementation, the dialogue system can obtain the corresponding second template in the following manner: the dialogue system obtains the user behavior "booking an airline ticket", queries the airline ticket database, and finds no flight information that meets the user's needs, thus obtaining " Prompt user behavior" system behavior. According to the category of the "Prompt User Behavior" system behavior, the dialog system finds the corresponding second template from the multiple templates, wherein the correspondence between the multiple system behaviors and the multiple templates may be preset.
在一具体的实施方式中,对话系统根据用户语句“帮我换一张十点的飞机票”对应的用户行为“订机票”,在用户行为列表中查找到与“订机票”相关性较高的的用户行为“提供机票信息”以及“查询推荐机票信息”可以是这样实现的:将用户行为进行分类,并将同一类的用户行为的相关度设置得比较高,不同类的用户行为的相关度设置得比较低。然后,根据目标用户行为从用户行为列表中选择出相关度比较高的用户行为进行推荐。以表1所示的用户行为列表为例,“订机票”、“提供机票信息”以及“查询推荐机票信息”为同属于“机票”类别的用户行为,而,“订酒店”的用户行为不属于“机票”类别的用户行为,因此,“订机票”、“提供机票信息”以及“查询推荐机票信息”的相关度可以设置得比较高,“订酒店”的相关度可以设置得比较低。对话系统可以根据目标用户行为为“订机票”,从用户行为列表中选择出相关度比较高的“提供机票信息”以及“查询推荐机票信息”进行推荐。In a specific implementation, the dialogue system finds in the list of user behaviors that it is highly correlated with "booking an air ticket" based on the user behavior "booking an air ticket" corresponding to the user sentence "help me change an air ticket at ten o'clock". The user behaviors of "providing air ticket information" and "querying recommended air ticket information" can be implemented as follows: classify user behaviors, and set the correlation of the same type of user behaviors to be relatively high, and the correlation of different types of user behaviors set to a lower degree. Then, according to the behavior of the target user, a user behavior with a relatively high correlation is selected from the user behavior list for recommendation. Taking the list of user behaviors shown in Table 1 as an example, "booking air tickets", "providing air ticket information" and "querying recommended air ticket information" are user behaviors that belong to the category of "air tickets", while the user behaviors of "booking hotels" are not User behaviors belonging to the category of "air tickets", therefore, the relevance of "booking air tickets", "providing air ticket information" and "querying recommended air ticket information" can be set relatively high, and the relevance of "booking hotels" can be set relatively low. According to the behavior of the target user as "booking air tickets", the dialogue system can select highly relevant "provide air ticket information" and "query recommended air ticket information" from the user behavior list for recommendation.
上述图4以及相关的例子仅仅是一种示例,不应构成具体的限定,在其他的实施方式中,还可以是其他场景下的对话,此处不作具体限定。The foregoing FIG. 4 and related examples are only examples and should not be construed as specific limitations. In other implementation manners, they may also be dialogues in other scenarios, which are not specifically limited here.
针对于第二种异常行为,对话系统可以识别用户意图,提示不支持用户意图对应的功能。如图6所示,图6的右边是用户输入的用户语句,图6的左边是对话系统的回复语句。首先,用户输入用户语句“订明天去北京的飞机票”,然后,对话系统确定用户行为“订机票”是对话系统支持的用户行为,根据用户行为查找到明天上午八点从深圳到北京的飞机票,并输出回复语句“好的,为您找到明天上午八点从深圳到北京的飞机票,您需要预订吗”。用户继续输入用户语句“先看看后天有没有回来的高铁票”。对话系统确定不属于对话系统支持的用户行为,于是,对话系统根据用户语句识别用户意图为“订高铁票”,并输出“抱歉,暂不支持订高铁票功能”。用户从对话系统输出的回复语句明确知道“订高铁票”是对话系统不支持的功能,于是,用户输入用户语句“那订明天八点的飞机票吧”。对话系统确定用户行为“订机票”是属于对话系统支持的用户行为,执行“订机票”的用户行为,并输出“好的,已为您预订航班”。For the second type of abnormal behavior, the dialogue system can identify the user's intention and prompt that the function corresponding to the user's intention is not supported. As shown in Figure 6, the right side of Figure 6 is the user sentence input by the user, and the left side of Figure 6 is the reply sentence of the dialogue system. First, the user enters the user sentence "book a plane ticket to Beijing tomorrow", and then the dialogue system determines that the user behavior "booking a plane ticket" is a user behavior supported by the dialogue system, and finds out the plane from Shenzhen to Beijing at 8:00 tomorrow morning based on the user behavior ticket, and output the reply sentence "Okay, I found the plane ticket from Shenzhen to Beijing at 8:00 tomorrow morning for you, do you need to make a reservation". The user continues to input the user sentence "first check whether there is a high-speed rail ticket coming back the day after tomorrow". The dialogue system determines that it does not belong to the user behavior supported by the dialogue system, so the dialogue system recognizes the user's intention as "booking a high-speed rail ticket" according to the user sentence, and outputs "Sorry, the function of booking a high-speed rail ticket is not supported for now". The user clearly knows from the reply sentence output by the dialog system that "booking a high-speed rail ticket" is a function not supported by the dialog system, so the user enters the user sentence "Then book an air ticket at 8:00 tomorrow." The dialog system determines that the user behavior "booking a flight ticket" is a user behavior supported by the dialog system, executes the user behavior of "booking a flight ticket", and outputs "OK, the flight has been booked for you".
将图3和图6进行对比可以发现,在图3对应的方法中,对话系统在遇到“订高铁票”这种对话系统无法支持的用户行为时,会输出“抱歉,我好像没听懂呢”的回复语句,导致用户陷入困惑,无法确定对话系统无法完成用户行为的原因,造成对话无法继续进行,但是,在图6对应的方法中,对话系统在遇到“订高铁票”这种对话系统无法支持的用户行为时,对话系统会根据用户语句识别用户意图,并输出“抱歉,暂不支持订高铁票功能”的第二回复语句,用户很清楚地从对话系统输出的回复语句中知道对话系统不支持订高铁票功能,及时调整对话方向,对话顺利进行。Comparing Figure 3 and Figure 6, it can be found that in the method corresponding to Figure 3, when the dialogue system encounters a user behavior that cannot be supported by the dialogue system such as "booking a high-speed rail ticket", it will output "Sorry, I don't seem to understand The reply sentence of "What?" caused the user to be confused and unable to determine the reason why the dialogue system could not complete the user's behavior, resulting in the inability to continue the dialogue. When the user behavior cannot be supported by the dialogue system, the dialogue system will recognize the user's intention according to the user sentence, and output the second reply sentence "Sorry, the function of ordering high-speed rail tickets is not supported at the moment". The user clearly understands from the reply sentence output by the dialogue system Knowing that the dialogue system does not support the function of ordering high-speed rail tickets, I adjusted the direction of the dialogue in time, and the dialogue went smoothly.
在一具体的实施方式中,对话系统输出的第二回复语句“抱歉,暂不支持订高铁票功能”可以是通过以下方式生成的:对话系统获取对应的第三模板“抱歉,暂不支持{用户意图}功能”,然后,对话系统根据用户语句“先看看后天有没有回来的高铁票”识别用户意图为“订高铁票”。之后,对话系统将用户意图“订高铁票”填入第三模板,从而得到“抱歉,暂不支持订高铁票功能”。In a specific implementation manner, the second reply sentence output by the dialog system "Sorry, the function of ordering high-speed rail tickets is not supported for now" may be generated in the following manner: the dialog system obtains the corresponding third template "Sorry, not supported for now { User intent} function”, and then, the dialogue system recognizes the user’s intention as “booking a high-speed rail ticket” based on the user sentence “First check if there is a high-speed rail ticket coming back the day after tomorrow”. Afterwards, the dialogue system fills in the third template with the user's intention of "booking high-speed rail tickets", and thus obtains "Sorry, the function of booking high-speed rail tickets is not supported for now".
在一具体的实施方式中,对话系统获取对应的第三模板可以是通过以下方式实现的:对话系统发现无法根据用户语句“先看看后天有没有回来的高铁票”将对应的用户行为分类到对话系统支持的任一个用户行为,因此确定对话系统不支持该用户行为,从而得到“通知不支持功能”的系统行为。对话系统根据“通知不支持功能”系统行为的类别,从多个模板查找到对应中的第三模板,其中,多个系统行为与多个模板之间的对应关系可以是预先设置的。In a specific implementation, the dialogue system can obtain the corresponding third template in the following manner: the dialogue system finds that it is impossible to classify the corresponding user behavior according to the user sentence "first check if there is a high-speed rail ticket coming back the day after tomorrow". Any user behavior supported by the dialog system, so it is determined that the user behavior is not supported by the dialog system, and thus the system behavior of "Notification does not support the function" is obtained. According to the category of the "notification does not support the function" system behavior, the dialog system finds the corresponding third template from the multiple templates, wherein the correspondence between the multiple system behaviors and the multiple templates may be preset.
在一具体的实施方式中,对话系统获取根据用户语句识别用户意图可以是通过以下方式实现的:对话系统可以将用户语句输入意图识别模型从而识别用户意图。在一具体的实施例中,意图识别模型可以是分类器,例如,K近邻分类器、支持向量机、决策树以及随机森林等等,此处不作具体限定。行为识别模型可以将用户意图分为与对话系统支持场景相关并在生活中常用的类别,例如,订高铁票、发信息、打开应用、搜索美食、打的士等等。意图识别模型根据用户输入的用户语句“先看看后天有没有回来的高铁票”,可以确定应该归入“订高铁票”分类,从而识别该用户语句包含的用户意图是“订高铁票”。In a specific implementation manner, the dialog system may realize the recognition of the user intention according to the user sentence in the following manner: the dialog system may input the user sentence into the intent recognition model to recognize the user intent. In a specific embodiment, the intent recognition model may be a classifier, for example, a K-nearest neighbor classifier, a support vector machine, a decision tree, a random forest, etc., which are not specifically limited here. The behavior recognition model can classify user intentions into categories related to dialogue system support scenarios and commonly used in daily life, such as ordering high-speed rail tickets, sending messages, opening applications, searching for food, taking taxis, and so on. According to the user sentence input by the user, the intention recognition model can determine whether there is a high-speed rail ticket coming back the day after tomorrow. It should be classified into the category of "booking a high-speed rail ticket", thereby identifying that the user intention contained in the user sentence is "booking a high-speed rail ticket".
在一具体的实施方式中,意图识别模型可以是对话系统通过大量已知用户语句以及大量已知用户意图进行训练得到的。下面以深度神经网络为例,对意图识别模型的训练过程进行详细的说明。In a specific implementation manner, the intention recognition model may be obtained by training the dialog system through a large number of known user sentences and a large number of known user intentions. The following takes the deep neural network as an example to describe the training process of the intent recognition model in detail.
对意图识别模型的训练的本质是通过训练的过程确定深度神经网络中的权重矩阵。具体地:深度神经网络中的每一层的工作可以用数学表达式来描述:从物理层面深度神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练深度神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。The essence of training the intent recognition model is to determine the weight matrix in the deep neural network through the training process. Specifically: the work of each layer in a deep neural network can be expressed mathematically To describe: From the physical level, the work of each layer in the deep neural network can be understood as completing the transformation from the input space to the output space (that is, the row space of the matrix to the column space) through five operations on the input space (a collection of input vectors). Space), these five operations include: 1. Dimension up/down; 2. Zoom in/out; 3. Rotate; 4. Translation; 5. "Bending". Among them, the operations of 1, 2, and 3 are performed by Complete, the operation of 4 is completed by +b, and the operation of 5 is realized by a(). The reason why the word "space" is used here is because the classified object is not a single thing, but a kind of thing, and space refers to the collection of all individuals of this kind of thing. Wherein, W is a weight vector, and each value in the vector represents the weight value of a neuron in this layer of neural network. The vector W determines the space transformation from the input space to the output space described above, that is, the weight W of each layer controls how to transform the space. The purpose of training the deep neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vector W of many layers). Therefore, the training process of the neural network is essentially to learn the way to control the spatial transformation, and more specifically, to learn the weight matrix.
对意图识别模型的训练的过程就是通过更新权重不断地缩小深度神经网络的预测值和目标值之间差异的过程。因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到深度神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(lossfunction)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。具体地,将一个已知用户语句输入深度神经网络,通过正向传播就可以得到一个预测值。然后,通过将该已知用户语句对应的已知用户意图进行比较,从而得到两者之间的差异值,根据该差异值进行反向传播,就可以更新每一层神经网络的权重向量W。不断地使用大量已知用户语句以及其对应的大量已知用户意图调整权重向量W,直达深度神经网络能够预测出真正想要的目标值。The process of training the intent recognition model is the process of continuously reducing the difference between the predicted value and the target value of the deep neural network by updating the weights. Because it is hoped that the output of the deep neural network is as close as possible to the value you really want to predict, you can compare the predicted value of the current network with the target value you really want, and then update each layer of neural network according to the difference between the two. The weight vector of the network (of course, there is usually an initialization process before the first update, which is to pre-configure parameters for each layer in the deep neural network). For example, if the network's predicted value is high, adjust the weight vector to make it The prediction is lower, and it is constantly adjusted until the deep neural network can predict the desired target value. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function (loss function) or objective function (objective function), which are used to measure the difference between the predicted value and the target value. equation. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference. Then the training of the deep neural network becomes a process of reducing the loss as much as possible. Specifically, a known user sentence is input into the deep neural network, and a predicted value can be obtained through forward propagation. Then, by comparing the known user intent corresponding to the known user sentence, the difference value between the two is obtained, and the weight vector W of each layer of the neural network can be updated by performing backpropagation according to the difference value. Continuously use a large number of known user sentences and their corresponding large number of known user intentions to adjust the weight vector W, until the deep neural network can predict the real desired target value.
在一具体的实施方式中,训练深度神经网络使用的大量已知用户语句可以是人工输入对话系统的,可以是对话系统自行获取用户与对话系统的历史对话得到的,也可以是通过自生产方式(self-play)的方式得到的。其中,自生产方式是通过人工设计一个能实现任务型对话逻辑的对话系统,和一个能够覆盖尽可能多的状态信息的用户模拟器。让用户模拟器与对话引擎进行自动交互,产生相应的对话数据(包含用户语句)。训练深度神经网络使用的大量已知用户意图可以是通过对大量已知用户语句进行人工标注得到的。In a specific implementation, a large number of known user sentences used in training the deep neural network can be manually input into the dialogue system, can be obtained by the dialogue system itself from the historical dialogue between the user and the dialogue system, or can be obtained through self-production (self-play) way. Among them, the self-production method is to manually design a dialogue system that can realize task-based dialogue logic, and a user simulator that can cover as much state information as possible. Allow the user simulator to automatically interact with the dialogue engine to generate corresponding dialogue data (including user sentences). A large number of known user intentions used in training deep neural networks can be obtained by manually labeling a large number of known user sentences.
对话系统除了能够直接提示不支持用户意图对应的功能之外,还可以提示对话系统支持的其他用户行为,例如,对话系统可以提示与当前用户行为相关性比较大的用户行为。如图7所示,图7的右边是用户输入的用户语句,图7的左边是对话系统的回复语句。首先,用户输入用户语句“订明天去北京的飞机票”,然后,对话系统确定用户行为“订机票”是对话系统支持的用户行为,根据用户行为查找到明天上午八点从深圳到北京的飞机票,并输出回复语句“好的,为您找到明天上午八点从深圳到北京的飞机票,您需要预订吗”。用户继续输入用户语句“先看看后天有没有回来的高铁票”。对话系统确定不属于对话系统支持的用户行为,于是,对话系统根据用户语句识别用户意图为“订高铁票”,输出“抱歉,暂不支持订高铁票功能”的回复语句,并且,还输出“您可以继续订机票或者查询推荐机票信息”的回复语句。用户从对话系统输出的回复语句明确知道“订高铁票”是对话系统不支持的功能,还清楚地知道对话系统支持的其他用户行为。于是,用户继续输入用户语句“那订明天八点的飞机票吧”。对话系统确定用户行为“订机票”是属于对话系统支持的用户行为,执行“订机票”的用户行为,并输出“好的,已为您预订航班”。In addition to directly prompting functions that do not support user intentions, the dialogue system can also prompt other user behaviors supported by the dialogue system. For example, the dialogue system can prompt user behaviors that are more relevant to the current user behavior. As shown in Figure 7, the right side of Figure 7 is the user sentence input by the user, and the left side of Figure 7 is the reply sentence of the dialogue system. First, the user enters the user sentence "book a plane ticket to Beijing tomorrow", and then the dialogue system determines that the user behavior "booking a plane ticket" is a user behavior supported by the dialogue system, and finds out the plane from Shenzhen to Beijing at 8:00 tomorrow morning based on the user behavior ticket, and output the reply sentence "Okay, I found the plane ticket from Shenzhen to Beijing at 8:00 tomorrow morning for you, do you need to make a reservation". The user continues to input the user sentence "first check whether there is a high-speed rail ticket coming back the day after tomorrow". The dialogue system determines that it does not belong to the user behavior supported by the dialogue system. Therefore, the dialogue system recognizes the user's intention as "booking a high-speed rail ticket" according to the user sentence, and outputs a reply sentence of "Sorry, the function of booking a high-speed rail ticket is not supported at the moment", and also outputs " You can continue to book air tickets or check recommended air ticket information" reply statement. From the reply sentence output by the dialogue system, the user clearly knows that "booking high-speed rail tickets" is a function not supported by the dialogue system, and also clearly knows other user behaviors supported by the dialogue system. Therefore, the user continues to input the user sentence "then book an air ticket at eight o'clock tomorrow". The dialog system determines that the user behavior "booking a flight ticket" is a user behavior supported by the dialog system, executes the user behavior of "booking a flight ticket", and outputs "OK, the flight has been booked for you".
在一具体的实施方式中,对话系统输出的第四回复语句“您可以继续订机票或者查询推荐机票信息”可以是通过以下方式生成的:对话系统获取对应的第二模板“您可以继续{推荐用户行为1}或者{推荐用户行为2}”,然后,对话系统根据上一句的用户语句“订明天去北京的飞机票”对应的用户行为“订机票”,在用户行为列表中查找到与用户行为“订机票”相关性较大的用户行为“提供机票信息”以及“查询推荐机票信息”。之后,对话系统将“提供机票信息”和“查询推荐机票信息”填入第二模板中的{推荐用户行为1}以及{推荐用户行为2},从而得到第四回复语句“您可以继续订机票或者查询推荐机票信息”。In a specific implementation manner, the fourth reply sentence "You can continue to book tickets or query recommended ticket information" output by the dialogue system may be generated in the following manner: the dialogue system obtains the corresponding second template "You can continue to {recommended User Behavior 1} or {Recommended User Behavior 2}", and then, the dialogue system finds the user behavior "booking an air ticket" corresponding to the user sentence "booking a plane ticket to Beijing tomorrow" in the user behavior list. The user behaviors of "booking air tickets" and "providing air ticket information" and "querying recommended air ticket information" are more relevant. Afterwards, the dialog system fills in the {recommended user behavior 1} and {recommended user behavior 2} in the second template with "provide air ticket information" and "query recommended air ticket information", so as to get the fourth reply sentence "You can continue to book air tickets Or check the recommended air ticket information".
上述图6、图7以及相关的例子仅仅是一种示例,不应构成具体的限定,在其他的实施方式中,还可以是其他场景下的对话,此处不作具体限定。The above-mentioned FIG. 6 , FIG. 7 and related examples are just examples and should not be construed as specific limitations. In other implementation manners, they may also be dialogues in other scenarios, which are not specifically limited here.
本申请提供的一种异常行为回复方法,能够明确提示用户对话系统无法执行异常行为的原因,从而提高了对话系统对异常行为的处理的鲁棒性。本申请实施例的的异常行为回复方法,包括以下步骤:The abnormal behavior reply method provided by the present application can clearly prompt the user why the dialog system cannot execute the abnormal behavior, thereby improving the robustness of the dialog system in handling abnormal behaviors. The abnormal behavior reply method of the embodiment of the present application includes the following steps:
S101:获取用户输入的第一用户语句。S101: Acquire a first user sentence input by a user.
在一具体的实施方式中,用户输入的第一用户语句中包含第一用户行为。其中,所述用户行为是用户向对话系统提出第一要求的行为。以第一用户语句“订去北京的机票”为例,所述第一用户语句向对话系统提出了“订机票”的第一要求,因此,第一用户语句中包含了第一用户行为“订机票”。应理解,上述第一用户行为的举例仅仅是作为一种示例,其他的实施例中,第一用户行为还可以是“打电话”、“查询地理位置”、“订外卖”、“询问天气”以及“订酒店”等等,此处不作具体限定。In a specific implementation manner, the first user sentence input by the user includes the first user behavior. Wherein, the user behavior is a behavior in which the user makes a first request to the dialogue system. Taking the first user sentence "book a flight ticket to Beijing" as an example, the first user sentence puts forward the first request of "booking a flight ticket" to the dialogue system. Air tickets". It should be understood that the above example of the first user behavior is only an example. In other embodiments, the first user behavior may also be "calling", "querying geographical location", "ordering takeaway", "asking about the weather" And "book a hotel", etc., which are not specifically limited here.
在一具体的实施方式中,第一用户行为可以是对话系统将第一用户语句输入行为识别模型识别得到的。其中,行为识别模型可以是分类器,例如,K近邻分类器、支持向量机、决策树以及随机森林等等,此处不作具体限定。行为识别模型可以根据对话系统支持的用户行为对分类进行划分。例如,对话系统支持的用户行为包括“订机票”、“打电话”、“订外卖”、“询问天气”以及“订酒店”,那么,该行为识别模型的分类就包括“订机票”、“打电话”、“订外卖”、“询问天气”以及“订酒店”。行为识别模型根据用户输入的用户语句“订去北京的机票”,可以确定应该归入“订机票”分类,从而识别该用户语句包含的用户行为是“订机票”。In a specific implementation manner, the first user behavior may be recognized by the dialog system inputting the first user sentence into the behavior recognition model. Wherein, the behavior recognition model may be a classifier, for example, a K-nearest neighbor classifier, a support vector machine, a decision tree, a random forest, etc., which are not specifically limited here. The action recognition model can classify according to the user actions supported by the dialogue system. For example, the user behaviors supported by the dialogue system include "booking air tickets", "making phone calls", "ordering food delivery", "asking about the weather" and "booking hotels", then the classification of the behavior recognition model includes "booking air tickets", " Call," "Order Food," "Ask the Weather," and "Book a Hotel." The behavior recognition model can determine that it should be classified into the category of "booking an air ticket" according to the user sentence "book a flight ticket to Beijing" input by the user, thereby identifying that the user behavior contained in the user sentence is "booking a flight ticket".
在一具体的实施方式中,第一用户语句还可以包括槽位信息。其中,槽位信息是用于填充与第一用户行为相关的槽的值。以第一用户行为“订机票”为例,与“订机票”相关的槽位包括出发时间、出发地点以及目的地点。对应于上述与“订机票”相关的槽位,在第一用户语句“订明天十点从深圳到北京的机票”中,槽位信息包括出发时间=“明天十点”、出发地点=“深圳”以及目的地点=“北京”等等。对话系统需要将与用户行为相关的槽位都填充满,才能执行用户行为。举个例子说明,对话系统需要将“订机票”相关的槽位出发时间、出发地点以及目的地点都填充满了,才能执行“订机票”这个用户行为。In a specific implementation manner, the first user sentence may further include slot information. Wherein, the slot information is a value used to fill a slot related to the first user behavior. Taking the first user behavior "booking a flight ticket" as an example, the slots related to "booking a flight ticket" include departure time, departure location, and destination point. Corresponding to the above-mentioned slots related to "booking air tickets", in the first user sentence "booking an air ticket from Shenzhen to Beijing at ten o'clock tomorrow", the slot information includes departure time = "ten o'clock tomorrow", departure location = "Shenzhen " and destination = "Beijing" and so on. The dialogue system needs to fill up all slots related to user actions before performing user actions. For example, the dialog system needs to fill up the departure time, departure location, and destination of the slots related to "booking a flight ticket" before it can perform the user behavior of "booking a flight ticket".
在一具体的实施方式中,槽位信息可以是对话系统将用户语句输入槽位识别模型得到的。其中,槽位识别模型可以是传统机器学习模型,例如条件随机场模型,循环卷积网络,或者词典搜索方法等等,此处不作具体限定。槽位识别模型可以提取用户对话中提供的关键信息。例如,订机票槽位类型包括“出发地”和“目的地”,槽位识别模型需要提取“出发地”和“目的地”的信息。槽位识别模型根据用户输入的用户语句“我要订北京到上海的机票”,识别得到结果是“出发地:北京”和“目的地:上海”,从而给对话系统提供槽位信息。In a specific implementation manner, the slot information may be obtained by the dialogue system inputting user sentences into the slot recognition model. Wherein, the slot recognition model may be a traditional machine learning model, such as a conditional random field model, a circular convolution network, or a dictionary search method, etc., which are not specifically limited here. The slot recognition model can extract key information provided in user dialogues. For example, the slot types of ticket booking include "departure place" and "destination place", and the slot recognition model needs to extract the information of "departure place" and "destination place". The slot recognition model is based on the user sentence input by the user "I want to book a flight ticket from Beijing to Shanghai", and the recognition results are "departure: Beijing" and "destination: Shanghai", thus providing slot information to the dialogue system.
S102:根据所述第一用户语句确定存在异常行为,其中,所述异常行为是所述对话系统无法正常处理的行为。S102: Determine that there is an abnormal behavior according to the first user sentence, where the abnormal behavior is a behavior that the dialog system cannot handle normally.
在一具体的实施方式中,异常行为可以包括两种:第一种,异常行为是属于对话系统支持的,但是,不可以被执行的用户行为。第二种,异常行为是不属于对话系统支持的行为。In a specific implementation manner, abnormal behaviors may include two types: first, abnormal behaviors are user behaviors that are supported by the dialog system but cannot be executed. Second, abnormal behavior is behavior that is not supported by the dialogue system.
在一具体的实施方式中,对话系统可以通过以下方式判断第一用户行为是否是属于对话系统支持的行为:继续以分类器为例,假设分类器将用户行为划分为“订机票”、“打电话”、“订外卖”、“询问天气”以及“订酒店”等等多个分类。那么,如果用户输入的用户语句为“订回来的高铁票”,则分类器无法将其归入上述任何一个分类,此时,对话系统可以判断用户行为不是属于对话系统支持的行为。反之,对话系统可以判断第一用户行为是属于对话系统支持的行为。In a specific implementation, the dialogue system can judge whether the first user behavior is a behavior supported by the dialogue system in the following manner: continue to take the classifier as an example, assuming that the classifier divides the user behavior into "booking an airline ticket", "playing phone calls”, “order takeout”, “ask weather” and “book hotel” and many other categories. Then, if the user statement entered by the user is "ordered a high-speed rail ticket", the classifier cannot classify it into any of the above categories. At this time, the dialogue system can judge that the user's behavior does not belong to the behavior supported by the dialogue system. On the contrary, the dialog system may determine that the first user behavior is a behavior supported by the dialog system.
在一具体的实施方式中,对话系统可以通过以下方式判断用户行为是否能够被执行。以用户语句“订明天十点从深圳到北京的机票”为例,用户行为是“订机票”,槽位信息包括出发时间=“明天十点”、出发地点=“深圳”以及目的地点=“北京”。但是,对话系统进行搜索后发现,只搜索到明天八点从深圳到北京的航班,即,用户语句的槽位信息无法和检索结果进行匹配,于是,对话系统判断用户行为不能够被执行,反之,则对话系统判断用户行为能够被执行。In a specific implementation manner, the dialogue system can determine whether the user action can be executed in the following manner. Take the user sentence "book an air ticket from Shenzhen to Beijing at ten o'clock tomorrow" as an example, the user behavior is "book an air ticket", and the slot information includes departure time = "ten o'clock tomorrow", departure location = "Shenzhen" and destination = " Beijing". However, after the dialogue system searches, it only finds the flight from Shenzhen to Beijing at 8:00 tomorrow, that is, the slot information of the user sentence cannot be matched with the search results, so the dialogue system judges that the user's behavior cannot be executed, and vice versa , the dialog system judges that the user action can be executed.
S103:在所述异常行为是所述对话系统能够识别,但是,无法执行的行为的情况下,识别所述异常行为无法被执行的原因,并生成对所述异常行为进行回复的第一回复语句。S103: In the case that the abnormal behavior is a behavior that can be recognized by the dialog system but cannot be executed, identify the reason why the abnormal behavior cannot be executed, and generate a first reply sentence for replying to the abnormal behavior .
在一具体的实施方式中,所述第一回复语句用于提示所述第一用户行为不能被执行的原因。以对话系统输出的第一回复语句“抱歉,该日从深圳到北京的航班只有这一班”为例,第一回复语句可以是通过以下方式生成的:对话系统获取对应的第一模板“抱歉,该日从{出发地点}到{目的地点}的航班只有这一班”,然后,对话系统从用户语句“订明天去北京的飞机票”中获取到槽位信息目的地点为“北京”,并从全球定位系统中获取到槽位信息出发地点为“深圳”(出发地点默认为当前定位地点)。之后,对话系统将出发地点和目的地点填入第一模板中的{出发地点}以及{目的地点},从而得到“抱歉,该日从深圳到北京的航班只有这一班”。In a specific implementation manner, the first reply statement is used to prompt the reason why the first user action cannot be executed. Taking the first reply sentence output by the dialog system "Sorry, there is only one flight from Shenzhen to Beijing on this day" as an example, the first reply sentence can be generated in the following way: the dialog system obtains the corresponding first template "Sorry , there is only one flight from {departure point} to {destination point} on this day", then, the dialog system obtains the slot information destination point as "Beijing" from the user sentence "book a plane ticket to Beijing tomorrow", And the starting point of the slot information obtained from the global positioning system is "Shenzhen" (the starting point is the current location by default). Afterwards, the dialogue system fills the departure point and destination point into the {departure point} and {destination point} in the first template, thus obtaining "Sorry, there is only one flight from Shenzhen to Beijing on that day".
在一具体的实施方式中,所述第一模板包含了所述第一用户行为关联的第一槽位。以第一模板“抱歉,该日从{出发地点}到{目的地点}的航班只有这一班”为例,第一槽位包括{出发地点}以及{目的地点}。In a specific implementation manner, the first template includes the first slot associated with the first user behavior. Taking the first template "Sorry, there is only one flight from {departure point} to {destination point} on this day" as an example, the first slot includes {departure point} and {destination point}.
在一具体的实施方式中,对话系统获取对应的第一模板可以是通过以下方式实现的:对话系统根据所述异常行为无法被执行的原因查找对应的第一模板,其中,所述第一模板包含了所述第一用户行为关联的第一槽位;获取用于填充与所述第一槽位的第一槽位信息;将所述第一槽位信息填入所述第一槽位,得到所述第一回复语句。举个例子说明,对话系统获得用户行为“订机票”,查询机票数据库,确定用户行为无法执行的原因为没有找到符合用户需求的航班信息,从而得到“通知无票”的系统行为。对话系统根据“通知无票”系统行为的类别,从多个模块查找到对应中的第一模板,其中,多个系统行为与多个模板之间的对应关系可以是预先设置的。In a specific implementation manner, the dialogue system may obtain the corresponding first template in the following manner: the dialogue system searches for the corresponding first template according to the reason why the abnormal behavior cannot be executed, wherein the first template Including the first slot associated with the first user behavior; acquiring first slot information used to fill the first slot; filling the first slot information into the first slot, Obtain the first reply statement. For example, the dialogue system obtains the user behavior "booking a flight ticket", queries the flight ticket database, and determines that the reason why the user behavior cannot be executed is that no flight information that meets the user's needs can be found, thus obtaining the system behavior of "notifying that there is no ticket". According to the category of the "notification without ticket" system behavior, the dialogue system finds the corresponding first template from multiple modules, wherein the correspondence between multiple system behaviors and multiple templates may be preset.
在一具体的实施方式中,对话系统还可以输出第三回复语句,其中,所述第三回复语句用于提示所述对话系统能够执行的行为。对话系统查找第二模板,其中,所述第二模板包括第二槽位;获取所述第一用户行为的第一关联用户行为,其中,所述第一关联用户行为是与所述第一用户行为的相关度大于阈值的用户行为;将所述第一关联用户行为填入所述第二槽位,从而得到第三回复语句。以对话系统输出的第三回复语句是“您可以继续订机票或者查询推荐机票信息”为例,第三回复语句可以是通过以下方式生成的:对话系统获取对应的第二模板“您可以继续{推荐用户行为1}或者{推荐用户行为2}”,然后,对话系统根据第一用户语句之前的第二用户语句“帮我换一张十点的飞机票”对应的用户行为“订机票”,在用户行为列表中查找到与用户行为“订机票”相关性较大的用户行为“提供机票信息”以及“查询推荐机票信息”。之后,对话系统将“提供机票信息”和“查询推荐机票信息”填入第二模板中的{推荐用户行为1}以及{推荐用户行为2},从而得到第三回复语句“您可以继续订机票或者查询推荐机票信息”。In a specific implementation manner, the dialog system may also output a third reply sentence, wherein the third reply sentence is used to prompt the dialog system to perform an action. The dialogue system searches for a second template, wherein the second template includes a second slot; obtains a first associated user behavior of the first user behavior, wherein the first associated user behavior is related to the first user behavior A user behavior whose behavior correlation is greater than a threshold; fill the first associated user behavior into the second slot, so as to obtain a third reply sentence. Taking the third reply sentence output by the dialog system as "You can continue to book tickets or query recommended flight ticket information" as an example, the third reply sentence can be generated in the following way: the dialog system obtains the corresponding second template "You can continue{ Recommend user behavior 1} or {recommended user behavior 2}", and then, the dialogue system "books an air ticket" according to the user behavior corresponding to the second user sentence before the first user sentence "Help me change an air ticket at ten o'clock", In the user behavior list, it is found that the user behaviors "providing airline ticket information" and "querying recommended airline ticket information" are relatively highly correlated with the user behavior "booking airline tickets". Afterwards, the dialogue system fills in the {recommended user behavior 1} and {recommended user behavior 2} in the second template with "provide air ticket information" and "query recommended air ticket information", so as to get the third reply sentence "You can continue to book air tickets Or check the recommended air ticket information".
在一具体的实施方式中,用户行为列表可以预先设置在对话系统中。其中,用户行为列表包括对话系统能够支持的多个用户行为。在用户行为列表设置完毕之后,对话系统可以保持用户行为列表不变,也可以在使用的过程中对用户行为列表进行删除、添加以及更新用户行为等操作。In a specific implementation manner, the user behavior list can be preset in the dialogue system. Wherein, the user behavior list includes multiple user behaviors that the dialogue system can support. After the user behavior list is set, the dialogue system can keep the user behavior list unchanged, and can also delete, add, and update the user behavior list during use.
在一具体的实施方式中,第二模板包括第二槽位。以第二模板“您可以继续{推荐用户行为1}或者{推荐用户行为2}”为例,第二槽位包括:{推荐用户行为1}以及{推荐用户行为2}”。In a specific embodiment, the second template includes a second slot. Taking the second template "You can continue with {recommended user behavior 1} or {recommended user behavior 2}" as an example, the second slot includes: {recommended user behavior 1} and {recommended user behavior 2}".
在一具体的实施方式中,对话系统获取对应的第二模板可以是通过以下方式实现的:对话系统获得用户行为“订机票”,查询机票数据库,没有找到符合用户需求的航班信息,从而得到“提示用户行为”的系统行为。对话系统根据“提示用户行为”系统行为的类别,从多个模板查找到对应中的第二模板,其中,多个系统行为与多个模板之间的对应关系可以是预先设置的。In a specific implementation, the dialogue system can obtain the corresponding second template in the following manner: the dialogue system obtains the user behavior "booking an airline ticket", queries the airline ticket database, and finds no flight information that meets the user's needs, thus obtaining " Prompt user behavior" system behavior. According to the category of the "Prompt User Behavior" system behavior, the dialog system finds the corresponding second template from the multiple templates, wherein the correspondence between the multiple system behaviors and the multiple templates may be preset.
在一具体的实施方式中,对话系统根据用户语句“帮我换一张十点的飞机票”对应的用户行为“订机票”,在用户行为列表中查找到与“订机票”相关性较高的的用户行为“提供机票信息”以及“查询推荐机票信息”可以是这样实现的:将用户行为进行分类,并将同一类的用户行为的相关度设置得比较高,不同类的用户行为的相关度设置得比较低。然后,根据目标用户行为从用户行为列表中选择出相关度比较高的用户行为进行推荐。以表1所示的用户行为列表为例,“订机票”、“提供机票信息”以及“查询推荐机票信息”为同属于“机票”类别的用户行为,而,“订酒店”的用户行为不属于“机票”类别的用户行为,因此,“订机票”、“提供机票信息”以及“查询推荐机票信息”的相关度可以设置得比较高,“订酒店”的相关度可以设置得比较低。对话系统可以根据目标用户行为为“订机票”,从用户行为列表中选择出相关度比较高的“提供机票信息”以及“查询推荐机票信息”进行推荐。In a specific implementation, the dialogue system finds in the list of user behaviors that it is highly correlated with "booking an air ticket" based on the user behavior "booking an air ticket" corresponding to the user sentence "help me change an air ticket at ten o'clock". The user behaviors of "providing air ticket information" and "querying recommended air ticket information" can be implemented as follows: classify user behaviors, and set the correlation of the same type of user behaviors to be relatively high, and the correlation of different types of user behaviors set to a lower degree. Then, according to the behavior of the target user, a user behavior with a relatively high correlation is selected from the user behavior list for recommendation. Taking the list of user behaviors shown in Table 1 as an example, "booking air tickets", "providing air ticket information" and "querying recommended air ticket information" are user behaviors that belong to the category of "air tickets", while the user behaviors of "booking hotels" are not User behaviors belonging to the category of "air tickets", therefore, the relevance of "booking air tickets", "providing air ticket information" and "querying recommended air ticket information" can be set relatively high, and the relevance of "booking hotels" can be set relatively low. According to the behavior of the target user as "booking air tickets", the dialogue system can select highly relevant "provide air ticket information" and "query recommended air ticket information" from the user behavior list for recommendation.
S104:在所述异常行为是所述对话系统无法识别的行为的情况下,根据所述第一用户语句识别用户意图,并生成对所述异常行为进行回复的第二回复语句。S104: In the case that the abnormal behavior is a behavior that cannot be recognized by the dialogue system, identify user intentions according to the first user statement, and generate a second reply statement for replying to the abnormal behavior.
在一具体的实施方式中,所述第二回复语句用于提示所述对话系统不支持所述用户意图。以对话系统输出的第二回复语句是“抱歉,暂不支持订高铁票功能”为例,第二回复语句可以是通过以下方式生成的:查找第三模板,将所述用户意图填入所述第三槽位,从而得到第二回复语句。以第三模板是“抱歉,暂不支持{用户意图}功能”为例,对话系统根据用户语句“先看看后天有没有回来的高铁票”识别用户意图为“订高铁票”。之后,对话系统将用户意图“订高铁票”填入第三模板,从而得到“抱歉,暂不支持订高铁票功能”。In a specific implementation manner, the second reply sentence is used to prompt that the dialogue system does not support the user intention. Taking the second reply sentence output by the dialogue system as "Sorry, the function of ordering high-speed rail tickets is not supported at the moment" as an example, the second reply sentence can be generated by the following method: find the third template, and fill in the user intention into the The third slot, so as to get the second reply statement. Taking the third template as "Sorry, the {user intent} function is not supported at this time" as an example, the dialogue system recognizes the user intention as "booking a high-speed rail ticket" based on the user sentence "First check if there is a high-speed rail ticket coming back the day after tomorrow". Afterwards, the dialogue system fills in the third template with the user's intention of "booking high-speed rail tickets", and thus obtains "Sorry, the function of booking high-speed rail tickets is not supported for now".
在一具体的实施方式中,对话系统获取对应的第三模板可以是通过以下方式实现的:对话系统发现无法根据用户语句“先看看后天有没有回来的高铁票”将对应的用户行为分类到对话系统支持的任一个用户行为,因此确定对话系统不支持该用户行为,从而得到“通知不支持功能”的系统行为。对话系统根据“通知不支持功能”系统行为的类别,从多个模板查找到对应中的第三模板,其中,多个系统行为与多个模板之间的对应关系可以是预先设置的。In a specific implementation, the dialogue system can obtain the corresponding third template in the following manner: the dialogue system finds that it is impossible to classify the corresponding user behavior according to the user sentence "first check if there is a high-speed rail ticket coming back the day after tomorrow". Any user behavior supported by the dialog system, so it is determined that the user behavior is not supported by the dialog system, and thus the system behavior of "Notification does not support the function" is obtained. According to the category of the "notification does not support the function" system behavior, the dialog system finds the corresponding third template from the multiple templates, wherein the correspondence between the multiple system behaviors and the multiple templates may be preset.
在一具体的实施方式中,对话系统获取根据用户语句识别用户意图可以是通过以下方式实现的:对话系统可以将用户语句输入意图识别模型从而识别用户意图。其中,意图识别模型可以是分类器,例如,K近邻分类器、支持向量机、决策树以及随机森林等等,此处不作具体限定。意图识别模型可以将用户意图分为与对话系统支持场景相关并在生活中常用的类别,例如,订高铁票、发信息、打开应用、搜索美食、打的士等等。意图识别模型根据用户输入的用户语句“先看看后天有没有回来的高铁票”,可以确定应该归入“订高铁票”分类,从而识别该用户语句包含的用户意图是“订高铁票”。In a specific implementation manner, the dialog system may realize the recognition of the user intention according to the user sentence in the following manner: the dialog system may input the user sentence into the intent recognition model to recognize the user intent. Wherein, the intent recognition model may be a classifier, for example, a K-nearest neighbor classifier, a support vector machine, a decision tree, a random forest, etc., which are not specifically limited here. The intent recognition model can classify user intent into categories related to dialogue system support scenarios and commonly used in daily life, such as ordering high-speed rail tickets, sending messages, opening applications, searching for food, taking taxis, and so on. According to the user sentence input by the user, the intention recognition model can determine whether there is a high-speed rail ticket coming back the day after tomorrow. It should be classified into the category of "booking a high-speed rail ticket", thereby identifying that the user intention contained in the user sentence is "booking a high-speed rail ticket".
在一具体的实施方式中,意图识别模型可以是对话系统通过大量已知用户语句以及大量已知用户意图进行训练得到的。下面以深度神经网络为例,对意图识别模型的训练过程进行详细的说明。In a specific implementation manner, the intention recognition model may be obtained by training the dialog system through a large number of known user sentences and a large number of known user intentions. The following takes the deep neural network as an example to describe the training process of the intent recognition model in detail.
对意图识别模型的训练的本质是通过训练的过程确定深度神经网络中的权重矩阵。具体地:深度神经网络中的每一层的工作可以用数学表达式来描述:从物理层面深度神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练深度神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。The essence of training the intent recognition model is to determine the weight matrix in the deep neural network through the training process. Specifically: the work of each layer in a deep neural network can be expressed mathematically To describe: From the physical level, the work of each layer in the deep neural network can be understood as completing the transformation from the input space to the output space (that is, the row space of the matrix to the column space) through five operations on the input space (a collection of input vectors). Space), these five operations include: 1. Dimension up/down; 2. Zoom in/out; 3. Rotate; 4. Translation; 5. "Bending". Among them, the operations of 1, 2, and 3 are performed by Complete, the operation of 4 is completed by +b, and the operation of 5 is realized by a(). The reason why the word "space" is used here is because the classified object is not a single thing, but a kind of thing, and space refers to the collection of all individuals of this kind of thing. Wherein, W is a weight vector, and each value in the vector represents the weight value of a neuron in this layer of neural network. The vector W determines the space transformation from the input space to the output space described above, that is, the weight W of each layer controls how to transform the space. The purpose of training the deep neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vector W of many layers). Therefore, the training process of the neural network is essentially to learn the way to control the spatial transformation, and more specifically, to learn the weight matrix.
对意图识别模型的训练的过程就是通过更新权重不断地缩小深度神经网络的预测值和目标值之间差异的过程。因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到深度神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(lossfunction)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。具体地,将一个已知用户语句输入深度神经网络,通过正向传播就可以得到一个预测值。然后,通过将该已知用户语句对应的已知用户意图进行比较,从而得到两者之间的差异值,根据该差异值进行反向传播,就可以更新每一层神经网络的权重向量W。不断地使用大量已知用户语句以及其对应的大量已知用户意图调整权重向量W,直达深度神经网络能够预测出真正想要的目标值。The process of training the intent recognition model is the process of continuously reducing the difference between the predicted value and the target value of the deep neural network by updating the weights. Because it is hoped that the output of the deep neural network is as close as possible to the value you really want to predict, you can compare the predicted value of the current network with the target value you really want, and then update each layer of neural network according to the difference between the two. The weight vector of the network (of course, there is usually an initialization process before the first update, which is to pre-configure parameters for each layer in the deep neural network). For example, if the network's predicted value is high, adjust the weight vector to make it The prediction is lower, and it is constantly adjusted until the deep neural network can predict the desired target value. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function (loss function) or objective function (objective function), which are used to measure the difference between the predicted value and the target value. equation. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference. Then the training of the deep neural network becomes a process of reducing the loss as much as possible. Specifically, a known user sentence is input into the deep neural network, and a predicted value can be obtained through forward propagation. Then, by comparing the known user intent corresponding to the known user sentence, the difference value between the two is obtained, and the weight vector W of each layer of the neural network can be updated by performing backpropagation according to the difference value. Continuously use a large number of known user sentences and their corresponding large number of known user intentions to adjust the weight vector W, until the deep neural network can predict the real desired target value.
在一具体的实施方式中,训练深度神经网络使用的大量已知用户语句可以是人工输入对话系统的,可以是对话系统自行获取用户与对话系统的历史对话得到的,也可以是通过自生产方式(self-play)的方式得到的。其中,自生产方式是通过人工设计一个能实现任务型对话逻辑的对话系统,和一个能够覆盖尽可能多的状态信息的用户模拟器。让用户模拟器与对话引擎进行自动交互,产生相应的对话数据(包含用户语句)。训练深度神经网络使用的大量已知用户意图可以是通过对大量已知用户语句进行人工标注得到的。In a specific implementation, a large number of known user sentences used in training the deep neural network can be manually input into the dialogue system, can be obtained by the dialogue system itself from the historical dialogue between the user and the dialogue system, or can be obtained through self-production (self-play) way. Among them, the self-production method is to manually design a dialogue system that can realize task-based dialogue logic, and a user simulator that can cover as much state information as possible. Allow the user simulator to automatically interact with the dialogue engine to generate corresponding dialogue data (including user sentences). A large number of known user intentions used in training deep neural networks can be obtained by manually labeling a large number of known user sentences.
参见图8,图8是本申请提供的一种对话系统的结构示意图。本申请实施例提供的对话系统包括:输入模块110、确定模块120以及回复模块130。Referring to FIG. 8 , FIG. 8 is a schematic structural diagram of a dialogue system provided by the present application. The dialogue system provided by the embodiment of the present application includes: an
所述输入模块110用于获取用户输入的第一用户语句,其中,所述第一用户语句指示了第一用户行为;The
所述确定模块120用于根据所述第一用户语句通过行为识别模型确定所述第一用户行为为异常行为,其中,所述异常行为是所述对话系统无法正常处理的行为;The
所述回复模块130用于在所述异常行为是所述对话系统能够识别,但是无法执行的行为的情况下,识别所述异常行为无法被执行的原因,并生成对所述异常行为进行回复的第一回复语句,其中,所述第一回复语句用于提示所述第一用户行为不能被执行的原因;或者The
所述回复模块130还用于在所述异常行为是所述对话系统无法识别的行为的情况下,根据所述第一用户语句识别用户意图,并生成对所述异常行为进行回复的第二回复语句,其中,所述第二回复语句用于提示所述对话系统不支持所述用户意图。The
为了简便陈述,本实施例并没有对第一回复语句、第二回复语句等等是如何生成的进行展开描述,具体请参见图1-5以及相关的描述。本实施例也没有对第三回复语句以及第四回复语句是如何生成的进行介绍,具体请参见图6、图7以及相关描述。For simplicity, this embodiment does not describe how the first reply sentence, the second reply sentence, etc. are generated. For details, please refer to FIGS. 1-5 and related descriptions. This embodiment also does not introduce how the third reply sentence and the fourth reply sentence are generated, please refer to FIG. 6 , FIG. 7 and related descriptions for details.
参见图9,图9是本申请提供的一种计算集群的结构示意图。图8所示的对话系统可以在如图9所示的计算集群中实现。计算集群包括包括至少一个计算节点210以及至少一个存储节点220。Referring to FIG. 9 , FIG. 9 is a schematic structural diagram of a computing cluster provided by the present application. The dialogue system shown in FIG. 8 can be implemented in a computing cluster as shown in FIG. 9 . The computing cluster includes at least one
计算节点210包括一个或多个处理器211、通信接口212和存储器213。其中,处理器211、通信接口212和存储器213之间可以通过总线224连接。
处理器211包括一个或者多个通用处理器,其中,通用处理器可以是能够处理电子指令的任何类型的设备,包括中央处理器(Central Processing Unit,CPU)、微处理器、微控制器、主处理器、控制器以及ASIC(Application Specific Integrated Circuit,专用集成电路)等等。它能够是仅用于计算节点210的专用处理器或者能够与其它计算节点210共享。处理器211执行各种类型的数字存储指令,例如存储在存储器213中的软件或者固件程序,它能使计算节点210提供较宽的多种服务。例如,处理器211能够执行程序或者处理数据,以执行本文讨论的方法的至少一部分。处理器211中可以运行如图8所示的输入模块、确定模块以及回复模块。The
通信接口212可以为有线接口(例如以太网接口),用于与其他计算节点或用户进行通信。The communication interface 212 may be a wired interface (such as an Ethernet interface) for communicating with other computing nodes or users.
存储器213可以包括易失性存储器(Volatile Memory),例如随机存取存储器(Random Access Memory,RAM);存储器也可以包括非易失性存储器(Non-VolatileMemory),例如只读存储器(Read-Only Memory,ROM)、快闪存储器(Flash Memory)、硬盘(Hard Disk Drive,HDD)或固态硬盘(Solid-State Drive,SSD)存储器还可以包括上述种类的存储器的组合。The
存储节点220包括一个或多个处理器221、通信接口222和存储器223。其中,处理器221、通信接口222和存储器223之间可以通过总线224连接。The
处理器221包括一个或者多个通用处理器,其中,通用处理器可以是能够处理电子指令的任何类型的设备,包括CPU、微处理器、微控制器、主处理器、控制器以及ASIC等等。它能够是仅用于存储节点220的专用处理器或者能够与其它存储节点220共享。处理器221执行各种类型的数字存储指令,例如存储在存储器223中的软件或者固件程序,它能使存储节点220提供较宽的多种服务。例如,处理器221能够执行程序或者处理数据,以执行本文讨论的方法的至少一部分。Processor 221 includes one or more general-purpose processors, wherein a general-purpose processor can be any type of device capable of processing electronic instructions, including CPUs, microprocessors, microcontrollers, main processors, controllers, and ASICs, etc. . It can be a dedicated processor for
通信接口222可以为有线接口(例如以太网接口),用于与其他计算设备或用户进行通信。The communication interface 222 may be a wired interface (such as an Ethernet interface) for communicating with other computing devices or users.
存储节点220包括一个或多个存储控制器221和存储阵列225。其中,存储控制器221和存储阵列225之间可以通过总线226连接。
存储控制器221包括一个或者多个通用处理器,其中,通用处理器可以是能够处理电子指令的任何类型的设备,包括CPU、微处理器、微控制器、主处理器、控制器以及ASIC等等。它能够是仅用于单个存储节点220的专用处理器或者能够与计算节点或者其它存储节点220共享。可以理解,在本实施例中,每个存储节点包括一个存储控制器,在其他的实施例中,也可以多个存储节点共享一个存储控制器,此处不作具体限定。The storage controller 221 includes one or more general-purpose processors, wherein the general-purpose processors may be any type of device capable of processing electronic instructions, including CPUs, microprocessors, microcontrollers, main processors, controllers, and ASICs, etc. wait. It can be a dedicated processor only for a
存储器阵列225可以包括多个存储器。存储器可以是非易失性存储器,例如ROM、快闪存储器、HDD或SSD存储器还可以包括上述种类的存储器的组合。例如,存储阵列可以是由多个HDD或者多个SDD组成,或者,存储阵列可以是由HDD以及SDD组成。其中,多个存储器在存储控制器221将的协助下按不同的方式组合起来形成存储器组,从而提供比单个存储器更高的存储性能和提供数据备份技术。可选地,存储器阵列225可以包括一个或者多个数据中心。多个数据中心可以设置在同一个地点,或者,分别在不同的地点,此处不作具体限定。存储器阵列225可以存储有程序代码以及数据库。其中,程序代码包括获取模块代码、确定模块代码以及回复模块代码。数据库包括:行为识别模型、槽位识别模型以及意图识别模型。
其中,所述计算节点211通过调用存储节点213中的程序代码,用于执行以下步骤:Wherein, the
获取用户输入的第一用户语句,其中,所述第一用户语句指示了第一用户行为;Acquiring a first user statement input by a user, wherein the first user statement indicates a first user behavior;
根据所述第一用户语句通过行为识别模型确定所述第一用户行为为异常行为,其中,所述异常行为是所述对话系统无法正常处理的行为;Determining that the first user behavior is an abnormal behavior through a behavior recognition model according to the first user statement, wherein the abnormal behavior is a behavior that the dialog system cannot handle normally;
在所述异常行为是所述对话系统能够识别,但是,无法执行的行为的情况下,识别所述异常行为无法被执行的原因,并生成对所述异常行为进行回复的第一回复语句,其中,所述第一回复语句用于提示所述第一用户行为不能被执行的原因;或者In the case that the abnormal behavior is a behavior that can be recognized by the dialog system but cannot be executed, identify the reason why the abnormal behavior cannot be executed, and generate a first reply statement for replying to the abnormal behavior, wherein , the first reply statement is used to prompt the reason why the first user action cannot be executed; or
在所述异常行为是所述对话系统无法识别的行为的情况下,根据所述第一用户语句识别用户意图,并生成对所述异常行为进行回复的第二回复语句,其中,所述第二回复语句用于提示所述对话系统不支持所述用户意图。In the case that the abnormal behavior is a behavior that cannot be recognized by the dialog system, identify the user's intention according to the first user sentence, and generate a second reply sentence for replying to the abnormal behavior, wherein the second The reply sentence is used to prompt that the dialogue system does not support the user intention.
为了简便陈述,本实施例并没有对第一回复语句、第二回复语句等等是如何生成的进行展开描述,具体请参见图1-5以及相关的描述。本实施例也没有对第三回复语句以及第四回复语句是如何生成的进行介绍,具体请参见图6、图7以及相关描述。For simplicity, this embodiment does not describe how the first reply sentence, the second reply sentence, etc. are generated. For details, please refer to FIGS. 1-5 and related descriptions. This embodiment also does not introduce how the third reply sentence and the fourth reply sentence are generated, please refer to FIG. 6 , FIG. 7 and related descriptions for details.
参见图10,图10是本申请提供的一种计算设备的结构示意图。图8所示的对话系统可以在如图10所示的计算设备中实现。在一具体的实施例中,计算设备可以是智能终端,本实施方式的计算设备包括一个或多个处理器311、通信接口312和存储器313。其中,处理器311、通信接口312和存储器313之间可以通过总线324连接。Referring to FIG. 10 , FIG. 10 is a schematic structural diagram of a computing device provided in the present application. The dialog system shown in FIG. 8 can be implemented in a computing device as shown in FIG. 10 . In a specific embodiment, the computing device may be a smart terminal, and the computing device in this embodiment includes one or
处理器311包括一个或者多个通用处理器,其中,通用处理器可以是能够处理电子指令的任何类型的设备,包括中央处理器(Central Processing Unit,CPU)、微处理器、微控制器、主处理器、控制器以及ASIC(Application Specific Integrated Circuit,专用集成电路)等等。处理器311执行各种类型的数字存储指令,例如存储在存储器313中的软件或者固件程序,它能使计算设备提供较宽的多种服务。例如,处理器311能够执行程序或者处理数据,以执行本文讨论的方法的至少一部分。处理器311中可以运行如图8所示的输入模块、确定模块以及回复模块。The
通信接口312可以为有线接口(例如以太网接口),用于与其他计算节点或用户进行通信。The
存储器313可以包括易失性存储器(Volatile Memory),例如随机存取存储器(Random Access Memory,RAM);存储器也可以包括非易失性存储器(Non-VolatileMemory),例如只读存储器(Read-Only Memory,ROM)、快闪存储器(Flash Memory)、硬盘(Hard Disk Drive,HDD)或固态硬盘(Solid-State Drive,SSD)存储器还可以包括上述种类的存储器的组合。存储器313可以存储有程序代码以及程序数据。其中,程序代码包括获取模块代码、确定模块代码以及回复模块代码。数据库包括:行为识别模型、槽位识别模型以及意图识别模型。The
其中,所述处理器311通过调用存储器313中的程序代码,用于执行以下步骤:Wherein, the
获取用户输入的第一用户语句,其中,所述第一用户语句指示了第一用户行为;Acquiring a first user statement input by a user, wherein the first user statement indicates a first user behavior;
根据所述第一用户语句通过行为识别模型确定所述第一用户行为为异常行为,其中,所述异常行为是所述对话系统无法正常处理的行为;Determining that the first user behavior is an abnormal behavior through a behavior recognition model according to the first user statement, wherein the abnormal behavior is a behavior that the dialog system cannot handle normally;
在所述异常行为是所述对话系统能够识别,但是,无法执行的行为的情况下,识别所述异常行为无法被执行的原因,并生成对所述异常行为进行回复的第一回复语句,其中,所述第一回复语句用于提示所述第一用户行为不能被执行的原因;或者In the case that the abnormal behavior is a behavior that can be recognized by the dialog system but cannot be executed, identify the reason why the abnormal behavior cannot be executed, and generate a first reply statement for replying to the abnormal behavior, wherein , the first reply statement is used to prompt the reason why the first user action cannot be executed; or
在所述异常行为是所述对话系统无法识别的行为的情况下,根据所述第一用户语句识别用户意图,并生成对所述异常行为进行回复的第二回复语句,其中,所述第二回复语句用于提示所述对话系统不支持所述用户意图。In the case that the abnormal behavior is a behavior that cannot be recognized by the dialog system, identify the user's intention according to the first user sentence, and generate a second reply sentence for replying to the abnormal behavior, wherein the second The reply sentence is used to prompt that the dialogue system does not support the user intention.
为了简便陈述,本实施例并没有对第一回复语句、第二回复语句等等是如何生成的进行展开描述,具体请参见图1-5以及相关的描述。本实施例也没有对第三回复语句以及第四回复语句是如何生成的进行介绍,具体请参见图6、图7以及相关描述。For simplicity, this embodiment does not describe how the first reply sentence, the second reply sentence, etc. are generated. For details, please refer to FIGS. 1-5 and related descriptions. This embodiment also does not introduce how the third reply sentence and the fourth reply sentence are generated, please refer to FIG. 6 , FIG. 7 and related descriptions for details.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、存储盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态存储盘Solid State Disk(SSD))等。In the above embodiments, all or part of them may be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (eg, coaxial cable, optical fiber, DSL) or wireless (eg, infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media. The available medium may be a magnetic medium (for example, a floppy disk, a storage disk, a magnetic tape), an optical medium (for example, DVD), or a semiconductor medium (for example, a Solid State Disk (SSD)).
Claims (16)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910395865.5A CN110232108B (en) | 2019-05-13 | 2019-05-13 | Man-machine conversation method and conversation system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910395865.5A CN110232108B (en) | 2019-05-13 | 2019-05-13 | Man-machine conversation method and conversation system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN110232108A CN110232108A (en) | 2019-09-13 |
| CN110232108B true CN110232108B (en) | 2023-02-03 |
Family
ID=67860565
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910395865.5A Active CN110232108B (en) | 2019-05-13 | 2019-05-13 | Man-machine conversation method and conversation system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN110232108B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110704592B (en) * | 2019-09-27 | 2021-06-04 | 北京百度网讯科技有限公司 | Statement analysis processing method, apparatus, computer equipment and storage medium |
| CN113407699A (en) * | 2021-06-30 | 2021-09-17 | 北京百度网讯科技有限公司 | Dialogue method, dialogue device, dialogue equipment and storage medium |
| CN113611316A (en) * | 2021-07-30 | 2021-11-05 | 百度在线网络技术(北京)有限公司 | Man-machine interaction method, device, equipment and storage medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106776926A (en) * | 2016-12-01 | 2017-05-31 | 竹间智能科技(上海)有限公司 | Improve the method and system of responsibility when robot talks with |
| CN107193978A (en) * | 2017-05-26 | 2017-09-22 | 武汉泰迪智慧科技有限公司 | A kind of many wheel automatic chatting dialogue methods and system based on deep learning |
| CN107562816A (en) * | 2017-08-16 | 2018-01-09 | 深圳狗尾草智能科技有限公司 | User view automatic identifying method and device |
| CN109145104A (en) * | 2018-09-29 | 2019-01-04 | 北京百度网讯科技有限公司 | For talking with interactive method and apparatus |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110692048B (en) * | 2017-03-20 | 2023-08-15 | 电子湾有限公司 | Detection of task changes during a session |
| US10847148B2 (en) * | 2017-07-14 | 2020-11-24 | International Business Machines Corporation | Dynamic personalized multi-turn interaction of cognitive models |
-
2019
- 2019-05-13 CN CN201910395865.5A patent/CN110232108B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106776926A (en) * | 2016-12-01 | 2017-05-31 | 竹间智能科技(上海)有限公司 | Improve the method and system of responsibility when robot talks with |
| CN107193978A (en) * | 2017-05-26 | 2017-09-22 | 武汉泰迪智慧科技有限公司 | A kind of many wheel automatic chatting dialogue methods and system based on deep learning |
| CN107562816A (en) * | 2017-08-16 | 2018-01-09 | 深圳狗尾草智能科技有限公司 | User view automatic identifying method and device |
| CN109145104A (en) * | 2018-09-29 | 2019-01-04 | 北京百度网讯科技有限公司 | For talking with interactive method and apparatus |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110232108A (en) | 2019-09-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11816439B2 (en) | Multi-turn dialogue response generation with template generation | |
| CN114600099B (en) | Natural language understanding based meta voice system using assistant system to improve voice recognition accuracy | |
| US11948058B2 (en) | Utilizing recurrent neural networks to recognize and extract open intent from text inputs | |
| CN112470144B (en) | Contextual autocompletion for assistant system | |
| US11393475B1 (en) | Conversational system for recognizing, understanding, and acting on multiple intents and hypotheses | |
| US9761225B2 (en) | Semantic re-ranking of NLU results in conversational dialogue applications | |
| US12424210B2 (en) | Natural language processing | |
| WO2020177282A1 (en) | Machine dialogue method and apparatus, computer device, and storage medium | |
| CN116018791A (en) | Make multi-person calls with a single request in the assistant system | |
| US11823082B2 (en) | Methods for orchestrating an automated conversation in one or more networks and devices thereof | |
| CN108182229A (en) | Information interacting method and device | |
| US12457182B2 (en) | Merging data from various content domains to train a machine learning model to generate predictions for a specific content domain | |
| CN110232108B (en) | Man-machine conversation method and conversation system | |
| CN112256863A (en) | Method and device for determining corpus intentions and electronic equipment | |
| CN117575008A (en) | Training sample generation method, model training method, knowledge question-answering method and knowledge question-answering device | |
| US11893994B1 (en) | Processing optimization using machine learning | |
| KR20200117381A (en) | Collective Intelligence Case-Based Reasoning System and its Method for user-customized recommendation | |
| US12164875B2 (en) | Social network adapted response | |
| CN118838998A (en) | Man-machine interaction method and device and computer readable storage medium | |
| CN111310462A (en) | User attribute determination method, device, equipment and storage medium | |
| CN120596745A (en) | Data processing, question recommendation method, device and computing equipment | |
| US20220180865A1 (en) | Runtime topic change analyses in spoken dialog contexts | |
| CN110795562B (en) | Graph optimization method, device, terminal and storage medium | |
| US20250232134A1 (en) | Conversational language model based content retrieval | |
| US12192405B2 (en) | Automated interactive voice response interaction using voice prompt classification machine learning frameworks |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |