Text sentence emotion recognition method, device, equipment and computer-readable medium
By preprocessing and splicing the dialogue text data, combining the emotional tone big model and language feature model, dialogue graph structure information is generated, which solves the problem of lack of global theme or emotional tone modeling in the existing technology, and improves the accuracy and consistency of emotional recognition in text statements.
Patent Information
- Application Number
- CN202510081185.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2045-01-20
AI Technical Summary
The lack of explicit modeling of global themes or emotional tone of dialogue in emotional recognition of text statements results in low accuracy and consistency of emotional recognition.
By pre-processing and splicing the pre-stored dialogue text data, a dialogue emotion tone description information set and statement feature vector set are generated, and dialogue graph structure information is generated based on the global dialogue emotion feature vector, and finally a statement emotion feature information set and text statement emotion category are generated.
The accuracy and consistency of emotional recognition in text sentences is improved, and the overall description of emotional recognition of dialogue is enhanced by integrating global emotional dynamic information.
Smart Images

Figure CN119513322B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a text sentence emotion recognition method, apparatus, device, and computer-readable medium. Background Art
[0002] Text sentence emotion recognition is a technology used to analyze the emotions contained in text sentences. In conversations, emotional dynamics are more of an interactive phenomenon, rather than just an individual or one-way emotional expression. Therefore, effective conversation emotion analysis needs to consider multiple factors that affect the emotional state. The commonly used text sentence emotion recognition method is to model the context information and the relationship between speakers in the conversation through recursive neural networks (RNN) or graph neural networks (GCN), introduce common sense information using external knowledge bases (such as common sense knowledge graphs ATOMIC), and obtain the emotional category of text sentences from the modeling of emotional causality and psychological states.
[0003] However, when using the above method to identify sentiment in text sentences, the following technical problems often occur:
[0004] Recurrent neural networks or graph neural networks are used to model the contextual information and the relationships between speakers in a conversation, but the global topic or emotional tone of the conversation is not explicitly modeled. This lack of a holistic description of the emotional dynamics of the entire conversation results in low accuracy and consistency in emotion recognition of text sentences.
[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known to a person of ordinary skill in the art. Summary of the invention
[0006] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0007] Some embodiments of the present disclosure propose a text sentence emotion recognition method, device, electronic device and computer-readable medium to solve one or more of the technical problems mentioned in the above background technology section.
[0008] In a first aspect, some embodiments of the present disclosure provide a method for identifying emotions in text sentences, the method comprising: performing data preprocessing on pre-stored conversation text data to obtain each conversation text information; performing splicing processing on the above each conversation text information to obtain each pre-processed conversation text data; generating a conversation emotion tone description information set based on the above each pre-processed conversation text data and a pre-trained emotion tone large model; generating each sentence feature vector set and each global conversation emotion feature vector based on the above each pre-processed conversation text data, the above conversation emotion tone description information set and a pre-trained language model; generating each conversation graph structure information based on the above each global conversation emotion feature vector, the above each global conversation emotion feature vector and the above each sentence feature vector set; generating each sentence emotion feature information set based on the above each conversation graph structure information; generating each text sentence emotion category based on the above each sentence emotion feature information set.
[0009] In a second aspect, some embodiments of the present disclosure provide a text sentence emotion recognition device, the device comprising: a preprocessing unit, configured to perform data preprocessing on pre-stored dialogue text data to obtain various dialogue text information, wherein each dialogue text information in the above-mentioned dialogue text information includes a dialogue number, a dialogue person, a dialogue sentence number, content information and an emotion label; a splicing processing unit, configured to splice the above-mentioned various dialogue text information to obtain various pre-processed dialogue text data; a first generating unit, configured to generate a dialogue emotion tone description information set based on the above-mentioned various pre-processed dialogue text data and a pre-trained emotion tone large model. ; The second generation unit is configured to generate each sentence feature vector set and each global dialogue emotion feature vector based on the above-mentioned pre-processed dialogue text data, the above-mentioned dialogue emotion tone description information set and the pre-trained language model; the third generation unit is configured to generate each dialogue graph structure information based on the above-mentioned each global dialogue emotion feature vector, the above-mentioned each global dialogue emotion feature vector and the above-mentioned each sentence feature vector set; the fourth generation unit is configured to generate each sentence emotion feature information set based on the above-mentioned each dialogue graph structure information; the fifth generation unit is configured to generate each text sentence emotion category based on the above-mentioned each sentence emotion feature information set.
[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner of the above-mentioned first aspect.
[0011] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.
[0012] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the text sentence emotion recognition method of some embodiments of the present disclosure, the accuracy and consistency of text sentence emotion recognition are improved. Specifically, the reason for the low accuracy and consistency of text sentence emotion recognition is that the context information and the relationship between the speakers in the dialogue are modeled by a recursive neural network or a graph neural network, but the global theme or emotional tone of the dialogue is not explicitly modeled, and there is a lack of an overall description of the emotional dynamics of the entire dialogue, resulting in low accuracy and consistency of text sentence emotion recognition. Based on this, the text sentence emotion recognition method of some embodiments of the present disclosure first performs data preprocessing on the pre-stored dialogue text data to obtain each dialogue text information. Thus, the dialogue text data that needs to be subjected to text sentence emotion recognition can be preprocessed to obtain each dialogue text information with a more regular format. Then, the above-mentioned each dialogue text information is spliced to obtain each preprocessed dialogue text data. Thus, each dialogue text information can be grouped into each continuous dialogue stream to obtain each preprocessed dialogue text data. Then, based on the above-mentioned each preprocessed dialogue text data and the pre-trained emotional tone large model, a dialogue emotional tone description information set is generated. Thus, the conversation emotional tone information of each pre-processed conversation text data can be obtained through the emotional tone large model. Secondly, based on the above-mentioned pre-processed conversation text data, the above-mentioned conversation emotional tone description information set and the pre-trained language feature model, each sentence feature vector set and each global conversation emotional feature vector are generated. Thus, each sentence feature vector set and each global conversation emotional feature vector can be obtained through the language feature model. Then, based on the above-mentioned each global conversation emotional feature vector, the above-mentioned each global conversation emotional feature vector and the above-mentioned each sentence feature vector set, each conversation graph structure information is generated. Thus, each sentence feature vector set and each global conversation emotional feature vector can be fused to obtain each enhanced sentence feature vector, so as to obtain each conversation graph structure information according to the connection between each enhanced sentence feature vector. Secondly, based on the above-mentioned each conversation graph structure information, each sentence emotional feature information set is generated. Thus, the sentence emotional feature information of each sentence can be obtained. Finally, based on the above-mentioned each sentence emotional feature information set, each text sentence emotional category is generated. Thus, the text sentence emotional category corresponding to each sentence can be obtained. Also, because each enhanced sentence feature vector is obtained by fusing each sentence feature vector set with each global conversation emotion feature vector, the trained model for text sentence emotion recognition includes the emotion dynamics on a global scale, thereby improving the accuracy and consistency of text sentence emotion recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0014] Figure 1 is a flowchart of some embodiments of the text sentence emotion recognition method according to the present disclosure;
[0015] Figure 2 It is a test screenshot of the data form of the conversation text data in the database of some embodiments of the present disclosure;
[0016] Figure 3 It is a test screenshot of the data form of the conversation text information after data preprocessing in some embodiments of the present disclosure;
[0017] Figure 4 is a screenshot of the test code of the preprocessing algorithm of some embodiments of the present disclosure;
[0018] Figure 5 It is a test screenshot of the data form of the pre-processed conversation text data after splicing processing in some embodiments of the present disclosure;
[0019] Figure 6 It is a test screenshot in data form of a prompt template of some embodiments of the present disclosure;
[0020] Figure 7 is a schematic diagram of the structure of some embodiments of the text sentence emotion recognition device according to the present disclosure;
[0021] Figure 8 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0022] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0023] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0024] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0025] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0026] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0027] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0028] Figure 1 The process 100 of some embodiments of the text sentence emotion recognition method according to the present disclosure is shown. The text sentence emotion recognition method comprises the following steps:
[0029] Step 101, pre-processing the pre-stored dialogue text data to obtain each dialogue text information.
[0030] In some embodiments, the execution subject (e.g., computing device) of the text sentence emotion recognition method may perform data preprocessing on pre-stored conversation text data to obtain each conversation text information. The conversation text data may be pre-stored text information for text sentence emotion recognition. The conversation text data may be stored as a CSV file. The conversation text data may refer to Figure 2 . Figure 2 It is a test screenshot of the data form of conversation text data in a database in some embodiments of the present disclosure. Figure 2The first row is the name corresponding to each column of data. The second row and the following are the conversation text data without data preprocessing, as shown in the name of the first row, including the conversation number, content information, emotion label, interlocutor and other information of each text sentence. Each of the above-mentioned conversation text information can be text information after data preprocessing. Each of the above-mentioned conversation text information can include: conversation number, interlocutor, conversation paragraph number, content information and emotion label. The above-mentioned conversation number can be a number used to characterize the above-mentioned conversation text information in the above-mentioned conversation text data. The above-mentioned interlocutor can be text information used to characterize the speaker corresponding to the above-mentioned conversation number. The above-mentioned conversation paragraph number can be a number used to characterize the paragraph number of the above-mentioned conversation number in the above-mentioned conversation text data. The above-mentioned content information can be a text content used to characterize the conversation text information corresponding to the above-mentioned conversation number. The above-mentioned emotion label can be a number used to characterize the emotional state of the sentence represented by the content information corresponding to the above-mentioned conversation number. For example, the above-mentioned emotion label can be a number that maps the emotional state of the sentence to 0-6, and each number corresponds to an emotion category. The above-mentioned emotion categories can include: "anger", "disgust", "sadness", "joy", "neutral", "surprise" and "fear". The execution subject may be a server for storing and managing the conversation text data. Figure 3 . Figure 3 It is a test screenshot of the data format of the conversation text information after data preprocessing in some embodiments of the present disclosure. Figure 3 The numbers in the first group "labels" correspond to the emotion labels extracted from the conversation text information after the above data preprocessing. The sentences in the second group "sentences" correspond to the content information extracted from the conversation text information after the above data preprocessing. The names in the third group "speakers" correspond to the interlocutors extracted from the conversation text information after the above data preprocessing. In practice, the execution entity may combine the conversation number, interlocutor, conversation paragraph number, content information and emotion label of the same text information in the conversation text information into conversation text information through a preprocessing algorithm. The conversation text information may be stored as a JSON file. The preprocessing algorithm may be a code for characterizing the extraction of data from a CSV file and saving it as a JSON file. For example, the preprocessing algorithm may be a function in a JSON library, and the preprocessing algorithm may be json.dumps() or json.dump(). The preprocessing algorithm may refer to Figure 4 . Figure 4 It is a screenshot of the test code of the preprocessing algorithm of some embodiments of the present disclosure. Figure 4The third-party libraries (pandas and json) required for the code in lines 1-2 are shown in the figure. Lines 4-6 are marked as "Loading CSV files". Lines 8-9 are marked as "Grouping data by 'conversation ID'". Lines 11-20 are marked as "Update label mapping according to the provided MELD mapping". Lines 22-39 are marked as "Processing each group using MELD mapping and numbered dialogs to form an updated JSON structure". Lines 41-42 are marked as "Converting the results to JSON". Lines 44-47 are marked as "Save JSON output to a file".
[0031] Step 102, concatenating the dialogue text information to obtain pre-processed dialogue text data.
[0032] In some embodiments, the execution entity may concatenate the various dialogue text information to obtain various pre-processed dialogue text data. Each of the pre-processed dialogue text data may be used to characterize the dialogue text information belonging to the same paragraph. In practice, the execution entity may determine the dialogue text information corresponding to the same dialogue paragraph number as a dialogue text information group based on the dialogue paragraph number included in each dialogue text information in the various dialogue text information. Then, the execution entity may combine the various dialogue text information in the dialogue text information group into pre-processed dialogue text data according to the order of the dialogue numbers. The pre-processed dialogue text data may refer to Figure 5 . Figure 5 It is a test screenshot of the data format of the pre-processed conversation text data after splicing processing in some embodiments of the present disclosure. Figure 5 The text information in is a piece of pre-processed conversation text data after splicing.
[0033] Step 103: Generate a dialogue emotional tone description information set based on the pre-processed dialogue text data and the pre-trained emotional tone large model.
[0034] In some embodiments, the execution subject may generate a conversation emotion tone description information set based on the above-mentioned pre-processed conversation text data and the pre-trained emotion tone big model. Each conversation emotion tone description information in the conversation emotion tone description information set may be data information for characterizing the emotion tone of the conversation. The emotion tone big model may be a big model for generating a conversation emotion tone description. For example, the emotion tone big model may be a Llama-3.1-8B-Instruct model.
[0035] In some optional implementations of some embodiments, the execution subject may generate a dialogue emotional tone description information set based on the above-mentioned pre-processed dialogue text data and the pre-trained emotional tone large model through the following steps:
[0036] The first step is to configure the above-mentioned emotional tone large model based on the preset model configuration method to obtain the processed emotional tone large model. Among them, the above-mentioned preset model configuration method can be a configuration parameter used to characterize the configuration of the above-mentioned emotional tone large model. The above-mentioned preset model configuration method can be a pre-set parameter, which is not limited here. For example, the above-mentioned preset model configuration method can be "load the pre-trained Llama-3.1-8B-Instruct model, and configure it as a quantization mode (4-bit precision). Load the tokenizer of the model, and set the filling mark." In practice, the above-mentioned execution entity can configure the above-mentioned emotional tone large model according to the configuration parameters in the above-mentioned preset model configuration method to obtain the processed emotional tone large model.
[0037] The second step is to perform the following steps on each of the pre-processed dialogue text data in the above-mentioned pre-processed dialogue text data:
[0038] The first sub-step is to determine the pre-stored prompt template corresponding to the pre-processed dialogue text data as the target prompt template. The prompt template may be text information used to guide the model to generate a description of the subject and emotional tone corresponding to the pre-processed dialogue text data. The prompt template may be a pre-set text information, which is not limited here. The prompt template may refer to Figure 6 . Figure 6 It is a test screenshot in data form of the prompt template of some embodiments of the present disclosure. Figure 6 The text in is the prompt template corresponding to the boldface "{conversation content C}" in the figure. The boldface characters in the figure can be the above-mentioned pre-processed conversation text data.
[0039] The second sub-step is to input the target prompt template and the pre-processed dialogue text data into the processed emotion tone model to obtain the dialogue emotion tone description information. In practice, the execution subject can input the target prompt template and the pre-processed dialogue text data into the processed emotion tone model to obtain the dialogue emotion tone description information. The processed emotion tone model that generates the dialogue emotion tone description information can be described by the formula: . For the The emotional tone of the conversation is described. This is a large model of the processed emotional tone. Provide a template for the target prompt. For the Preprocess the conversation text data.
[0040] The third step is to determine the obtained dialogue emotion description information as a dialogue emotion description information set.
[0041] Step 104, based on the pre-processed dialogue text data, the dialogue emotion tone description information set and the pre-trained language feature model, generate each sentence feature vector set and each global dialogue emotion feature vector.
[0042] In some embodiments, the execution subject may generate each sentence feature vector set and each global dialogue emotion feature vector based on each pre-processed dialogue text data, the dialogue emotion tone description information set and the pre-trained language feature model. The language feature model may be a model for generating feature vectors for each sentence and the global dialogue emotion tone. For example, the language feature model may be a RoBERTa model that takes the pre-processed dialogue text data or each dialogue text information included in the pre-processed dialogue text data as input and takes the corresponding feature vector as output. Each sentence feature vector in each sentence feature vector set may be a feature vector for characterizing the emotion tone corresponding to the dialogue text data. Each global dialogue emotion feature vector in each global dialogue emotion feature vector may be a feature vector for characterizing the emotion tone corresponding to the pre-processed dialogue text data. There is a one-to-one correspondence between the sentence feature vector set and the global dialogue emotion feature vector.
[0043] In some optional implementations of some embodiments, the execution subject may generate each sentence feature vector set and each global dialogue emotion feature vector based on the above-mentioned pre-processed dialogue text data, the above-mentioned dialogue emotion tone description information set and the pre-trained language feature model through the following steps:
[0044] The first step is to perform the following steps on each of the pre-processed dialogue text data in the above-mentioned pre-processed dialogue text data:
[0045] In the first sub-step, the conversation emotion tone description information in the conversation emotion tone description information set corresponding to the pre-processed conversation text data is determined as the target emotion tone description information.
[0046] The second sub-step is to input the target emotional tone description information into the language feature model to obtain a global dialogue emotional feature vector. In practice, the execution subject may input the target emotional tone description information into the language feature model to obtain a global dialogue emotional feature vector. The language feature model used to generate the global dialogue emotional feature vector can be described by the formula: . For the A global conversation sentiment feature vector. It is a language feature model. For the The emotional tone of the conversation is described.
[0047] In the third sub-step, for each of the dialogue text information included in the pre-processed dialogue text data, the dialogue text information is input into the language feature model to obtain a sentence feature vector. In practice, for each of the dialogue text information included in the pre-processed dialogue text data, the execution subject may input the dialogue text information into the language feature model to obtain a sentence feature vector. The language feature model used to generate the sentence feature vector can be described by a formula: . For the The first A conversation text message. It is a language feature model. For the The first The sentence feature vector generated by the conversation text information.
[0048] The fourth sub-step is to determine the obtained sentence feature vectors as a sentence feature vector set.
[0049] Step 105: Generate each dialogue graph structure information based on each global dialogue emotion feature vector, each global dialogue emotion feature vector and each sentence feature vector set.
[0050] In some embodiments, the execution subject may generate each dialogue graph structure information based on each global dialogue emotion feature vector, each global dialogue emotion feature vector and each sentence feature vector set. The dialogue graph structure information may be a graph structure composed of each enhanced sentence feature vector. Each of the enhanced sentence feature vectors may be a sentence feature vector enhanced by the global dialogue emotion feature vector. The dialogue graph structure information includes each layer of dialogue graph structure information, and each layer of dialogue graph structure information includes each node feature and each edge weight. Each node feature of each node feature may be a node for representing the enhanced sentence feature vector. Each edge weight of each edge weight may be a weight for representing an edge between two of the node features.
[0051] In some optional implementations of some embodiments, the execution subject may generate each dialogue graph structure information based on each global dialogue emotion feature vector, each global dialogue emotion feature vector and each sentence feature vector set through the following steps:
[0052] In the first step, for each of the above global conversation emotion feature vectors, the following steps are performed:
[0053] In the first sub-step, the sentence feature vector set corresponding to the global dialogue emotion feature vector in the above-mentioned individual sentence feature vector sets is determined as the target sentence feature vector set.
[0054] In the second sub-step, for each sentence feature vector in the target sentence feature vector set, the sentence feature vector and the global conversation emotion feature vector are input into a pre-trained enhanced sentence feature model to obtain an enhanced sentence feature vector. The enhanced sentence feature model may be a multi-layer perceptron (MLP) that takes the global conversation emotion feature vector and the sentence feature vector as input and the enhanced sentence feature vector as output. The enhanced sentence feature model may include an enhanced weight matrix. The enhanced weight matrix may be a weight matrix of the pre-trained enhanced sentence feature model after training and learning, which is not limited here. In practice, the execution subject may input the global conversation emotion feature vector and the sentence feature vector into the enhanced sentence feature model to obtain an enhanced sentence feature vector. The enhanced sentence feature model that generates the enhanced sentence feature vector may be described by the formula: . For the A global conversation sentiment feature vector. For the The sentence feature vector corresponding to the global dialogue sentiment feature vector is sentence feature vector. is the enhanced weight matrix. For the The sentence feature vector corresponding to the global dialogue sentiment feature vector is The enhanced sentence feature vector is generated from the sentence feature vectors.
[0055] In the second step, based on the obtained enhanced sentence feature vectors, for each of the above global dialogue emotion feature vectors, the following steps are performed:
[0056] In the first sub-step, each enhanced sentence feature vector corresponding to the global dialogue emotion feature vector among the enhanced sentence feature vectors is determined as each target enhanced sentence feature vector.
[0057] The second sub-step is to encode the dialogue text information corresponding to each target enhanced sentence feature vector in the above-mentioned target enhanced sentence feature vectors to obtain the dialogue person code corresponding to the above-mentioned dialogue text information. The above-mentioned dialogue person code may be a feature vector used to characterize the dialogue person. In practice, for the dialogue text information corresponding to each target enhanced sentence feature vector in the above-mentioned target enhanced sentence feature vectors, the above-mentioned execution subject may encode the above-mentioned dialogue person through an encoding algorithm to obtain the dialogue person code. The above-mentioned encoding algorithm may be an algorithm for encoding the dialogue person included in the dialogue text information corresponding to each enhanced sentence feature vector in the above-mentioned enhanced sentence feature vectors. For example, the above-mentioned encoding algorithm may be one-hot encoding.
[0058] In the third sub-step, the obtained interlocutor codes and the target enhanced sentence feature vectors are concatenated to obtain the initial graph structure nodes. In practice, for each of the target enhanced sentence feature vectors, the execution subject can combine the target enhanced sentence feature vector and the interlocutor code corresponding to the target enhanced sentence feature vector into an initial graph structure node. For example, the initial graph structure node can be represented as . For layer 0 An initial graph structure node. Enhance the sentence feature vector for the target. is the dialogue person encoding corresponding to the target enhanced sentence feature vector. The above initial graph structure nodes can be expressed as . is the set of each initial graph structure node. is the number of nodes in each initial graph structure.
[0059] The fourth sub-step is to input the above-mentioned each initial graph structure node into a pre-trained conversation graph generation model to obtain conversation graph structure information. The above-mentioned conversation graph generation model may be a neural network model for generating conversation graph structure information. The above-mentioned conversation graph generation model may include a preset number of layers of transformations, and the above-mentioned preset number of layers may be a preset value and is not limited here. The above-mentioned conversation graph structure information includes conversation graph structure information of each layer, and each layer of conversation graph structure information includes each node feature and each edge weight. For example, the above-mentioned conversation graph generation model may be an attention gated graph neural network (Attentive-GGCN), and the above-mentioned attention gated graph neural network may have k layers of transformation. In practice, the above-mentioned execution subject may input the above-mentioned each initial graph structure node into the above-mentioned conversation graph generation model to obtain conversation graph structure information. The above-mentioned node features included in the above-mentioned layer of conversation graph structure information may be expressed as . is the layer conversation graph structure information of the kth layer. Each edge weight in the above layer conversation graph structure information can be described by the formula: . For the The layer dialog diagram structure information of the layer and The edge weight corresponding to each node feature. For the The layer dialog structure information of the layer includes the Node features. For the The layer dialog structure information of the layer includes the Node features. for The transpose of . for and The attention score. is the activation function. is a natural exponential function. For the The number of node features included in the layer dialog graph structure information of the layer. As an example: when the above node feature is [1,0.5], the above node features When [0.8,0.6], the attention score is 1×0.8+0.5×0.6=1.1. When there are 3 nodes and the attention scores are [1.1, 0.5, 0.2] respectively, the edge weight The calculation method can be e^1.1 / (e^1.1+e^0.5+e^0.2).
[0060] Step 106: Generate a set of emotional feature information of each sentence based on the structural information of each dialogue graph.
[0061] In some embodiments, the execution subject generates each sentence emotion feature information set based on each dialogue graph structure information, wherein each sentence emotion feature information in each sentence emotion feature information set may be a feature vector for characterizing node features included in the dialogue graph structure information.
[0062] In the process of adopting technical solutions to solve the above technical problems, the following problems are often accompanied:
[0063] If the structural information of each dialogue graph generated by the dialogue graph generation model is directly used as the emotional feature information set of each sentence, the quality of the emotional feature information set of each sentence generated will be poor due to the irrelevant information in the structural information of each dialogue graph, resulting in low accuracy and consistency of text sentence emotion recognition.
[0064] Faced with the above technical problems, we decided to adopt the following solutions:
[0065] In some optional implementations of some embodiments, the execution subject may generate each sentence emotion feature information set based on each dialogue graph structure information through the following steps:
[0066] In the first step, for each of the above-mentioned dialogue graph structure information, the following steps are performed:
[0067] In the first sub-step, the following steps are performed on the first layer of the dialog graph structure information in the above dialog graph structure information:
[0068] Sub-step 1: determining each node feature included in the layer dialogue graph structure information as each node feature to be processed.
[0069] Sub-step 2: for each of the above-mentioned node features to be processed, perform the following steps:
[0070] First, based on the above-mentioned node features to be processed, the weights of each edge that meets the preset edge conditions in the above-mentioned layer dialogue graph structure information are determined as the weights of each incoming edge to be processed. Among them, the above-mentioned preset edge condition can be that the edge corresponding to the edge weight is the incoming edge of the above-mentioned node features to be processed. In practice, the above-mentioned execution subject can determine the weights of each edge that is the incoming edge of the above-mentioned node features to be processed as the weights of each incoming edge to be processed.
[0071] Secondly, based on the above-mentioned node characteristics to be processed, the weights of each edge that meets the preset outgoing edge condition in the above-mentioned layer dialogue graph structure information are determined as the weights of each outgoing edge to be processed. Among them, the above-mentioned preset outgoing edge condition can be the weights of each outgoing edge of the above-mentioned node characteristics in the above-mentioned edge weights. In practice, the above-mentioned execution subject can determine the weights of each outgoing edge of the above-mentioned node characteristics in the above-mentioned edge weights as the weights of each outgoing edge to be processed.
[0072] Then, based on the above-mentioned incoming edge weights to be processed and the above-mentioned node features to be processed, the incoming node features to be processed are generated. Among them, the above-mentioned incoming node features to be processed can be feature vectors used to characterize the incoming edges of the above-mentioned node features to be processed. In practice, first, the above-mentioned execution subject can determine the various node features corresponding to the above-mentioned various incoming edge weights to be processed as the various incoming edge node features. Then, the above-mentioned execution subject can input the above-mentioned various incoming edge node features to be processed, the above-mentioned various incoming edge weights to be processed and the above-mentioned node features to be processed into the above-mentioned first preset formula to obtain the incoming node features to be processed. Among them, the above-mentioned first preset formula can be . Corresponding to the above-mentioned nodes to be processed The set of features of each incoming edge node to be processed. For the The layer dialog diagram structure information of the layer The incoming edge node features to be processed. For the The layer dialog diagram structure information of the layer and The edge weight corresponding to the node feature. The node characteristics can be the above-mentioned nodes to be processed . No. The node feature can be the The edge weights can be The incoming edge node features to be processed correspond to the incoming edge weights to be processed corresponding to the node features to be processed. For arrive Edge The corresponding edge weight matrix. The edge weight matrix can be a weight matrix generated by the above-mentioned dialogue graph generation model, which is not limited here. It is the feature of the incoming node to be processed.
[0073] Then, based on the above-mentioned outgoing edge weights to be processed and the above-mentioned node features to be processed, the outgoing node features to be processed are generated. Among them, the above-mentioned outgoing node features to be processed can be feature vectors used to characterize the outgoing edges of the above-mentioned node features to be processed. In practice, first, the above-mentioned execution subject can determine the node features corresponding to the above-mentioned outgoing edge weights to be processed as the outgoing node features. Then, the above-mentioned execution subject can input the above-mentioned outgoing edge node features to be processed, the above-mentioned outgoing edge weights to be processed and the above-mentioned node features to be processed into the above-mentioned second preset formula to obtain the outgoing node features to be processed. Among them, the above-mentioned second preset formula can be . Corresponding to the above-mentioned nodes to be processed The set of features of each outgoing edge node to be processed. For the The layer dialog diagram structure information of the layer Outgoing edge node features to be processed. For the The layer dialog structure information of the layer and The edge weight corresponding to the node feature. The node characteristics can be the above-mentioned nodes to be processed . No. The node feature can be the The edge weights can be The outgoing edge node features to be processed correspond to the outgoing edge weights to be processed corresponding to the node features to be processed. For arrive Edge The corresponding edge weight matrix. The edge weight matrix can be a weight matrix generated by the above-mentioned dialogue graph generation model, which is not limited here. It is the node feature to be processed.
[0074] Finally, the above-mentioned input node features to be processed and the above-mentioned output node features to be processed are combined and processed to obtain the initial node features. Among them, the above-mentioned initial node features can be feature vectors used to characterize the above-mentioned node features to be processed. In practice, the above-mentioned execution subject can input the above-mentioned input node features to be processed and the above-mentioned output node features to be processed into a third preset formula to obtain the initial node features. Among them, the above-mentioned third preset formula can be . For the The layer dialog diagram structure information of the layer The initial node feature corresponding to the node feature. Layer The next layer. It is the feature of the incoming node to be processed. It is the node feature to be processed.
[0075] In the second sub-step, the dialog graph structure information includes the dialog graph structure information of each layer that meets the preset layer condition, and determines the dialog graph structure information of each layer as the dialog structure information of each target layer. The preset layer condition may be the dialog graph structure information of each layer except the first layer.
[0076] The third sub-step is to execute the following loop steps for each target-layer dialogue graph structure information in each target-layer dialogue structure information based on the obtained initial node features:
[0077] Sub-step 1: determining each node feature included in the target layer dialog graph structure information as each target node feature.
[0078] Sub-step 2: for each target node feature in the above target node features, perform the following steps:
[0079] First, the initial node feature corresponding to the target node feature among the initial node features is determined as the target initial node feature.
[0080] Secondly, based on the target node characteristics, the weights of each edge in the target layer dialogue structure information that meets the preset edge conditions are determined as the input edge weights. The method for determining the input edge weights can refer to the method for determining the input edge weights to be processed.
[0081] Then, based on the target node characteristics, the weights of each connection edge in the target layer dialogue structure information that meets the preset outbound edge condition are determined as outbound edge weights. The determination method of each outbound edge weight can refer to the determination method of each outbound edge weight to be processed.
[0082] Then, based on the above-mentioned inbound edge weights and the above-mentioned target initial node features, inbound node features are generated. The generation method of the above-mentioned inbound node features can refer to the generation method of the above-mentioned inbound node features to be processed.
[0083] Secondly, based on the outgoing edge weights and the target initial node features, outgoing node features are generated. The generation method of the outgoing node features can refer to the generation method of the outgoing node features to be processed.
[0084] Finally, the above-mentioned inbound node features and the above-mentioned outbound node features are combined and processed to obtain the initial sentence sentiment feature information. The method for obtaining the above-mentioned initial sentence sentiment feature information can refer to the method for obtaining the above-mentioned initial node features.
[0085] Sub-step three, in response to determining that the target layer dialogue graph structure information does not meet the preset loop layer condition, the obtained initial sentence emotional feature information is determined as each initial node feature to update the initial node feature, and the above loop step is performed again using the updated initial node features. Among them, the above preset layer loop condition can be that the number of loops of the above loop step is less than the preset loop threshold. The above preset loop threshold can be a pre-set value, which is not limited here.
[0086] Sub-step four: in response to determining that the target layer dialogue graph structure information satisfies the above-mentioned preset loop layer condition, the obtained emotion feature information of each initial sentence is determined as the emotion feature information of each sentence.
[0087] The fourth sub-step is to determine the determined emotion feature information of each sentence as a sentence emotion feature information set.
[0088] The above technical solution and its related contents, as an inventive point of the embodiments of the present disclosure, solve the problem that "if the structural information of each dialogue graph generated by the dialogue graph generation model is directly used as the emotional feature information set of each sentence, the quality of the emotional feature information set of each sentence generated is poor due to the presence of irrelevant information in the structural information of each dialogue graph, resulting in low accuracy and consistency of text sentence emotion recognition". The factors that lead to low accuracy and consistency of text sentence emotion recognition are often as follows: if the structural information of each dialogue graph generated by the dialogue graph generation model is directly used as the emotional feature information set of each sentence, the quality of the emotional feature information set of each sentence generated is poor due to the presence of irrelevant information in the structural information of each dialogue graph. If the above factors are solved, the accuracy and consistency of text sentence emotion recognition can be improved. In order to achieve this effect, the present disclosure firstly performs the following steps for each dialogue graph structural information in the above dialogue graph structural information: for the first layer dialogue graph structural information in the above dialogue graph structural information, the following steps are performed: each node feature included in the above layer dialogue graph structural information is determined as each node feature to be processed. Then, for each of the above-mentioned node features to be processed, the following steps are performed: Based on the above-mentioned node features to be processed, the weights of each connection edge in the above-mentioned layer dialogue graph structure information that meets the preset edge condition are determined as each incoming edge weight to be processed. Then, based on the above-mentioned node features to be processed, the weights of each connection edge in the above-mentioned layer dialogue graph structure information that meets the preset outgoing edge condition are determined as each outgoing edge weight to be processed. Secondly, based on the above-mentioned incoming edge weights to be processed and the above-mentioned node features to be processed, the incoming node features to be processed are generated. Then, based on the above-mentioned outgoing edge weights to be processed and the above-mentioned node features to be processed, the outgoing node features to be processed are generated. Then, the incoming node features to be processed and the outgoing node features to be processed are combined and processed to obtain the initial node features. Thus, the initial node features obtained by the first layer dialogue graph structure information can be obtained. Secondly, the dialogue graph structure information including the dialogue graph structure information of each layer that meets the preset layer condition is determined as each target layer dialogue structure information. Thus, each target layer dialogue structure information that needs to be processed can be obtained. Then, based on the obtained initial node features, for each target layer conversation graph structure information in the target layer conversation structure information, the following loop steps are performed: each node feature included in the target layer conversation graph structure information is determined as each target node feature. Then, for each target node feature in the target node features, the following steps are performed: the initial node feature corresponding to the target node feature in each initial node feature is determined as the target initial node feature. Secondly, based on the target node feature, each edge weight in the target layer conversation structure information that meets the preset edge condition is determined as each edge weight.Then, based on the target node feature, the weights of each edge in the target layer dialogue structure information that meets the preset outgoing edge condition are determined as each outgoing edge weight. Then, based on the weights of each ingoing edge and the target initial node feature, an ingoing node feature is generated. Secondly, based on the weights of each outgoing edge and the target initial node feature, an outgoing node feature is generated. Then, the ingoing node feature and the outgoing node feature are combined and processed to obtain the initial sentence sentiment feature information. Thus, the initial sentence sentiment feature information corresponding to the target node feature can be obtained. Then, in response to determining that the target layer dialogue graph structure information does not meet the preset loop layer condition, the obtained initial sentence sentiment feature information is determined as each initial node feature to update the initial node feature, and the updated initial node feature is used to perform the above loop step again. Thus, the loop step can be performed on each target layer dialogue structure information to obtain each initial sentence sentiment feature information corresponding to each target layer dialogue structure information. Secondly, in response to determining that the target layer dialogue graph structure information meets the preset loop layer condition, the obtained initial sentence sentiment feature information is determined as each sentence sentiment feature information. Thus, the emotion feature information of each sentence corresponding to the last target layer dialogue graph structure information can be obtained. Finally, the determined emotion feature information of each sentence is determined as a sentence emotion feature information set. Thus, the emotion feature information set of each sentence can be obtained. Also, because the obtained initial sentence emotion feature information is determined as each initial node feature through a loop step to update the initial node feature, the above loop step is performed again using the updated initial node features. Therefore, irrelevant information in each target layer dialogue graph structure information can be filtered out. Thus, the key context information is retained, so that the quality of each sentence emotion feature information set generated by the dialogue graph generation model is improved, thereby improving the accuracy and consistency of text sentence emotion recognition.
[0089] Step 107: Generate sentiment categories for each text sentence based on the sentiment feature information sets for each sentence.
[0090] In some embodiments, the execution subject may generate each text sentence emotion category based on the emotion feature information sets of each sentence. Each of the text sentence emotion categories may be an emotion label for characterizing the emotion feature information of the sentence. In practice, the execution subject may input each of the emotion feature information sets of each sentence into a pre-trained classification model to obtain each text sentence emotion category corresponding to each sentence emotion feature information. The classification model may be a pre-trained fully connected neural network with an activation function, which takes each sentence emotion feature information set as input and each text sentence emotion category corresponding to each sentence emotion feature information as output. The training process of the classification model may use the fourth preset formula as a loss function for constraints. The fourth preset formula may be . is the constraint of the loss function. It is the total number of each sentence emotion feature information included in each sentence emotion feature information set. For the The sentiment label corresponding to the sentiment feature information of each sentence. For the The text sentence sentiment category corresponding to the sentiment feature information of each sentence. is a pre-set value and is not limited here. It can be 0.00001. is the set of all trainable parameters. For example, the above enhanced weight matrix And the above edge weight matrix . The default is a logarithmic function with base e (natural logarithm). is the L2 norm (i.e., the square root of the sum of the squares of the parameters). For all trainable parameters The L2 norm of .
[0091] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the text sentence emotion recognition method of some embodiments of the present disclosure, the accuracy and consistency of text sentence emotion recognition are improved. Specifically, the reason for the low accuracy and consistency of text sentence emotion recognition is that the context information and the relationship between the speakers in the dialogue are modeled by a recursive neural network or a graph neural network, but the global theme or emotional tone of the dialogue is not explicitly modeled, and there is a lack of an overall description of the emotional dynamics of the entire dialogue, resulting in low accuracy and consistency of text sentence emotion recognition. Based on this, the text sentence emotion recognition method of some embodiments of the present disclosure first performs data preprocessing on the pre-stored dialogue text data to obtain each dialogue text information. Thus, the dialogue text data that needs to be subjected to text sentence emotion recognition can be preprocessed to obtain each dialogue text information with a more regular format. Then, the above-mentioned each dialogue text information is spliced to obtain each preprocessed dialogue text data. Thus, each dialogue text information can be grouped into each continuous dialogue stream to obtain each preprocessed dialogue text data. Then, based on the above-mentioned each preprocessed dialogue text data and the pre-trained emotional tone large model, a dialogue emotional tone description information set is generated. Thus, the conversation emotional tone information of each pre-processed conversation text data can be obtained through the emotional tone large model. Secondly, based on the above-mentioned pre-processed conversation text data, the above-mentioned conversation emotional tone description information set and the pre-trained language feature model, each sentence feature vector set and each global conversation emotional feature vector are generated. Thus, each sentence feature vector set and each global conversation emotional feature vector can be obtained through the language feature model. Then, based on the above-mentioned each global conversation emotional feature vector, the above-mentioned each global conversation emotional feature vector and the above-mentioned each sentence feature vector set, each conversation graph structure information is generated. Thus, each sentence feature vector set and each global conversation emotional feature vector can be fused to obtain each enhanced sentence feature vector, so as to obtain each conversation graph structure information according to the connection between each enhanced sentence feature vector. Secondly, based on the above-mentioned each conversation graph structure information, each sentence emotional feature information set is generated. Thus, the sentence emotional feature information of each sentence can be obtained. Finally, based on the above-mentioned each sentence emotional feature information set, each text sentence emotional category is generated. Thus, the text sentence emotional category corresponding to each sentence can be obtained. Also, because each enhanced sentence feature vector is obtained by fusing each sentence feature vector set with each global conversation emotion feature vector, the trained model for text sentence emotion recognition includes the emotion dynamics on a global scale, thereby improving the accuracy and consistency of text sentence emotion recognition.
[0092] Further references Figure 7As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a text sentence emotion recognition device. These device embodiments are similar to Figure 1 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.
[0093] like Figure 7 As shown, some embodiments of the text sentence emotion recognition device 700 include: a preprocessing unit 701, a splicing processing unit 702, a first generating unit 703, a second generating unit 704, a third generating unit 705, a fourth generating unit 706 and a fifth generating unit 707. The preprocessing unit 701 is configured to perform data preprocessing on the pre-stored dialogue text data to obtain various dialogue text information, wherein each dialogue text information in the above dialogue text information includes a dialogue number, a dialogue person, a dialogue sentence number, content information and an emotion label; the splicing processing unit 702 is configured to splice the above dialogue text information to obtain various pre-processed dialogue text data; the first generating unit 703 is configured to generate a dialogue emotion tone description information set based on the above pre-processed dialogue text data and the pre-trained emotion tone large model; the second generating unit 704 is configured to generate a dialogue emotion tone description information set based on the above The pre-processed dialogue text data, the dialogue emotion tone description information set and the pre-trained language feature model are used to generate the sentence feature vector sets and the global dialogue emotion feature vectors; the third generation unit 705 is configured to generate the dialogue graph structure information based on the global dialogue emotion feature vectors, the global dialogue emotion feature vectors and the sentence feature vector sets; the fourth generation unit 706 is configured to generate the sentence emotion feature information set based on the dialogue graph structure information; the fifth generation unit 707 is configured to generate the text sentence emotion category based on the sentence emotion feature information set.
[0094] It is understood that the units described in the device 700 are similar to those described in the reference Figure 1 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 700 and the units included therein, and will not be described in detail here.
[0095] Reference below Figure 8 , which shows a structural schematic diagram of an electronic device 800 suitable for implementing some embodiments of the present disclosure. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0096] like Figure 8As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0097] Typically, the following devices may be connected to the I / O interface 805: an input device 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 808 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 8 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0098] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0099] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0100] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0101] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: performs data preprocessing on the pre-stored dialogue text data to obtain each dialogue text information; performs splicing processing on each dialogue text information to obtain each pre-processed dialogue text data; generates a dialogue emotional tone description information set based on each pre-processed dialogue text data and a pre-trained emotional tone large model; generates each sentence feature vector set and each global dialogue emotional feature vector based on each pre-processed dialogue text data, the dialogue emotional tone description information set and a pre-trained language model; generates each dialogue graph structure information based on each global dialogue emotional feature vector, each global dialogue emotional feature vector and each sentence feature vector set; generates each sentence emotional feature information set based on each dialogue graph structure information; generates each text sentence emotional category based on each sentence emotional feature information set.
[0102] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0103] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0104] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a preprocessing unit, a splicing processing unit, a first generating unit, a second generating unit, a third generating unit, a fourth generating unit and a fifth generating unit. The names of these units do not constitute limitations on the units themselves in some cases, for example, the preprocessing unit may also be described as "a unit that performs data preprocessing on pre-stored conversation text data to obtain each conversation text information".
[0105] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0106] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure.
Claims
1. A text sentence emotion recognition method, comprising: Performing data preprocessing on pre-stored conversation text data to obtain each conversation text information; The various dialogue text information are spliced together to obtain various pre-processed dialogue text data; Generate a dialogue emotional tone description information set based on the pre-processed dialogue text data and the pre-trained emotional tone large model; Based on the respective pre-processed dialogue text data, the dialogue emotional tone description information set and the pre-trained language feature model, generating respective sentence feature vector sets and respective global dialogue emotional feature vectors; Generate each dialogue graph structure information based on each global dialogue emotion feature vector, each global dialogue emotion feature vector and each sentence feature vector set; Based on the structural information of each dialogue graph, generating a set of emotional feature information of each sentence; Based on the emotion feature information sets of each sentence, the emotion category of each text sentence is generated.
2. The method according to claim 1, wherein: The generating of a dialogue emotional tone description information set based on the respective pre-processed dialogue text data and the pre-trained emotional tone large model comprises: Performing configuration processing on the emotional tone large model based on a preset model configuration method to obtain a processed emotional tone large model; For each of the pre-processed dialogue text data, the following steps are performed: Determining a pre-stored prompt template corresponding to the pre-processed dialogue text data as a target prompt template; Inputting the target prompt template and the pre-processed dialogue text data into the processed emotional tone large model to obtain dialogue emotional tone description information; The obtained individual dialogue emotion description information is determined as a dialogue emotion description information set.
3. The method according to claim 1, wherein: The generating of each sentence feature vector set and each global dialogue emotion feature vector based on each pre-processed dialogue text data, the dialogue emotion tone description information set and the pre-trained language feature model comprises: For each of the pre-processed dialogue text data, the following steps are performed: Determining the conversation emotion tone description information corresponding to the pre-processed conversation text data in the conversation emotion tone description information set as target emotion tone description information; Inputting the target emotional tone description information into the language feature model to obtain a global dialogue emotional feature vector; For each of the dialogue text information included in the pre-processed dialogue text data, the dialogue text information is input into the language feature model to obtain a sentence feature vector; The obtained sentence feature vectors are determined as a sentence feature vector set.
4. The method according to claim 1, wherein: The generating each dialogue graph structure information based on each global dialogue emotion feature vector, each global dialogue emotion feature vector and each sentence feature vector set includes: For each of the global dialogue emotion feature vectors, the following steps are performed: Determining the sentence feature vector set corresponding to the global dialogue emotion feature vector in each sentence feature vector set as the target sentence feature vector set; For each sentence feature vector in the target sentence feature vector set, inputting the sentence feature vector and the global dialogue emotion feature vector into a pre-trained enhanced sentence feature model to obtain an enhanced sentence feature vector; Based on the obtained enhanced sentence feature vectors, for each of the global dialogue emotion feature vectors, the following steps are performed: Determining each enhanced sentence feature vector corresponding to the global dialogue emotion feature vector among the enhanced sentence feature vectors as each target enhanced sentence feature vector; Encoding the dialogue text information corresponding to each target enhanced sentence feature vector in each target enhanced sentence feature vector to obtain a dialogue person code corresponding to the dialogue text information; Concatenating the obtained codes of the interlocutors and the enhanced sentence feature vectors to obtain initial graph structure nodes; Input each of the initial graph structure nodes into a pre-trained conversation graph generation model to obtain conversation graph structure information, wherein the conversation graph structure information includes conversation graph structure information of each layer, and each layer of conversation graph structure information includes each node feature and each edge weight.
5. A text sentence emotion recognition device, comprising: A preprocessing unit is configured to perform data preprocessing on the pre-stored dialogue text data to obtain each dialogue text information, wherein each dialogue text information in the each dialogue text information includes a dialogue number, a dialogue person, a dialogue sentence number, content information and an emotion tag; A splicing processing unit is configured to splice the respective dialogue text information to obtain respective pre-processed dialogue text data; A first generating unit is configured to generate a dialogue emotional tone description information set based on the respective pre-processed dialogue text data and the pre-trained emotional tone large model; A second generating unit is configured to generate each sentence feature vector set and each global dialogue emotion feature vector based on each pre-processed dialogue text data, the dialogue emotion tone description information set and the pre-trained language feature model; A third generating unit is configured to generate each dialogue graph structure information based on each global dialogue emotion feature vector, each global dialogue emotion feature vector and each sentence feature vector set; A fourth generating unit is configured to generate each sentence emotion feature information set based on each dialogue graph structure information; The fifth generating unit is configured to generate each text sentence emotion category based on the emotion feature information sets of each sentence.
6. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Dialogue emotion analysis method based on heterogeneous bipartite graph
CN111966827A
Dialogue emotion recognition method and related device
CN114020897A