Man-machine conversation method and device, robot device and computer readable storage medium
By identifying conceptual entities in user dialogue data and performing multiple detections, a target dialogue template is generated, which solves the problem of unintelligent robot responses in existing technologies and improves the intelligence of human-computer dialogue and user experience.
Patent Information
- Application Number
- CN202211700421.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-12-28
AI Technical Summary
Existing human-computer dialogue technology makes it difficult to make the robot's responses more intelligent. When users talk about topics of interest, the robot's answers are often conventional and cannot express ideas, opinions, or views, resulting in a poor user experience.
By identifying conceptual entities in user dialogue data and performing multiple detections to distinguish users' question-and-answer intentions, a dialogue template that is closer to the user's question-and-answer intentions is generated. This includes the detection of conceptual expression, conceptual query, and emotional expression, and the generation of a target dialogue template.
This has enabled the robot's responses to better reflect the user's intended meaning, improved the intelligence of human-computer dialogue and the user experience, and enhanced the interaction quality of the robot device.
Smart Images

Figure CN116186215B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of human-computer interaction, and in particular to a human-computer method and device, a robot device and a computer readable storage medium. BACKGROUND
[0002] With the development of artificial intelligence, artificial intelligence devices are widely used in all aspects of society, from smart cities to intelligent wear, all of which are rich in AI attributes. The popularity of intelligent devices provides a huge application space for voice control and intelligent dialogue. Intelligent dialogue has always been the key to improving the experience of intelligent devices.
[0003] However, existing human-computer dialogue technology often relies on a question and answer library. If the answer is not good enough, the question and answer library is added with questions and answers. This can certainly solve some problems, but it is difficult to make the robot's reply more intelligent. When the user experiences and talks about a topic of interest, the robot's answer is often quite standard, and cannot express ideas, opinions and views. The content of the answer often seems to be a superficial answer, and it is difficult to generate empathy with the user.
[0004] Therefore, there is an urgent need for a human-computer dialogue scheme that can better express the user's ideas. SUMMARY
[0005] To solve the above technical problems, the embodiments of the present application provide a human-computer dialogue method, device, robot device and computer readable storage medium, and the specific solutions are as follows:
[0006] In a first aspect, the embodiments of the present application provide a human-computer dialogue method, which comprises:
[0007] obtaining user dialogue data according to a preset starting instruction;
[0008] identifying an idea entity in the user dialogue data;
[0009] If the user dialogue data includes an idea entity, a first detection is performed according to the idea entity, and the first detection is used to detect whether the user dialogue data includes idea expression content;
[0010] If the user dialogue data does not include an idea entity, a second detection is performed according to the user dialogue data, and the second detection is used to detect whether the user dialogue data includes idea query content;
[0011] generating a target dialogue template according to the detection result of the first detection or the detection result of the second detection.
[0012] According to a specific embodiment of the present application, the step of obtaining user dialogue data according to a preset starting instruction comprises:
[0013] waiting for a preset time after receiving the preset starting instruction;
[0014] if the user inputs new user conversation data within the preset time, obtaining the user conversation data;
[0015] if the user does not input new user conversation data within the preset time, clearing the historical conversation information and ending the conversation.
[0016] According to a specific embodiment of the present application, the first detection according to the concept entity includes:
[0017] determining whether the user conversation data includes concept expression content according to the concept entity;
[0018] if the user conversation data includes the concept expression content, searching for the target conversation template in a corresponding reply template database according to the positive or negative type of the concept expression content and a preset reply strategy;
[0019] if the user conversation data does not include the concept expression content, jumping to the second detection according to the user conversation data.
[0020] According to a specific embodiment of the present application, the searching for the target conversation template in the corresponding reply template database according to the positive or negative type of the concept expression content and the preset reply strategy includes:
[0021] determining the positive or negative type of the concept expression content;
[0022] searching for the target conversation template in a reply template database corresponding to the positive or negative type;
[0023] if the reply template database includes a target conversation template with the same positive or negative type as the concept expression content, generating a target conversation template that agrees with the concept expression content according to a preset reply strategy;
[0024] if the reply template database does not include a target conversation template with the same positive or negative type as the concept expression content, generating a target conversation template that does not agree with the concept expression content according to a preset reply strategy.
[0025] According to a specific embodiment of the present application, the second detection according to the user conversation data includes:
[0026] determining whether the user conversation data includes concept inquiry content;
[0027] If the user dialogue data comprises the concept query content, the target dialogue template is searched in the corresponding reply template database according to the concept entity in the current user dialogue data and the concept entity in the historical user dialogue data.
[0028] If the user dialogue data does not comprise the concept query content, third detection is performed according to the concept entity.
[0029] According to a specific embodiment of the present application, the step of searching the target dialogue template in the corresponding reply template database according to the concept entity in the current user dialogue data and the concept entity in the historical user dialogue data comprises:
[0030] It is judged whether the current user dialogue data comprises a concept entity;
[0031] If the current user dialogue data comprises a concept entity, it is judged whether the current concept entity in the current user dialogue data is the same as the historical concept entity in the historical user dialogue data;
[0032] If the current concept entity is the same as the historical concept entity, it is judged whether the historical user dialogue data comprises a historical dialogue template for the current concept entity, if yes, a target dialogue template different from the historical dialogue template is searched in the corresponding reply template database, if not, a target dialogue template is searched in the corresponding reply template database according to the current concept entity;
[0033] If the current concept entity is different from the historical concept entity, a target dialogue template is searched in the corresponding reply template database according to the current concept entity;
[0034] If the current user dialogue data does not comprise a concept entity, a target dialogue template is searched in the safe reply template database.
[0035] According to a specific embodiment of the present application, the step of performing third detection according to the concept entity comprises:
[0036] It is judged whether the user dialogue data comprises emotional expression content according to the concept entity;
[0037] If the user dialogue data comprises emotional expression content, the target dialogue template is searched in the corresponding reply template database according to the positive or negative type of the emotional expression content and a preset reply strategy;
[0038] If the user dialogue data does not comprise emotional expression content, the target dialogue template is searched in the ordinary reply template database.
[0039] In a second aspect, the present application provides a human-computer dialogue device, which comprises:
[0040] obtain user dialogue data according to a preset starting instruction;
[0041] an entity recognition module configured to recognize a concept entity in the user dialogue data;
[0042] a first detection module configured to, if the concept entity is recognized in the user dialogue data, perform first detection according to the concept entity, the first detection being configured to detect whether concept expression content is included in the user dialogue data;
[0043] a second detection module configured to, if the concept entity is not recognized in the user dialogue data, perform second detection according to the user dialogue data, the second detection being configured to detect whether concept query content is included in the user dialogue data;
[0044] a dialogue module configured to generate a target dialogue template according to a detection result of the first detection or a detection result of the second detection.
[0045] In a third aspect, an embodiment of the present application provides a robot device, which comprises a processor and a memory, the memory storing a computer program, and the computer program performs the human-computer dialogue method in the first aspect and any implementation manner of the first aspect when the computer program runs on the processor.
[0046] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program performs the human-computer dialogue method in the first aspect and any implementation manner of the first aspect when the computer program runs on a processor.
[0047] The embodiments of the present application provide a human-computer dialogue method, device, robot device and computer readable storage medium, which comprise: obtaining user dialogue data; recognizing a concept entity in the user dialogue data; if the concept entity is recognized in the user dialogue data, performing first detection according to the concept entity, the first detection being configured to detect whether concept expression content is included in the user dialogue data; if the concept entity is not recognized in the user dialogue data, performing second detection according to the user dialogue data, the second detection being configured to detect whether concept query content is included in the user dialogue data; and generating a target dialogue template according to a detection result of the first detection or a detection result of the second detection. The present application performs multiple detections based on a concept entity, so as to distinguish the question and answer intention of the user dialogue data, and generates a dialogue template according to the question and answer intention, which realizes human-computer dialogue processing closer to the question and answer intention of the user, and makes the human-computer dialogue more intelligent. BRIEF DESCRIPTION OF DRAWINGS
[0048] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as limiting the scope of protection of the present application. In the various drawings, similar components are denoted by similar reference numerals.
[0049] Figure 1 A method flow diagram of a human-computer dialogue method provided by an embodiment of the present application is shown;
[0050] Figure 2 An application scenario diagram of identifying a concept entity in a human-computer dialogue method provided by an embodiment of the present application is shown;
[0051] Figure 3 An application scenario diagram of judging positive and negative types in a human-computer dialogue method provided by an embodiment of the present application is shown;
[0052] Figure 4 A device module diagram of a human-computer dialogue device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application.
[0054] The components of the embodiments of the present application generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0055] In the following, the terms "include", "have", and their synonymous words used in various embodiments of the present application are only intended to represent a specific feature, number, step, operation, element, component, or combination of the foregoing, and should not be understood as first excluding the presence or adding the possibility of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
[0056] In addition, the terms "first", "second", "third", and the like are only used to distinguish description, and cannot be understood as indicating or implying relative importance.
[0057] Unless specifically defined otherwise, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present application belong. The terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined in various embodiments of the present application.
[0058] Reference Figure 1 A method flowchart of a human-computer conversation method provided by an embodiment of the present application, the human-computer conversation method provided by the embodiment of the present application, as shown in Figure 1 The human-computer conversation method comprises the following steps.
[0059] In step S101, user conversation data is acquired according to a preset starting instruction.
[0060] Specifically, the human-computer conversation method provided by the embodiment can be applied to a robot device comprising a human-computer interaction device.
[0061] The preset starting instruction can be a voice instruction, a terminal instruction or a gesture instruction, etc. Specifically, the embodiment does not limit the specific form of the preset starting instruction, and a suitable preset starting instruction can be selected according to the actual application scenario to start the human-computer conversation process.
[0062] The user conversation data is voice data input by the user in the current human-computer conversation process.
[0063] In an embodiment, after the user inputs the user conversation data, the user conversation data of this human-computer conversation process is stored in a historical conversation cache for real-time analysis of the conversation content by the human-computer conversation process. The historical conversation cache can be adaptively set according to the actual application scenario, which is not specifically limited here.
[0064] According to a specific embodiment of the present application, the step of acquiring user conversation data according to a preset starting instruction comprises:
[0065] After receiving the preset starting instruction, wait for a preset time.
[0066] If the user newly inputs user conversation data within the preset time, the user conversation data is acquired.
[0067] If the user does not newly input user conversation data within the preset time, the historical conversation information is emptied, and the conversation is ended.
[0068] In specific embodiments, after receiving the preset starting instruction, the user dialogue device waits for the user to input dialogue data, i.e., waits for the user to input new voice data.
[0069] The user dialogue device of the present embodiment further comprises a timer module for ending the current human-computer dialogue process after a preset time when no new user dialogue data is input by the user.
[0070] If the user inputs new user dialogue data within the preset time, the new user dialogue data is taken as real-time user dialogue data, and a subsequent reply process is performed.
[0071] In specific embodiments, it can be further determined whether the user dialogue data is valid data. If the user dialogue data cannot be effectively recognized, it is determined that the user has not input new user dialogue data, and the current process is ended after the preset time.
[0072] Specifically, the preset time can be adaptively set according to the actual application scenario, and the specific value of the preset time is not limited here.
[0073] Step S102, identifying the concept entity in the user dialogue data;
[0074] In specific embodiments, the concept entity in the present embodiment is an entity in a concept corpus.
[0075] The concept corpus is composed of entities, concepts, and concept positive and negative types. The entity is the subject to be expressed by the concept, and is derived from common things, such as food, scenic spots, celebrities, places, etc. The concept is a preset description of the entity. The source of the concept can be artificial sorting, or can come from some review websites or knowledge websites. The present embodiment does not limit the source of the concept, and the source of the concept can be adaptively set according to the actual application scenario.
[0076] The present embodiment mines concepts from user dialogue data through concept judgment algorithms. The concept positive and negative types are represented by 0 and 1, where 0 represents negative and 1 represents positive. For example, as shown in Table 1 below:
[0077] Table 1
[0078]
[0079] During the dialogue process, if the related entity in the concept corpus is mentioned, the robot can also express the related concept. In order to make the dialogue lively, the positive and negative of the concept are also important. Properly expressing recognition or non-recognition of the user's concept can make the personality of the robot more distinctive.
[0080] In this embodiment, the entity recognition algorithm used when identifying the concept entity includes but is not limited to HMM, CRF, BiLSTM, BiLSTM+CRF, etc. A pre-trained model with better effect but higher computational consumption can also be used, including but not limited to BERT, BERT+CRF, ALBERT, etc.
[0081] As shown in Figure 2 By using the pre-trained model to identify "I like the food in Chengdu very much", the concept entity "degree" can be obtained. In the figure, the annotation uses the BIO format, B represents the beginning of the entity / keyword, I represents the non-beginning of the entity / keyword, and O represents other words that are not entities.
[0082] This embodiment can train an entity recognition model through large-scale real chat corpus data to obtain an entity recognition model that can accurately identify concept entities. The specific training process can refer to the mainstream deep learning model training method, which will not be described here.
[0083] Step S103, if the concept entity is identified in the user dialogue data, a first detection is performed according to the concept entity, and the first detection is used to detect whether the concept expression content is included in the user dialogue data;
[0084] Step S104, if the concept entity is not identified in the user dialogue data, a second detection is performed according to the user dialogue data, and the second detection is used to detect whether the concept query content is included in the user dialogue data;
[0085] Step S105, generating a target dialogue template according to the detection result of the first detection or the detection result of the second detection.
[0086] This embodiment can output the corresponding target dialogue template according to the result of the first detection step after the first detection step is performed alone, or output the corresponding target dialogue template according to the result of the second detection step after the second detection step is performed alone, or output the corresponding target dialogue template according to the results of the first detection and the second detection after the first detection and the second detection are performed.
[0087] Specifically, the first detection step can effectively identify whether the user expresses a concept, and can further identify the positive and negative types of the user expressing the concept, including positive (positive) type and negative (negative) type. The target dialogue template generated according to the detection result of the first detection step can make the reply of the robot to the user dialogue data more in line with the intention of the user expressing the concept, so that the reply is more intelligent.
[0088] The second detection step can effectively identify whether the user wants to query a certain concept, and can adaptively modify the query mode of the target dialogue template according to the user's intention of querying the concept, so as to improve the experience of the user and the robot in the human-computer dialogue process through multiple reply modes.
[0089] According to a specific embodiment of the present application, the first detection according to the concept entity includes:
[0090] According to the concept entity, it is judged whether the user dialogue data includes concept expression content;
[0091] If the user dialogue data includes the concept expression content, the target dialogue template is found in the corresponding reply template database according to the positive and negative types of the concept expression content and the preset reply strategy.
[0092] If the user dialogue data does not include the concept expression content, the second detection according to the user dialogue data is performed.
[0093] Specifically, when the user dialogue data includes the concept entity, the human-computer interaction device proposed in the embodiment first detects the expression concept of the user dialogue data.
[0094] In the specific implementation process, the embodiment can identify the user dialogue data through the concept expression content detection model to judge whether the user dialogue data includes concept expression content.
[0095] If the user dialogue data does not include concept expression content, the user dialogue data is further identified through the concept query content detection model to judge whether the user dialogue data includes concept query content.
[0096] The concept expression content detection model is trained according to a large-scale concept expression corpus and a pre-training model. The concept query content detection model is trained according to a large-scale concept query corpus and a pre-training model.
[0097] According to a specific embodiment of the present application, the step of finding the target dialogue template in the corresponding reply template database according to the positive and negative types of the concept expression content and the preset reply strategy includes:
[0098] Judge the positive and negative types of the concept expression content;
[0099] Find the target dialogue template in the reply template database corresponding to the positive and negative types;
[0100] If the response template database includes target dialogue templates with the same positive or negative type as the content of the concept expression, then a target dialogue template that agrees with the content of the concept expression is generated according to the preset response strategy.
[0101] If the response template database does not contain a target dialogue template with the same positive or negative type as the content of the concept expression, then a target dialogue template that does not agree with the content of the concept expression is generated according to a preset response strategy.
[0102] In a specific embodiment, if the positive or negative type of the expressed concept is positive, the target dialogue template is searched in the corresponding positive response template database; if the positive response template database includes target dialogue templates of the same positive type, a target dialogue template that agrees with the expressed concept is generated according to a preset response strategy; if the positive response template database does not include target dialogue templates of the same positive type, a target dialogue template that does not agree with the expressed concept is generated according to a preset response strategy.
[0103] If the positive or negative type of the expressed concept is negative, the target dialogue template is searched in the corresponding negative response template database; if the negative response template database includes target dialogue templates of the same negative type, a target dialogue template that agrees with the expressed concept is generated according to a preset response strategy; if the negative response template database does not include target dialogue templates of the same negative type, a target dialogue template that does not agree with the expressed concept is generated according to a preset response strategy.
[0104] In a specific embodiment, the process of identifying the positive or negative type of the conceptual expression content can be achieved by setting up corresponding positive (positive) type conceptual expression content libraries and negative (negative) type conceptual expression content libraries, and matching the concepts in the conceptual expression content in the two types of conceptual expression content libraries.
[0105] If the concept is matched in the positive type concept expression content library, the concept expression content can be identified as positive type; if the concept is matched in the negative type concept expression content library, the concept expression content can be identified as negative type.
[0106] It should be noted that this embodiment can also identify the positive or negative type of the conceptual expression content through other algorithm recognition methods.
[0107] like Figure 3 As shown, this embodiment can identify the positive and negative types of conceptual expressions by constructing a neural network model or a pre-trained model.
[0108] Specifically, the main network architecture of the neural network model can use, but is not limited to, commonly used neural networks such as CNN, RNN, LSTM, etc. The main network structure of the pre-training model can use, but is not limited to, pre-training models such as BERT, BERT+CRF, ALBERT, etc.
[0109] In the present embodiment, the preset reply strategy of the target dialogue template for identifying or not identifying the concept expression content includes two kinds:
[0110] The first preset reply strategy is a reply strategy for identifying or not identifying the concept based on a template.
[0111] Specifically, the target dialogue template includes three contents, the first content is a dialogue template for identifying or not identifying, the second content is a dialogue template for expressing the identified or not identified concept, and the third content is a dialogue template for guiding the user to continue to elaborate the concept or a dialogue template for guiding to shift the topic.
[0112] For example, when the current concept expression content of the user is of a positive type, and the target dialogue template for identifying the concept expression content is generated, the concept expression content of the user is “I really like Chengdu, I eat a lot”, and the three contents of the target dialogue template are “Oh, I also think so” “Chengdu is a paradise for foodies” and “Do you think there are any interesting places”, the completed reply content is “Oh, I also think so! Chengdu is a paradise for foodies! Do you think there are any interesting places?”.
[0113] When the current concept expression content of the user is of a negative type, and the target dialogue template for identifying the concept expression content is generated, the concept expression content of the user is “Chengdu eats a lot, I don't like it”, and the three contents of the target dialogue template are “I also think so” “Chengdu's things are too spicy” and “How about we talk about something else”, the completed reply content is “I also think so! Chengdu's things are too spicy! How about we talk about something else?”.
[0114] When the current concept expression content of the user is of a positive type, and the target dialogue template for not identifying the concept expression content is generated, the concept expression content of the user is “Chengdu eats a lot, I like it”, and the three contents of the target dialogue template are “Is that so? It may be different from what I think” “Chengdu's things are too spicy” and “Can you tell me why”, the completed reply content is “Is that so? It may be different from what I think! Chengdu's things are too spicy! Can you tell me why?”.
[0115] In the case that the current opinion expression content of the user is of a negative type and the target dialogue template is generated without agreeing with the opinion expression content, the opinion expression content of the user is “I have eaten a lot in Chengdu, but I don't like it”, and the three contents of the target dialogue template are “Is that so? It may be different from what I think”, “I think Chengdu is a food paradise” and “How about talking about something else”, and the completed reply content is “Is that so? It may be different from what I think! I think Chengdu is a food paradise! How about talking about something else?”.
[0116] The second preset reply strategy is a reply strategy based on algorithmic agreement or disagreement with an opinion.
[0117] The target dialogue template generated by the reply strategy of the embodiment has the same structure as the target dialogue template in the above-mentioned reply strategy, and the contents of the first two paragraphs are also the same, which will not be repeated here.
[0118] The third paragraph content generated based on the opinion dialogue generation algorithm is automatically derived by a language model, which is more flexible and more variable than the third paragraph content generated based on a template.
[0119] Specifically, the user dialogue data, the identification of the approval or disapproval of the robot, and the opinion expression content can be spliced into a serialized sentence, and the serialized sentence is input into a language model for prediction. The language model includes but is not limited to rnn, gpt and other algorithms. In the embodiment, the language model can be constructed based on the gpt algorithm.
[0120] According to a specific embodiment of the present application, the step of second detecting according to the user dialogue data comprises:
[0121] determining whether the user dialogue data includes opinion inquiry content;
[0122] If the user dialogue data includes the opinion inquiry content, the target dialogue template is found in the corresponding reply template database according to the opinion entity in the current user dialogue data and the opinion entity in the historical user dialogue data;
[0123] If the user dialogue data does not include the opinion inquiry content, the opinion entity is detected for a third time.
[0124] In specific embodiments, the way to determine whether the user dialogue data includes opinion inquiry content can be similar to the way to determine whether the user dialogue data includes opinion expression content, which will not be repeated here.
[0125] According to a specific embodiment of the present application, the step of searching the target dialogue template in the corresponding reply template database according to the concept entity in the current user dialogue data and the concept entity in the historical user dialogue data comprises:
[0126] determining whether the current user dialogue data comprises a concept entity;
[0127] if the current user dialogue data comprises a concept entity, determining whether the current concept entity in the current user dialogue data is the same as the historical concept entity in the historical user dialogue data;
[0128] if the same, determining whether the historical user dialogue data comprises a historical dialogue template for the current concept entity, if yes, searching the corresponding reply template database for a target dialogue template different from the historical dialogue template, if no, searching the corresponding reply template database for a target dialogue template according to the current concept entity;
[0129] if different, searching the corresponding reply template database for a target dialogue template according to the current concept entity;
[0130] if the current user dialogue data does not comprise a concept entity, searching the safe reply template database for a target dialogue template.
[0131] In a specific embodiment, if it is determined in the second detection process that the user dialogue data comprises concept query content, it is first determined whether the user dialogue data comprises a concept entity, if the user dialogue data comprises a concept entity, it indicates that the current user dialogue data has undergone the first detection step, if the user dialogue data does not comprise a concept entity, it indicates that the current user dialogue data has not undergone the first detection step.
[0132] if the current concept entity in the current user dialogue data is the same as the historical concept entity in the historical user dialogue data, it indicates that the user and the robot have discussed the current concept entity, when replying to the current user dialogue data, it is further determined whether the historical dialogue data has replied to the current concept entity, if the historical dialogue data has replied to the current concept entity, in the case that a different target dialogue template can be searched, the reply is made with a target dialogue template different from the reply content in the historical dialogue data, if a different target dialogue template cannot be searched, the corresponding target dialogue template can be searched in the safe reply template database to make the reply.
[0133] if the current concept entity is different from the historical concept entity, or if the historical dialogue data has not replied to the current concept entity, the target dialogue template conforming to the current concept entity is directly searched in the concept query template database to make the reply.
[0134] If the current user dialogue data does not include the concept entity, it is queried whether the historical user dialogue data includes a reply to the concept query content, if the historical user dialogue data includes a reply to the concept query content, it is tried whether a reply different from the historical reply can be queried in the template library. If the historical user dialogue data does not include a reply to the concept query content, a corresponding target dialogue template is directly found in the safe reply template database for reply.
[0135] Specifically, after the second detection step is performed, a third detection step can be further performed to determine whether the user dialogue data includes emotional expression content, and a corresponding target dialogue template is generated according to a detection result of the emotional expression content.
[0136] The third detection according to the concept entity includes:
[0137] According to the concept entity, it is determined whether the user dialogue data includes emotional expression content.
[0138] If the user dialogue data includes emotional expression content, the target dialogue template is found in the corresponding reply template database according to a positive or negative type of the emotional expression content and a preset reply strategy.
[0139] If the user dialogue data does not include emotional expression content, the target dialogue template is found in the ordinary reply template database.
[0140] In specific embodiments, the positive and negative type judgment algorithm used in the embodiment can adopt a similar structure and training method as the positive and negative type judgment algorithm for judging the concept expression content. In one embodiment, as shown in FIG. 6, the same neural network model or pre-trained model can be trained to simultaneously judge the positive and negative types of the concept expression content and the emotional expression content, thereby effectively reducing the number of algorithm deployments and saving computing resources. Figure 3
[0141] Specifically, the main network structure of the positive and negative type judgment model of the two types of content can be newly added with two loss functions loss1 and loss2 on the basis of the neural network or pre-trained model, one of which is used to calculate the loss of the positive and negative types of the concept expression content, and the other is used to calculate the loss of the positive and negative types of the emotional expression content. For each loss function, a network structure of Full Connection+Softmax is constructed, and the output of the main network structure is input as a feature into the newly added network structure.
[0142] In the training, if the algorithm main network structure adopts a pre-trained model, the parameters of the pre-trained model need to be fixed. If the main network adopts a neural network model, the parameters do not need to be fixed. The cutoff parameters of the training can adopt various strategies: 1. both losses are less than a certain threshold; 2. the average of the two losses is less than a certain threshold; 3. the number of iterations exceeds a certain threshold. Specifically, the strategies can be used alone or in combination, which is not limited in the embodiment and can be adaptively set according to the actual application scenario.
[0143] In the specific implementation process, if the current dialogue data of the user does not include the concept expression content and the concept query content, but includes the emotion expression content, and the positive and negative types of the emotion expression content are positive (like) types, the dialogue template generation target can be added to ask the user why the user likes the dialogue template.
[0144] If the emotion expression content is included, and the positive and negative types of the emotion expression content are negative (hate) types, the dialogue template generation target can be added to ask the user why the user hates the dialogue template.
[0145] Specifically, the way of generating other part target dialogue templates based on emotion expression content can refer to the way of generating target dialogue templates based on concept expression content in the foregoing embodiments, which is not described herein.
[0146] In specific embodiments, the mechanism of setting a reply strategy, such as agreeing with the user's emotion expression content twice and then denying the user's emotion expression content once, can be used to make the robot randomly reply to the user's emotion expression content, so as to make the robot maintain the corresponding personality and improve the user's human-computer interaction experience.
[0147] In summary, the embodiment provides a human-computer dialogue method, which can realize human-computer dialogue scheme generation between a robot and a user based on the detection of concept expression, concept query and emotion expression, and can effectively improve the intelligence of the human-computer dialogue scheme and the experience of the user in human-computer dialogue with the robot, and effectively improve the product quality of the robot device. In addition, the embodiment step-by-step integrates the detection technologies of concept expression, concept query and emotion expression, and can generate different types of target dialogue templates based on the detection results of the user's dialogue data to fit the user's dialogue intention, and make the robot express its own views on common things in the dialogue process, express the concept of identifying or not identifying the user's concept, to realize more interesting human-computer interaction experience and improve the interaction quality of the robot device.
[0148] Reference Figure 4A device module schematic diagram of a human-computer conversation device 400 provided by an embodiment of the present application is provided. The human-computer conversation device 400 provided by an embodiment of the present application, as shown in Figure 4 includes:
[0149] An acquisition module 401 is configured to acquire user conversation data according to a preset starting instruction.
[0150] An entity recognition module 402 is configured to recognize a concept entity in the user conversation data.
[0151] A first detection module 403 is configured to, if the concept entity is recognized in the user conversation data, perform first detection according to the concept entity, the first detection being configured to detect whether concept expression content is included in the user conversation data.
[0152] A second detection module 404 is configured to, if the concept entity is not recognized in the user conversation data, perform second detection according to the user conversation data, the second detection being configured to detect whether concept query content is included in the user conversation data.
[0153] A conversation module 405 is configured to generate a target conversation template according to a detection result of the first detection or a detection result of the second detection.
[0154] In addition, an embodiment of the present application further provides a robot device, which includes a processor and a memory, the memory storing a computer program, the computer program performing the human-computer conversation method in the foregoing method embodiments when running on the processor.
[0155] An embodiment of the present application further provides a computer readable storage medium, which stores a computer program, the computer program performing the human-computer conversation method in the foregoing method embodiments when running on a processor.
[0156] In addition, the specific implementation process of the human-computer conversation device, the robot device and the computer readable storage medium mentioned in the foregoing embodiments can refer to the specific implementation process of the method embodiments, which will not be repeated here.
[0157] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented by other manners. The apparatus embodiments described above are merely illustrative, for example, the flowcharts and structural diagrams in the drawings show the possible implementation architecture, function and operation of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logic function. It should also be noted that in alternative implementation manners, the functions noted in the blocks can also occur in different order from that noted in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the structural diagram and / or flowchart, and the combination of blocks in the structural diagram and / or flowchart, can be implemented by a dedicated hardware-based system for executing the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0158] In addition, each functional module or unit in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0159] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the technical solutions or the part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0160] The above description is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application.
Claims
1. A human-computer dialogue method, characterized in that, The method includes: Obtain user dialogue data according to preset startup instructions; Identify conceptual entities in the user dialogue data; If the user dialogue data is identified to include conceptual entities, a first detection is performed based on the conceptual entities. The first detection is used to detect whether the user dialogue data includes conceptual expression content. If it is identified that the user dialogue data does not include concept entities, a second detection is performed based on the user dialogue data. The second detection is used to detect whether the user dialogue data includes concept query content. Generate a target dialogue template based on the detection results of the first detection or the detection results of the second detection; The step of performing the first detection based on the conceptual entity includes: Determine whether the user dialogue data includes conceptual expressions based on the conceptual entity; If the user dialogue data includes the content expressing the idea, the target dialogue template is searched in the corresponding response template database according to the positive or negative type of the content expressing the idea and the preset response strategy. If the user dialogue data does not include the expressed concept, proceed to the step of performing the second detection based on the user dialogue data; The step of performing the second detection based on the user dialogue data includes: Determine whether the user dialogue data includes questions about concepts; If the user dialogue data includes the concept inquiry content, then the target dialogue template is searched in the corresponding response template database based on the concept entities in the current user dialogue data and the concept entities in the historical user dialogue data. If the user dialogue data does not include the concept inquiry content, then a third detection is performed based on the concept entity.
2. The method according to claim 1, characterized in that, The step of obtaining user dialogue data according to a preset startup command includes: After receiving the preset start command, wait for a preset time; If new user dialogue data is received within a preset time, then the user dialogue data is acquired. If no new user dialogue data is received within the preset time, the historical dialogue data will be cleared and the dialogue will end.
3. The method according to claim 1, characterized in that, The step of searching for the target dialogue template in the corresponding response template database based on the positive or negative type of the content expressed by the concept and the preset response strategy includes: Determine the positive or negative type of the content expressed by the concept; Search the target dialogue template in the response template database corresponding to the positive and negative types; If the response template database includes target dialogue templates with the same positive or negative type as the content of the concept expression, then a target dialogue template that agrees with the content of the concept expression is generated according to the preset response strategy. If the response template database does not contain a target dialogue template with the same positive or negative type as the content of the concept expression, then a target dialogue template that does not agree with the content of the concept expression is generated according to a preset response strategy.
4. The method according to claim 1, characterized in that, The step of searching for the target dialogue template in the corresponding response template database based on the conceptual entities in the current user dialogue data and the conceptual entities in the historical user dialogue data includes: Determine whether the current user dialogue data includes conceptual entities; If the current user dialogue data includes a concept entity, determine whether the current concept entity in the current user dialogue data is the same as the historical concept entity in the historical user dialogue data. If they are the same, determine whether the historical user dialogue data includes a historical dialogue template for the current conceptual entity. If it does, search for a target dialogue template that is different from the historical dialogue template in the corresponding response template database. If it does not, search for a target dialogue template in the corresponding response template database based on the current conceptual entity. If they are different, search for the target dialogue template in the corresponding response template database based on the current conceptual entity. If the current user dialogue data does not include conceptual entities, search for the target dialogue template in the secure response template database.
5. The method according to claim 1, characterized in that, The step of performing a third detection based on the conceptual entity includes: Based on the conceptual entity, determine whether the user dialogue data includes emotional expression content; If the user dialogue data includes emotional expression content, then the target dialogue template is searched in the corresponding response template database according to the positive or negative type of the emotional expression content and the preset response strategy; If the user dialogue data does not include emotional expression content, then the target dialogue template is searched in the general response template database.
6. A human-computer dialogue device, characterized in that, The device includes: The acquisition module is used to acquire user dialogue data according to a preset startup command; An entity recognition module is used to identify conceptual entities in the user dialogue data; The first detection module is used to perform a first detection based on the conceptual entity if it is identified that the user dialogue data includes conceptual entities. The first detection is used to detect whether the user dialogue data includes conceptual expression content. The second detection module is used to perform a second detection based on the user dialogue data if it is found that the user dialogue data does not include concept entities. The second detection is used to detect whether the user dialogue data includes concept query content. The dialogue module is used to generate a target dialogue template based on the detection result of the first detection or the detection result of the second detection. The step of performing the first detection based on the conceptual entity includes: Determine whether the user dialogue data includes conceptual expressions based on the conceptual entity; If the user dialogue data includes the content expressing the idea, the target dialogue template is searched in the corresponding response template database according to the positive or negative type of the content expressing the idea and the preset response strategy. If the user dialogue data does not include the expressed concept, proceed to the step of performing the second detection based on the user dialogue data; The step of performing the second detection based on the user dialogue data includes: Determine whether the user dialogue data includes questions about concepts; If the user dialogue data includes the concept inquiry content, then the target dialogue template is searched in the corresponding response template database based on the concept entities in the current user dialogue data and the concept entities in the historical user dialogue data. If the user dialogue data does not include the concept inquiry content, then a third detection is performed based on the concept entity.
7. A robotic device, characterized in that, The robotic device includes a processor and a memory, the memory storing a computer program, which, when executed on the processor, performs the human-computer dialogue method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a processor, executes the human-computer dialogue method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Intelligent interaction method, device based on user emotion
CN113743126A
Dialogue intention recognition method and device, storage medium and intelligent equipment
CN114970560A