Data processing method and device, electronic equipment and computer storage medium
By recognizing user emotions and reasons to generate personalized reply text, the problem of traditional ChatBot replies lacking personality is solved, improving user experience and interaction.
Patent Information
- Application Number
- CN202111414786.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2041-11-25
AI Technical Summary
Traditional ChatBot replies lack personalization, leading to user fatigue and negatively impacting the user experience.
By receiving text input from users, identifying emotion categories and determining the causes of emotions, and using emotion recognition and cause extraction models to generate personalized response texts, the system combines user information and dialogue history to provide targeted responses.
It improves user stickiness and user experience, enhances the intelligence of the service, and generates stronger interaction with users through personalized replies.
Smart Images

Figure CN114238593B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of communication technology, and in particular to a data processing method, apparatus, electronic device, and computer storage medium. Background Technology
[0002] Intelligent assistants, by integrating technologies such as big data, artificial intelligence, and financial engineering, provide users with services such as health management, behavior analysis, product recommendations, and risk control. Essentially, they are chatbots. Traditional chatbots often provide repetitive and monotonous replies, which can easily lead to user fatigue and negatively impact the user experience. Summary of the Invention
[0003] This specification provides a data processing method, apparatus, electronic device, and computer storage medium that can generate responses with different styles based on the emotions expressed during user conversations, thereby improving user engagement and user experience and demonstrating the intelligence of the service. The technical solution is as follows:
[0004] Firstly, embodiments of this specification provide a data processing method, including:
[0005] Receive the first text entered by the user in the current conversation;
[0006] The target to be executed is identified based on the first text, and the first text is input into the emotion recognition model, which outputs the emotion category corresponding to the first text; the emotion recognition model is trained based on texts with multiple known emotion categories;
[0007] Based on the emotion category corresponding to the first text, the target to be executed is processed to obtain the target response text.
[0008] In one possible implementation, after identifying the target to be executed based on the first text, inputting the first text into the emotion recognition module, and outputting the emotion category corresponding to the first text, and before processing the target to be executed based on the emotion category corresponding to the first text to obtain the target response text, the method further includes:
[0009] Determine the primary cause of the emotional category corresponding to the first text mentioned above;
[0010] The above-mentioned target text is processed based on the emotion category corresponding to the first text to obtain the target response text, including:
[0011] Based on the aforementioned emotion categories and the aforementioned primary cause, the aforementioned objectives to be executed are processed to obtain the objective response text.
[0012] In one possible implementation, determining the first cause of the emotion category corresponding to the first text includes:
[0013] Based on the first text and the second text, a first cause for the emotion category corresponding to the first text is determined; wherein, the second text is the dialogue content in the current session before the input of the first text.
[0014] In one possible implementation, determining the first cause of the emotion category corresponding to the first text based on the first text and the second text includes:
[0015] The first text and the second text are input into the cause extraction model, which outputs the first cause. The first cause includes arguments and trigger words. The cause extraction model is trained based on texts with multiple known arguments and trigger words.
[0016] In one possible implementation, determining the first cause of the emotion category corresponding to the first text based on the first text and the second text includes:
[0017] The first text and the second text are input into the cause classification model, which outputs the cause categories corresponding to the first text and the second text. The cause categories include arguments and trigger words. The cause classification model is trained based on texts with multiple known cause categories.
[0018] The above-mentioned cause category is identified as the first cause.
[0019] In one possible implementation, after identifying the target to be executed based on the first text, inputting the first text into the emotion recognition module, and outputting the emotion category corresponding to the first text, and before processing the target to be executed based on the emotion category corresponding to the first text to obtain the target response text, the method further includes:
[0020] User information is extracted from the database based on the first text mentioned above;
[0021] Based on the aforementioned user information, a second reason for the emotional category corresponding to the first text was determined.
[0022] The above-mentioned processing of the target based on the aforementioned emotion categories yields the target response text, including:
[0023] Based on the aforementioned emotion categories, the aforementioned first reason, and the aforementioned second reason, the aforementioned objectives to be executed are processed to obtain the objective response text.
[0024] In one possible implementation, the extraction of user information from the database based on the first text includes:
[0025] Extract keywords from the first text above;
[0026] The user information was extracted from the database based on the keywords mentioned above.
[0027] In one possible implementation, the target response text is obtained by processing the target based on the aforementioned emotion category, the aforementioned first reason, and the aforementioned second reason, including:
[0028] The first text is matched with the first reason to obtain a first matching degree, and the first text is matched with the second reason to obtain a second matching degree;
[0029] If the second matching degree is greater than the first matching degree, the target to be executed is processed based on the emotion category corresponding to the first text and the second reason to obtain the target response text;
[0030] If the second matching degree is less than or equal to the first matching degree, the target to be executed is processed based on the emotion category corresponding to the first text and the first reason to obtain the target response text.
[0031] Secondly, embodiments of this specification provide a data processing apparatus, including:
[0032] The receiving module is used to receive the first text entered by the user in the current conversation;
[0033] The target recognition module is used to identify the target to be executed based on the aforementioned first text;
[0034] The emotion recognition module is used to input the first text into the emotion recognition model and output the emotion category corresponding to the first text; the emotion recognition model is trained based on texts with multiple known emotion categories;
[0035] The processing module is used to process the target to be executed based on the emotion category corresponding to the first text, and obtain the target response text.
[0036] In one possible implementation, the above-mentioned device further includes:
[0037] The determination module is used to determine the primary cause of the emotional category corresponding to the first text mentioned above.
[0038] The aforementioned processing module is specifically used to process the aforementioned target based on the aforementioned emotion category and the aforementioned first reason, and obtain the target response text.
[0039] In one possible implementation, the determining module is specifically used to determine a first cause for the emotion category corresponding to the first text based on the first text and the second text; wherein the second text is the dialogue content in the current session before the input of the first text.
[0040] In one possible implementation, the aforementioned determining module is specifically used to input the aforementioned first text and the aforementioned second text into the cause extraction model and output the aforementioned first cause; the aforementioned first cause includes arguments and trigger words; the aforementioned cause extraction model is trained based on texts with multiple known arguments and trigger words.
[0041] In one possible implementation, the aforementioned determining module includes:
[0042] The cause classification unit is used to input the first text and the second text into the cause classification model and output the cause categories corresponding to the first text and the second text; the cause categories include arguments and trigger words; the cause classification model is trained based on texts with multiple known cause categories;
[0043] The determining unit is used to determine the above cause category as the above first cause.
[0044] In one possible implementation, the device further includes:
[0045] The extraction module is used to extract user information from the database based on the first text mentioned above;
[0046] The aforementioned determining module is also used to determine a second reason for the emotion category corresponding to the aforementioned first text based on the aforementioned user information;
[0047] The aforementioned processing module is specifically used to process the aforementioned target based on the aforementioned emotion category, the aforementioned first reason, and the aforementioned second reason, to obtain the target response text.
[0048] In one possible implementation, the extraction module is specifically used to extract keywords from the first text.
[0049] The user information was extracted from the database based on the keywords mentioned above.
[0050] In one possible implementation, the above processing module includes:
[0051] A matching unit is used to match the first text with the first reason to obtain a first matching degree, and to match the first text with the second reason to obtain a second matching degree;
[0052] The processing unit is configured to, if the second matching degree is greater than the first matching degree, process the target to be executed based on the emotion category corresponding to the first text and the second reason to obtain the target response text;
[0053] The processing unit is further configured to, if the second matching degree is less than or equal to the first matching degree, process the target to be executed based on the emotion category corresponding to the first text and the first reason to obtain the target response text.
[0054] Thirdly, embodiments of this specification provide an electronic device, including: a processor and a memory;
[0055] The processor is connected to the memory.
[0056] The aforementioned memory is used to store executable program code;
[0057] The processor reads the executable program code stored in the memory to run the program corresponding to the executable program code, so as to execute the method provided by the first aspect of the embodiments of this specification or any possible implementation of the first aspect.
[0058] Fourthly, embodiments of this specification provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the method provided by the first aspect of the embodiments of this specification or any possible implementation thereof.
[0059] This embodiment of the specification performs emotion recognition and target identification on the first text input by the user in the current dialogue. Then, it determines the first and second causes of the aforementioned emotion category. Based on the identified emotion category corresponding to the first text and the determined first or second cause, it renders the target corresponding to the first text, thereby obtaining personalized target response text. This enables the generation of various styles of responses based on the user's emotions during the dialogue, creating stronger interaction with the user, greatly improving user stickiness and user experience, and also demonstrating the intelligence of the service. Attached Figure Description
[0060] To more clearly illustrate the technical solutions in the embodiments of this specification, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1A schematic diagram of the architecture of a data processing system provided for an exemplary embodiment of this specification;
[0062] Figure 2 A schematic diagram of the structure of a server provided for an exemplary embodiment of this specification;
[0063] Figure 3 A flowchart illustrating a data processing method provided for an exemplary embodiment of this specification;
[0064] Figures 4A-4B A schematic diagram of a terminal interface during a data processing process provided as an exemplary embodiment of this specification;
[0065] Figure 5 A flowchart illustrating another data processing method provided as an exemplary embodiment of this specification;
[0066] Figures 6A-6B A schematic diagram of a terminal interface in another data processing process provided as an exemplary embodiment of this specification;
[0067] Figure 7 A flowchart illustrating another data processing method provided as an exemplary embodiment of this specification;
[0068] Figure 8 A schematic diagram of the structure of a data processing apparatus provided in an exemplary embodiment of this specification;
[0069] Figure 9 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this specification. Detailed Implementation
[0070] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings.
[0071] The terms "first," "second," "third," etc., used in this specification, claims, and the foregoing drawings are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0072] Please refer to Figure 1 , Figure 1 This is a schematic diagram of the architecture of a data processing system provided for an exemplary embodiment of this specification. Figure 1As shown, the data processing system may include: a terminal cluster and a server 120. Wherein:
[0073] The terminal cluster can be user terminals, specifically including one or more user terminals, such as user terminal 110a, user terminal 110b, user terminal 110c, etc. User-version software can be installed in the terminal cluster to enable users to input first text, second text, and other functions online. Any user terminal in the terminal cluster can establish a data relationship with the network and, through this network, establish a data connection with server 120, such as sending first text, second text, etc. Any user terminal in the terminal cluster can be, but is not limited to, a mobile phone, tablet computer, laptop computer, or other device with user-version software installed.
[0074] Server 120 can be a server capable of providing various data processing functions. It can receive first text, second text, and other data sent by any user terminal in the network or terminal cluster, and identify the target and emotion category based on the first text, second text, and other data. It then processes the target to obtain the target response text. Server 120 can also send its corresponding target response text and other data to any user terminal in the network or terminal cluster. Server 120 can be, but is not limited to, a hardware server, a virtual server, a cloud server, etc.
[0075] The network can be a medium that provides a communication link between the server 120 and any user terminal in the terminal cluster, or it can be the Internet, which includes network devices and transmission media, and is not limited thereto. The transmission media can be a wired link (e.g., but not limited to, coaxial cable, fiber optic cable, and digital subscriber line (DSL)) or a wireless link (e.g., but not limited to, wireless fidelity (WIFI), Bluetooth, and mobile device networks).
[0076] Understandably, Figure 1 The number of terminal clusters and servers 120 in the data processing system shown is merely an example. In a specific implementation, the data processing system can contain any number of user terminals and servers. This specification does not specifically limit this. For example, but not limited to, server 120 can be a server cluster composed of multiple servers.
[0077] Next, combine Figure 1 This section introduces the server provided in the embodiments of this specification. Please refer to the following for details. Figure 2 This is a schematic diagram of the structure of a server provided in an exemplary embodiment of this specification. Figure 2As shown, the server includes: a receiving module 210, a Natural Language Understanding (NLU) module 220, an emotion recognition module 230, a first event extraction module 240, a second event extraction module 250, an emotion attribution module 260, a text renderer 270, and an output module 280. Among them:
[0078] The receiving module 210 can be a network interface, specifically used to receive text information such as first text and second text sent by the user terminal through the network; the receiving module 210 can also receive voice information such as first voice and second voice sent by the user terminal through the network, and convert them into corresponding text information such as first text and second text.
[0079] The NLU module 210 may include at least one classifier for recognizing text information sent by the user terminal received by the receiving module 210, and obtaining the corresponding execution target in the text information. The NLU module 210 may also be used to convert voice information sent by the user terminal received by the receiving module 210 into corresponding text information, and identify the corresponding execution target in the text information. The classifier is pre-trained based on text information sent by multiple known user terminals in a specific application scenario and their corresponding user dialogue intent, i.e., the execution target, thereby enabling the NLU module 210 to identify the execution target corresponding to the text information. That is, the text information is input into a classifier with the same application scenario, and the classification result is determined as the execution target. Different classifiers may correspond to different application scenarios, or the same classifier may be able to classify execution targets in multiple application scenarios; this embodiment does not limit this. For example, when the user-installed software is financial management software, i.e., the application scenario is financial management, the NLU module 210 mentioned above can classify the text information sent by the user through its included financial management classifier to obtain the corresponding financial management classification result, i.e. the target to be executed. The financial management classification result can include categories such as checking returns, recommending funds, and recommending stocks.
[0080] The emotion recognition module 230 may include at least one emotion classifier for performing emotion recognition on text information sent by the user terminal received by the receiving module 210, thereby obtaining the corresponding emotion category in the text information. The emotion classifier is pre-trained based on multiple known text information and their corresponding emotion categories, thus enabling the emotion recognition module 230 to identify the emotion category corresponding to the text information, that is, to classify the emotion of the text information sent by the user terminal.
[0081] The first event extraction module 240 is used to extract the first event included in the text information input by the user in the current dialogue, sent by the user terminal and received by the receiving module 210. The first event includes arguments and trigger words. Arguments are nouns that accompany predicates, representing the participants and attributes of the event, and are composed of entity instances; they are the basic elements constituting an event. Trigger words are used to identify the predicate of the event, and are generally verbs and nouns. For example, when the first event is "fund decline," the arguments included in the first event are "fund" and the trigger word is "decline."
[0082] The second event extraction module 250 is used to extract user information related to the user's input text from the database based on the user's identity and the user's input text information, and to extract a second event from the user information; the second event includes arguments and trigger words.
[0083] The emotion attribution module 260 is used to determine the cause of the emotion category identified by the emotion recognition module 230 based on the emotion category corresponding to the user input text information identified by the emotion recognition module 230, the first event extracted by the first event extraction module 240, and the second event extracted by the second event extraction module 250.
[0084] The text renderer 270 can store and run sequence-to-sequence (seq2seq) text generation models. Based on the emotion categories identified by the emotion recognition module 230 and the causes corresponding to those emotion categories obtained by the emotion attribution module 240, it renders the target text generated by the NLU module to obtain personalized target response text. The seq2seq model includes an encoder and a decoder. The text renderer 270 can use the encoder to transform the emotion categories, the causes corresponding to those emotion categories, and the target text into a vector, and then use the decoder to recursively generate the output sequence, i.e., the target response text, based on the vector.
[0085] The output module 280 is used to output the target response text rendered by the copy renderer 270 to the user.
[0086] Next, combine Figures 1-2 This section introduces the data processing methods provided in the embodiments of this specification. Please refer to [the relevant documentation] for details. Figure 3 This is a flowchart illustrating a data processing method provided in an exemplary embodiment of this specification. Figure 3 As shown, this data processing method includes the following steps:
[0087] Step 302: Receive the first text entered by the user in the current conversation.
[0088] Specifically, when a user enters the first text in a dialog box of the user-installed software on their terminal, the terminal will send the first text to the server via the network, allowing the server to receive the first text entered by the user in the current conversation. The current conversation can be a conversation within a preset time period before the user entered the first text, such as a conversation within one hour or three hours prior to entering the first text, or it can be the conversation at the moment the user opened the dialog box when entering the first text. This embodiment of the specification does not limit this. For example, as... Figure 4A As shown, the server can receive the first text 410 input by user A in the current conversation sent by the terminal via the network. When the user inputs the first voice in a dialog box for chatting with a chatbot in the user version software installed on the terminal, the terminal can first convert the first voice into first text using a voice conversion device, and then send the first text to the server via the network, so that the server can receive the first text corresponding to the first voice input by the user in the current conversation via the network; alternatively, the terminal can also directly send the first voice to the server via the network, and after receiving the first voice, the server converts the first voice into first text via the NLU module.
[0089] Step 304: Identify the target to be executed based on the first text, input the first text into the emotion recognition model, and output the emotion category corresponding to the first text.
[0090] Specifically, after receiving the first text, the server inputs it into the NLU module to identify the target to be executed within the first text. Simultaneously, the server also inputs the first text into the emotion recognition model, which outputs the emotion category corresponding to the first text. This emotion recognition model is trained on texts with multiple known emotion categories. These emotion categories can include emotions such as happiness, anger, and sadness. For example, Figure 4A The first text 410 in the example is "Garbage, can you recommend a reliable fund?". At this time, the server can use the NLU module to identify that the target to be executed in the first text 410 is "recommend a fund", and at the same time, it can also use the emotion recognition model to identify that the emotion category corresponding to the first text 410 is "anger".
[0091] Step 306: Process the target text based on the emotion category corresponding to the first text to obtain the target response text.
[0092] Specifically, after identifying the target to be executed and the corresponding emotion category of the first text, the server can use the text renderer to render the target to be executed generated by the NLU module based on the emotion category identified by the emotion recognition model, and obtain personalized target response text.
[0093] Specifically, the server can first encode the aforementioned emotion category and the aforementioned target to be executed into a target vector using a text renderer, and then decode the aforementioned vector using the text renderer to output the target response text.
[0094] For example, the server can proceed according to step 304 Figure 4A In the example, the emotion category "anger" identified by the emotion recognition model in the first text 410 is used to render the target text "recommend fund" generated by the NLU module of the first text 410, resulting in the personalized target response text "Don't be angry, sir / madam, I'll recommend fund A to you again." At this point, as... Figure 4B As shown, the server will also send the target response text back to the user's client, i.e. Figure 4B Chatbot A will output the target reply text 420.
[0095] This embodiment of the specification performs emotion recognition and target identification on the first text input by the user in the current dialogue, and renders the target corresponding to the first text based on the identified emotion category, thereby obtaining personalized target response text. This enables the generation of responses in various styles according to the user's emotions during the dialogue, such as comforting users who are sad or angry, and encouraging users who are happy or expectant. This not only improves user stickiness and user experience, but also reflects the intelligence of the service.
[0096] The following describes another data processing method provided in the embodiments of this specification. Please refer to [link / reference needed] for details. Figure 5 This is a flowchart illustrating another data processing method provided in an exemplary embodiment of this specification. Figure 5 As shown, this data processing method includes the following steps:
[0097] Step 502: Receive the first text entered by the user in the current conversation.
[0098] Specifically, step 502 is the same as step 302, and will not be repeated here.
[0099] Step 504: Identify the target to be executed based on the first text, input the first text into the emotion recognition model, and output the emotion category corresponding to the first text.
[0100] Specifically, step 504 is the same as step 304, and will not be repeated here.
[0101] Step 506: Determine the primary cause of the emotional category corresponding to the first text.
[0102] Specifically, after identifying the target to be executed and the corresponding emotion category of the first text, a first cause can be determined based on the first text and the dialogue content in the current session before the input of the first text, i.e., the second text. The first cause includes arguments and trigger words. That is, the first cause leading to the aforementioned emotion category is determined based on the first text and its preceding context (the second text). In this embodiment, the first cause can be referred to as an internal cause, i.e., a cause summarized from the current dialogue.
[0103] Optionally, the server can determine the primary cause of the emotion category corresponding to the first text using a cause extraction model. This involves inputting the first text and the dialogue content in the current session prior to the input of the first text (i.e., the second text) into the cause extraction model and outputting the primary cause. This cause extraction model is trained on text using multiple known arguments and trigger words, and can achieve... Figure 2 The first event extraction module 240 is used to extract the first event from the first text and the second text, and the emotion attribution module 260 is used to determine the first event as the first cause of the emotion category corresponding to the first text.
[0104] For example, such as Figure 6A As shown, when the first text 610 is "Garbage, why is it falling again? Can you recommend a reliable fund?", and the second text 620 before the input of the first text includes the dialogue content 620a input by user B, "I want to check the funds I hold.", and the reply content 620b of robot B to the user, "You currently hold the fund Eastmoney.", after the server recognizes that the target of the first text 610 is "recommend a fund" and the corresponding emotion category is "anger", it can also input both the first text 610 and the second text 620 into the cause extraction model. Then, the cause extraction model outputs the first cause of the emotion category "anger" corresponding to the first text 610 as "Eastmoney Fund is falling". Here, "Eastmoney Fund" is the argument, and "falling" is the trigger word.
[0105] Optionally, unlike the method described above which extracts arguments and trigger words from the first and second texts to form the first cause, the server can also determine the first cause of the emotion category corresponding to the first text through a cause classification model. That is, the server directly inputs the first text and the dialogue content in the current session before the input of the first text (i.e., the second text) into the cause classification model, outputs the cause category corresponding to the entire first and second texts, and then determines the cause category as the first cause of the emotion category corresponding to the first text. The cause category includes arguments and trigger words, such as "East Money Fund fell," "East Money Fund rose," and "Baijiu stock rose." The cause classification model is trained based on texts with multiple known cause categories. For example, when the server recognizes... Figure 6A After setting the target of the first text 610 as "recommendation fund" and the corresponding emotion category as "anger", the first text 610 and the above text can be combined... Figure 6A The second text 620 is input into the cause classification model. Then, the cause classification model outputs the cause category "East Money Fund decline" corresponding to the first text 610 and the second text 620. Then, the server can use the emotion attribution module to determine the cause category as the first cause "East Money Fund decline" of the emotion category "anger" corresponding to the first text 610.
[0106] Optionally, in addition to the emotion categories listed above, which may include emotions such as happiness, anger, and sadness, the emotion category in this embodiment may also include "empty," meaning no emotion. After recognizing the target of the first text and its corresponding emotion category, the server may first determine whether the emotion category is empty. If the emotion category is not empty, meaning the first text expresses emotions such as happiness, sadness, or anger, then step 506 is executed to determine the first cause of the emotion category corresponding to the first text. If the emotion category is empty, meaning the first text is found to have no emotion, then the target of the first text can be directly rendered through the text renderer to obtain the target response text. For example, when the user inputs the first text "I want to check the funds I hold.", the emotion category corresponding to the first text identified by the emotion recognition model is "empty." At this time, the server can directly render the target of the first text to obtain the target response text "You currently hold Eastmoney funds."
[0107] Step 508: Process the target based on the emotion category and the primary reason to obtain the target response text.
[0108] Specifically, after identifying the target to be executed of the first text and its corresponding emotion category, and determining the primary reason for the corresponding emotion category of the first text, the server can render the target to be executed based on the emotion category and the primary reason using a text renderer, thereby obtaining a personalized target response text.
[0109] For example, the server can proceed according to step 506. Figure 6A For example, the emotion category "anger" corresponding to the first text 610, and the primary reason for this emotion category, "the decline of Eastmoney Fund," are used to render the target "recommended fund" generated by the NLU module from the first text 610, resulting in the personalized target response text: "Don't be angry, sir. I believe Eastmoney Fund will stop falling soon. I'll recommend Fund A to you." At this point, as... Figure 6B As shown, the server will also send the target response text back to the user's client, i.e. Figure 6B Chatbot B will output the target reply text 630.
[0110] This embodiment of the specification renders the target to be executed by combining the emotion category corresponding to the first text entered by the user in the current conversation with the first reason for the emotion category determined by the first text and the current conversation content before the first text was entered (i.e., the second text). This results in more diverse and reasonable personalized target response text. Using this method, on the one hand, the user's emotions are guided by using the emotion category corresponding to the first text to render the target to be executed; on the other hand, the targeted response to the user's input text is achieved by using the first reason for the emotion category to render the target to be executed. This provides better service to users, especially by soothing and guiding negative user emotions such as "anger" and "disappointment," and fostering stronger interaction with users. This further improves user stickiness and user experience, and also demonstrates the intelligence of the service.
[0111] The following describes another data processing method provided in the embodiments of this specification. Please refer to [link / reference needed] for details. Figure 7 This is a flowchart illustrating another data processing method provided in an exemplary embodiment of this specification. Figure 7 As shown, this data processing method includes the following steps:
[0112] Step 702: Receive the first text entered by the user in the current conversation.
[0113] Specifically, step 702 is the same as step 302, and will not be repeated here.
[0114] Step 704: Identify the target to be executed based on the first text, input the first text into the emotion recognition model, and output the emotion category corresponding to the first text.
[0115] Specifically, step 704 is the same as step 304, and will not be repeated here.
[0116] Step 706: Determine the primary cause of the emotion category corresponding to the first text.
[0117] Specifically, steps 706 and 506 are the same, and will not be repeated here.
[0118] Step 708: Extract user information from the database based on the first text.
[0119] Specifically, after identifying the target to be executed and the corresponding emotion category of the first text mentioned above, the server can also... Figure 2 The second event extraction module 250 extracts keywords from the first text, and extracts user information related to the first text from the database based on the keywords and the user identifier corresponding to the first text, and extracts a second event from the user information; the second event includes arguments and trigger words. The second event is used to characterize events in user information related to the content of the current dialogue, excluding the current dialogue itself. That is, the server can extract a second event carrying the user identifier corresponding to the first text and including the keywords from the database based on the keywords in the first text. The database can be the database corresponding to the user version software installed on the terminal or the database corresponding to other software associated with the user version software, etc., and this embodiment does not specifically limit it. For example, if the first text is "Garbage, why is it falling again? Can you recommend a reliable fund?", and the user who entered the first text is identified as User A, the server can extract the keyword "fund" from the first text. Then, it can extract user information from the database that carries the user identifier "User A" and includes the keyword "fund", such as "East Money Fund has fallen by 10%", "Medical Fund has fallen by 15%", "Currently, Photovoltaic Fund is up by 8%", etc., and extract the second event "Medical Fund fell" and "Photovoltaic Fund rose" from the above user information.
[0120] Step 710: Determine the second cause that caused the emotion category corresponding to the first text based on user information.
[0121] Specifically, the server can determine the second cause of the emotion category corresponding to the first text from the second events extracted from the aforementioned user information using the emotion attribution module. This is equivalent to the server first extracting the arguments or trigger words included in the first text, and then using the emotion attribution module to find the attribution event (i.e., the second cause) in the second events that matches the arguments or trigger words. In other words, the second cause of the emotion category is determined based on user information other than the first text and its preceding text (the second text). In this embodiment, the second cause can be referred to as an external cause, i.e., a cause summarized from user information outside of the current dialogue. For example, when the emotion category corresponding to the first text is identified as anger, and the extracted argument is "fund" and the keyword is "decline," the server can use the emotion attribution module based on the arguments and trigger words to find the second cause of user anger as "medical fund decline" from the second events "stock decline," "medical fund decline," and "photovoltaic fund rise."
[0122] Step 712: Match the first text with the first reason to obtain the first matching degree, and match the first text with the second reason to obtain the second matching degree.
[0123] Specifically, after determining the first and second reasons that cause the emotion category corresponding to the first text, the server will match the first text with the first reason to obtain a first matching degree, and match the first text with the second reason to obtain a second matching degree.
[0124] Specifically, the first matching degree can be the ratio of the number of characters in the first reason that are the same as the first text to the total number of characters included in the first reason. Similarly, the second matching degree can be the ratio of the number of characters in the second reason that are the same as the first text to the total number of characters included in the second reason.
[0125] For example, when the first text is "Garbage, why is Eastmoney Fund falling again? Can you recommend a reliable fund?", the first reason is "Eastmoney Fund is falling", and the second reason is "Medical Fund is falling", the number of words identical to the first text in the first reason (Eastmoney Fund is falling) is 8, and the total number of words included in the first reason is 8. Then the server will calculate that the first text and the first reason have a first matching degree of 100%. The number of words identical to the first text in the second reason (fund is falling) is 4, and the total number of words included in the second reason is 6. Then the server will calculate that the first text and the second reason have a second matching degree of 66.66%.
[0126] The calculation methods for the first and second matching degrees are not limited to those listed above. Other calculation methods may be used in specific implementations, and the embodiments in this specification do not limit them.
[0127] Step 714: Determine whether the second matching degree is greater than the first matching degree; if yes, proceed to step 716; if no, proceed to step 718.
[0128] Specifically, after obtaining the first and second matching degrees, the server will further determine whether the second matching degree is greater than the first matching degree. If yes, then step 716 is executed; otherwise, step 718 is executed. For example, when the first matching degree is 90% and the second matching degree is 55%, it can be determined that the first matching degree is greater than the second matching degree, and then step 716 is executed.
[0129] Step 716: Process the target text based on the emotion category corresponding to the first text and the second reason to obtain the target response text.
[0130] Specifically, if the second matching degree is greater than the first matching degree, the second reason is determined as the true cause of the emotion category corresponding to the first text. Based on the emotion category corresponding to the first text and the second reason, the target to be executed is processed to obtain the target response text. The process of processing the target to be executed based on the emotion category corresponding to the first text and the second reason to obtain the target response text is the same as step 508 and will not be repeated here.
[0131] Step 718: Process the target text based on the emotion category and the first reason corresponding to the first text to obtain the target response text.
[0132] Specifically, if the second matching degree is less than or equal to the first matching degree, the first reason is determined as the true cause of the emotion category corresponding to the first text. Based on the emotion category corresponding to the first text and the first reason, the target to be executed is processed to obtain the target response text. The process of processing the target to be executed based on the emotion category corresponding to the first text and the first reason to obtain the target response text is the same as step 508 and will not be repeated here.
[0133] In other words, in this embodiment of the specification, the reason with a higher degree of matching with the first text can be determined as the true reason for the emotion category corresponding to the first text, and then the target to be executed is rendered based on the true reason and the aforementioned emotion category. This can more accurately determine the reason for the user's emotion.
[0134] In this embodiment, the server not only determines the first cause of the emotional category corresponding to the first text (i.e., the internal cause in the current dialogue), but also determines the second cause (i.e., the external cause in other content outside the current dialogue). The server matches the first text with the first cause to obtain a first matching degree, and matches the first text with the second cause to obtain a second matching degree. Then, by determining whether the second matching degree is greater than the first matching degree, the server determines the true cause of the emotional category corresponding to the first text. Combining the emotional category of the first text entered by the user in the current dialogue with the determined true cause, the server renders the target to be executed, thereby obtaining more diverse and reasonably accurate personalized target response text. This allows the server to provide better and more targeted services to users regarding the events they inquire about, especially in soothing and guiding negative user emotions such as "anger," "disappointment," and "fear," further demonstrating the intelligence of the service.
[0135] Please refer to Figure 8 , Figure 8 A data processing apparatus is provided as an exemplary embodiment of this specification. The data processing apparatus 800 includes:
[0136] The receiving module 810 is used to receive the first text entered by the user in the current conversation;
[0137] The target recognition module 820 is used to recognize the target to be executed based on the first text mentioned above;
[0138] The emotion recognition module 830 is used to input the first text into the emotion recognition model and output the emotion category corresponding to the first text; the emotion recognition model is trained based on texts with multiple known emotion categories;
[0139] The processing module 840 is used to process the target to be executed based on the emotion category corresponding to the first text to obtain the target response text.
[0140] In one possible implementation, the device 800 further includes:
[0141] The determination module is used to determine the primary cause of the emotional category corresponding to the first text mentioned above.
[0142] The aforementioned processing module 840 is specifically used to process the aforementioned target to be executed based on the aforementioned emotion category and the aforementioned first reason, and obtain the target response text.
[0143] In one possible implementation, the determining module is specifically used to determine a first cause for the emotion category corresponding to the first text based on the first text and the second text; wherein the second text is the dialogue content in the current session before the input of the first text.
[0144] In one possible implementation, the aforementioned determining module is specifically used to input the aforementioned first text and the aforementioned second text into the cause extraction model and output the aforementioned first cause; the aforementioned first cause includes arguments and trigger words; the aforementioned cause extraction model is trained based on texts with multiple known arguments and trigger words.
[0145] In one possible implementation, the aforementioned determining module includes:
[0146] The cause classification unit is used to input the first text and the second text into the cause classification model and output the cause categories corresponding to the first text and the second text; the cause categories include arguments and trigger words; the cause classification model is trained based on texts with multiple known cause categories;
[0147] The determining unit is used to determine the above cause category as the above first cause.
[0148] In one possible implementation, the device further includes:
[0149] The extraction module is used to extract user information from the database based on the first text mentioned above;
[0150] The aforementioned determining module is also used to determine a second reason for the emotion category corresponding to the aforementioned first text based on the aforementioned user information;
[0151] The aforementioned processing module 840 is specifically used to process the aforementioned target to be executed based on the aforementioned emotion category, the aforementioned first reason, and the aforementioned second reason, to obtain the target response text.
[0152] In one possible implementation, the extraction module is specifically used to extract keywords from the first text.
[0153] The user information was extracted from the database based on the keywords mentioned above.
[0154] In one possible implementation, the processing module 840 includes:
[0155] A matching unit is used to match the first text with the first reason to obtain a first matching degree, and to match the first text with the second reason to obtain a second matching degree;
[0156] The processing unit is configured to, if the second matching degree is greater than the first matching degree, process the target to be executed based on the emotion category corresponding to the first text and the second reason to obtain the target response text;
[0157] The processing unit is further configured to, if the second matching degree is less than or equal to the first matching degree, process the target to be executed based on the emotion category corresponding to the first text and the first reason to obtain the target response text.
[0158] The division of modules in the above-described data processing device is for illustrative purposes only. In other embodiments, the data processing device can be divided into different modules as needed to complete all or part of the functions of the above-described data processing device. The implementation of each module in the data processing device provided in the embodiments of this specification can be in the form of a computer program. This computer program can run on a terminal or server. The program modules constituted by this computer program can be stored in the memory of the terminal or server. When the computer program is executed by a processor, it implements all or part of the steps of the data processing method described in the embodiments of this specification.
[0159] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this specification.
[0160] like Figure 9 As shown, the electronic device 900 may include: at least one processor 910, at least one communication bus 920, a user interface 930, at least one network interface 940, and a memory 950. The communication bus 920 can be used to enable communication between the aforementioned components.
[0161] The user interface 930 may include a display screen and a camera. Optional user interfaces may also include standard wired interfaces and wireless interfaces.
[0162] The network interface 940 may optionally include a Bluetooth module, an NFC module, a Wi-Fi module, etc.
[0163] The processor 910 may include one or more processing cores. The processor 910 connects to various parts within the electronic device 900 using various interfaces and lines. It executes various functions and processes data of the electronic device 900 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 950, and by calling data stored in the memory 950. Optionally, the processor 910 may be implemented using at least one hardware form of DSP, FPGA, or PLA. The processor 910 may integrate one or more of the following: CPU, GPU, and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 910 and may be implemented as a separate chip.
[0164] The memory 950 may include RAM or ROM. Optionally, the memory 950 may include a non-transitory computer-readable medium. The memory 950 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 950 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a receiving function, a target recognition function, an emotion recognition function, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 950 may also be at least one storage device located remotely from the aforementioned processor 910. Figure 9 As shown, the memory 950, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and program instructions.
[0165] Specifically, the processor 910 can be used to call program instructions stored in the memory 950 and perform the following operations:
[0166] Receive the first text entered by the user in the current conversation.
[0167] The target to be executed is identified based on the first text, and the first text is input into the emotion recognition model to output the emotion category corresponding to the first text; the emotion recognition model is trained based on texts with multiple known emotion categories.
[0168] Based on the emotion category corresponding to the first text, the target to be executed is processed to obtain the target response text.
[0169] In some possible embodiments, the processor 910 identifies the target to be executed based on the first text, inputs the first text into the emotion recognition module, outputs the emotion category corresponding to the first text, processes the target to be executed based on the emotion category corresponding to the first text, and before obtaining the target response text, it is also used to perform:
[0170] The primary cause of the emotional category corresponding to the first text above was identified.
[0171] When the processor 910 processes the target to be executed based on the emotion category corresponding to the first text to obtain the target reply text, it specifically performs the following: processing the target to be executed based on the emotion category and the first reason to obtain the target reply text.
[0172] In some possible embodiments, when the processor 910 determines the first cause of the emotion category corresponding to the first text, it specifically performs the following:
[0173] Based on the first text and the second text, a first cause for the emotion category corresponding to the first text is determined; wherein, the second text is the dialogue content in the current session before the input of the first text.
[0174] In some possible embodiments, when the processor 910 determines the first cause of the emotion category corresponding to the first text based on the first text and the second text, it is specifically used to perform:
[0175] The first text and the second text are input into the cause extraction model, which outputs the first cause. The first cause includes arguments and trigger words. The cause extraction model is trained based on texts with multiple known arguments and trigger words.
[0176] In some possible embodiments, when the processor 910 determines the first cause of the emotion category corresponding to the first text based on the first text and the second text, it is specifically used to perform:
[0177] The first text and the second text are input into the cause classification model, which outputs the cause category corresponding to the first text and the second text. The cause category includes arguments and trigger words. The cause classification model is trained based on texts with multiple known cause categories. The cause category is determined as the first cause.
[0178] In some possible embodiments, after the processor 910 identifies the target to be executed based on the first text, inputs the first text into the emotion recognition module, and outputs the emotion category corresponding to the first text, before processing the target to be executed based on the emotion category corresponding to the first text to obtain the target response text, it is also used to perform:
[0179] User information is extracted from the database based on the first text mentioned above.
[0180] Based on the aforementioned user information, a second reason was determined that caused the emotional category corresponding to the first text.
[0181] Based on the aforementioned emotion categories, the aforementioned first reason, and the aforementioned second reason, the aforementioned objectives to be executed are processed to obtain the objective response text.
[0182] In some possible embodiments, when the processor 910 extracts user information from the database based on the first text, it specifically performs the following:
[0183] Extract the keywords from the first text above.
[0184] The user information was extracted from the database based on the keywords mentioned above.
[0185] In some possible embodiments, when the processor 910 processes the target to be executed based on the emotion category, the first reason, and the second reason to obtain the target response text, it is specifically used to execute:
[0186] The first text is matched with the first reason to obtain a first matching degree, and the first text is matched with the second reason to obtain a second matching degree.
[0187] If the second matching degree is greater than the first matching degree, the target to be executed is processed based on the emotion category corresponding to the first text and the second reason to obtain the target response text.
[0188] If the second matching degree is less than or equal to the first matching degree, the target to be executed is processed based on the emotion category corresponding to the first text and the first reason to obtain the target response text.
[0189] This specification also provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps in the above embodiments. If the constituent modules of the above data processing apparatus are implemented as software functional units and sold or used as independent products, they can be stored in the above-described computer-readable storage medium.
[0190] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0191] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation can be combined arbitrarily.
[0192] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Any modifications and improvements made by those skilled in the art to the technical solutions of this specification without departing from the spirit of this specification should fall within the protection scope defined by the claims.
[0193] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
Claims
1. A data processing method, the method comprising: Receive the first text entered by the user in the current conversation; The target to be executed is identified based on the first text, and the first text is input into the emotion recognition model to output the emotion category corresponding to the first text; The emotion recognition model is trained on text based on multiple known emotion categories; the target to be executed is used to represent the user's dialogue intent. The target to be executed is processed based on the emotion category corresponding to the first text to obtain the target response text; After identifying the target to be executed based on the first text, inputting the first text into the emotion recognition module, and outputting the emotion category corresponding to the first text, before processing the target to be executed based on the emotion category corresponding to the first text to obtain the target response text, the method further includes: The first cause for the emotion category corresponding to the first text is determined based on the first text and the second text; the second text is the dialogue content in the current session before the input of the first text; the first cause is the internal reason summarized from this dialogue. A second reason for the emotion category corresponding to the first text is determined based on user information; the second reason is an external reason summarized from user information outside of this conversation. The step of processing the target text based on the emotion category corresponding to the first text to obtain the target response text includes: The target to be executed is processed based on the emotion category, the first reason, and the second reason to obtain the target response text.
2. The method of claim 1, wherein determining the first cause of the emotion category corresponding to the first text based on the first text and the second text comprises: The first text and the second text are input into the cause extraction model, and the first cause is output; the first cause includes arguments and trigger words. The cause extraction model is trained on text based on multiple known arguments and trigger words.
3. The method of claim 1, wherein determining the first cause of the emotion category corresponding to the first text based on the first text and the second text includes: Input the first text and the second text into the cause classification model, and output the cause categories corresponding to the first text and the second text; The cause categories include arguments and trigger words; the cause classification model is trained on texts with multiple known cause categories; The cause category is determined to be the first cause.
4. The method as described in claim 1, wherein after identifying the target to be executed based on the first text, inputting the first text into the emotion recognition module, and outputting the emotion category corresponding to the first text, and before processing the target to be executed based on the emotion category corresponding to the first text to obtain the target response text, the method further includes: User information is extracted from the database based on the first text.
5. The method of claim 4, wherein extracting user information from the database based on the first text comprises: Extract keywords from the first text; The user information is extracted from the database based on the keywords.
6. The method of claim 1, wherein processing the target to be executed based on the emotion category, the first reason, and the second reason to obtain the target response text includes: The first text is matched with the first reason to obtain a first matching degree, and the first text is matched with the second reason to obtain a second matching degree; If the second matching degree is greater than the first matching degree, the target to be executed is processed based on the emotion category corresponding to the first text and the second reason to obtain the target response text; If the second matching degree is less than or equal to the first matching degree, the target to be executed is processed based on the emotion category corresponding to the first text and the first reason to obtain the target response text.
7. A data processing apparatus, the apparatus comprising: The receiving module is used to receive the first text entered by the user in the current conversation; The target recognition module is used to identify the target to be executed based on the first text; The target to be executed is used to represent the user's dialogue intent; The emotion recognition module is used to input the first text into the emotion recognition model and output the emotion category corresponding to the first text. The emotion recognition model is trained on texts with multiple known emotion categories; The processing module is used to process the target to be executed based on the emotion category corresponding to the first text to obtain the target response text; The device further includes: The determination module is used to determine a first cause for the emotion category corresponding to the first text based on the first text and a second text, and to determine a second cause for the emotion category corresponding to the first text based on user information; the second text is the dialogue content in the current session before the input of the first text; the first cause is an internal cause summarized from the current dialogue; the second cause is an external cause summarized from user information outside the current dialogue; The processing module is specifically used to process the target to be executed based on the emotion category, the first reason, and the second reason to obtain the target response text.
8. The apparatus of claim 7, wherein the determining module is specifically configured to input the first text and the second text into a cause extraction model and output the first cause; the first cause includes arguments and trigger words; the cause extraction model is trained based on texts with multiple known arguments and trigger words.
9. The apparatus of claim 7, wherein the determining module comprises: The cause classification unit is used to input the first text and the second text into the cause classification model and output the cause categories corresponding to the first text and the second text; the cause categories include arguments and trigger words; the cause classification model is trained based on texts with multiple known cause categories; A determining unit is used to determine the cause category as the first cause.
10. The apparatus of claim 7, further comprising: The extraction module is used to extract user information from the database based on the first text.
11. The apparatus of claim 10, wherein the extraction module is specifically used to extract keywords from the first text; The user information is extracted from the database based on the keywords.
12. The apparatus of claim 7, wherein the processing module comprises: A matching unit is configured to match the first text with the first reason to obtain a first matching degree, and to match the first text with the second reason to obtain a second matching degree; The processing unit is configured to process the target to be executed based on the emotion category corresponding to the first text and the second reason if the second matching degree is greater than the first matching degree, so as to obtain the target reply text; The processing unit is further configured to, if the second matching degree is less than or equal to the first matching degree, process the target to be executed based on the emotion category corresponding to the first text and the first reason to obtain the target reply text.
13. An electronic device, comprising: Processor and memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code stored in the memory to perform the method as described in any one of claims 1-6.
14. A computer storage medium storing a plurality of instructions adapted for loading by a processor and performing the method steps of any one of claims 1-6.
15. A computer program product comprising instructions that, when run on a computer or processor, cause the computer or processor to perform the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Emotion reason determination method and device based on dialogue data
CN111274390A