Method, device and medium for data analysis of text emotion expression
By segmenting and classifying the text of telephone communications in the insurance industry, and combining this with a weighted summation of emotion transition parameters, the problem of inaccurate analysis caused by the subjective judgment of insurance customer service representatives is solved, thereby improving the accuracy of emotion scores and the scientific nature of complaint prediction.
Patent Information
- Application Number
- CN202310713889.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-15
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2043-06-15
AI Technical Summary
Insurance customer service representatives make emotional judgments based on subjective experience during telephone communications, leading to inaccurate text sentiment analysis results and affecting the accuracy of customer sentiment scores and the prediction of complaint likelihood.
By segmenting the text to be analyzed into subtexts, classifying them using a trained emotion classification model, combining the emotion category differences between the subtexts and their neighboring subtexts, converting the category differences into emotion transition parameters using a mapping table, and performing weighted summation, the emotion category scores and transition scores are merged to obtain the final emotion score.
It improves the accuracy of text sentiment analysis, enhances the scientific basis for predicting customer emotional states and the likelihood of complaints, and reduces decision-making errors.
Smart Images

Figure CN116662550B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application is suitable for the technical field of data analysis, and particularly relates to a data analysis method, device and equipment for emotional expression in text and a medium. BACKGROUND
[0002] In the insurance industry, insurance customer service and customers solve the insurance problems existing in customers through multiple rounds of telephone communication. After each round of telephone communication, the insurance customer service judges the emotional category of the customer based on the call text, and predicts the emotional score of the customer based on the number of various emotional categories, which represents the possibility of predicting that the customer exists complaint through telephone communication.
[0003] At present, the judgment and scoring of emotions are mainly based on the subjective experience of insurance customer service. Due to the influence of their own emotions and insufficient experience when the insurance customer service and customers communicate by telephone, the emotional analysis result is prone to error, which reduces the accuracy of emotional analysis of customers.
[0004] Therefore, in the technical field of data analysis, how to improve the analysis accuracy of text emotion has become a problem to be solved. SUMMARY
[0005] Therefore, the embodiments of the present application provide a data analysis method, device and equipment for emotional expression in text to solve the problem of low analysis accuracy of text emotion.
[0006] In a first aspect, the embodiments of the present application provide a data analysis method for emotional expression in text, which comprises:
[0007] Obtaining N subtexts of a text to be analyzed, inputting each subtext into a trained emotion classification model for classification, and outputting the emotional category of each subtext, wherein N is an integer greater than 1;
[0008] For any subtext, determining the adjacent subtexts of the subtext according to the corresponding positions of the N subtexts in the text to be analyzed, obtaining the category difference of the subtext according to the emotional category of the subtext and the emotional category of the adjacent subtexts, and mapping the category difference to an emotional transition parameter according to a preset mapping table, wherein the mapping table comprises the mapping relationship between the category difference and the emotional transition parameter;
[0009] Weighted summing the emotional transition parameter of the subtext and the emotional transition score of the adjacent subtexts to obtain the emotional transition score of the subtext, and traversing all subtexts to obtain the emotional transition scores of all subtexts;
[0010] obtaining an emotion category score of each emotion category, calculating a sum of emotion category scores of all emotion categories to obtain a first emotion score, calculating a sum of emotion change scores of all subtexts to obtain a second emotion score, and performing weighted summation on the first emotion score and the second emotion score to obtain an emotion score of the text to be analyzed.
[0011] In a second aspect, an embodiment of the present application provides a data analysis device for emotion expression in a text, the data analysis device comprising:
[0012] an emotion classification module configured to obtain N subtexts of a text to be analyzed, input each subtext into a trained emotion classification model for classification, and output an emotion category of each subtext, wherein N is an integer greater than 1;
[0013] a parameter mapping module configured to, for any subtext, determine adjacent subtexts of the subtext according to positions of the N subtexts in the text to be analyzed respectively, obtain a category difference of the subtext according to an emotion category of the subtext and emotion categories of the adjacent subtexts, and map the category difference to an emotion change parameter according to a preset mapping table, the mapping table comprising a mapping relationship between the category difference and the emotion change parameter;
[0014] an emotion change calculation module configured to perform weighted summation on an emotion change parameter of the subtext and emotion change scores of the adjacent subtexts to obtain an emotion change score of the subtext, and obtain emotion change scores of all subtexts by traversing all subtexts;
[0015] an emotion score calculation module configured to obtain an emotion category score of each emotion category, calculate a sum of emotion category scores of all emotion categories to obtain a first emotion score, calculate a sum of emotion change scores of all subtexts to obtain a second emotion score, and perform weighted summation on the first emotion score and the second emotion score to obtain an emotion score of the text to be analyzed.
[0016] In a third aspect, an embodiment of the present application provides a computer device, the computer device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, the processor implementing the data analysis method of the first aspect when executing the computer program.
[0017] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing a computer program, the computer program being executable by a processor to implement the data analysis method of the first aspect.
[0018] Compared with the prior art, the embodiment of the present application has the beneficial effects that: by obtaining N subtexts of the text to be analyzed, inputting each subtext into the trained emotion classification model for classification, outputting the emotion category of each subtext, for any subtext, determining the adjacent subtexts of the subtext according to the positions of the N subtexts in the text to be analyzed respectively, obtaining the category difference of the subtext according to the emotion category of the subtext and the emotion category of the adjacent subtexts, mapping the category difference into the emotion transition parameter according to the preset mapping table, performing weighted summation on the emotion transition parameter of the subtext and the emotion transition score of the adjacent subtexts, obtaining the emotion transition score of the subtext, traversing all subtexts to obtain the emotion transition scores of all subtexts, obtaining the emotion category score of each emotion category, calculating the sum of the emotion category scores of all emotion categories to obtain a first emotion score, calculating the sum of the emotion transition scores of all subtexts to obtain a second emotion score, performing weighted summation on the first emotion score and the second emotion score to obtain the emotion score of the text to be analyzed, by fusing the emotion category score of the emotion category of the subtext itself and the emotion transition score between the subtexts, the accuracy of the emotion score is improved, and the emotion analysis accuracy of the text to be analyzed is improved. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0020] Figure 1 is an application environment diagram of a data analysis method for emotion expression in a text provided by the first embodiment of the present application;
[0021] Figure 2 is a flow diagram of a data analysis method for emotion expression in a text provided by the first embodiment of the present application;
[0022] Figure 3 is a structural diagram of a data analysis device for emotion expression in a text provided by the second embodiment of the present application;
[0023] Figure 4 is a structural diagram of a computer device provided by the third embodiment of the present application. DETAILED DESCRIPTION
[0024] In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and
[0025] It is to be understood that the terms "including", "comprising", "consisting" and "consisting essentially of", when used in the specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0026] It is also to be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items, and that the term "at least one of' denotes one, or a plurality of, or any combination of the listed items.
[0027] As used in the description of the application and the appended claims, the term "if' can be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon determining" or "in response to determining" or "upon detecting [the described condition or event]" or "in response to detecting [the described condition or event]" depending on the context.
[0028] In addition, the terms "first", "second", "third", etc. as used in the description of embodiments herein and in the claims (if any) that follow, are used only to identify different instances of an element and do not imply a relative importance of the elements so designated.
[0029] Reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" or "in a various embodiment" or "in at least one embodiment" in various places throughout this specification are not necessarily referring to the same embodiment, unless otherwise specified. Furthermore, the terms "comprise", "comprising", "include", "including", "contain", "containing", "have", "having", and the like are used in the sense of "including but not limited to", unless otherwise specified.
[0030] The embodiment of the present application can acquire and process related data based on artificial intelligence technology. The artificial intelligence (AI) is the theory, method, technology and application system of using digital computer or digital computer controlled machine to simulate, extend and expand human intelligence, perceive environment, acquire knowledge and use knowledge to obtain the best results.
[0031] The artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The artificial intelligence software technology mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology and machine learning / deep learning, etc.
[0032] It should be understood that the size of the serial number of each step in the following embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0033] In order to illustrate the technical solutions of the present application, the following will be explained by specific embodiments.
[0034] The data analysis method for emotion expression in text provided by the embodiment of the present application can be applied in the application environment such as Figure 1 , wherein the client and the server communicate. The client includes but is not limited to palmtop computer, desktop computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cloud computer device, personal digital assistant (PDA) and other computer devices. The server can be realized by an independent server or a server cluster composed of multiple servers.
[0035] Referring to Figure 2 , it is a flowchart of the data analysis method for emotion expression in text provided by the embodiment of the present application, and the above data analysis method can be applied to the client in Figure 1 , and the data analysis method can include the following steps:
[0036] Step S201, acquiring N subtexts of the text to be analyzed, inputting each subtext into the trained emotion classification model for classification, and outputting the emotion category of each subtext.
[0037] The text emotion analysis task can be used in financial investment, lending, financial management, insurance, competitor analysis, market development, new product research and development and other fields to identify customer emotions, evaluate the impact of customer emotions, estimate the probability of risk occurrence, propose corresponding risk prevention countermeasures, improve the scientific level of project decision-making, avoid major decision-making mistakes, and play an important guiding role in many fields.
[0038] In the embodiment, the analysis basis of the emotional expression is the text to be analyzed containing customer emotion information. Since the text segmentation is performed according to the connection between the text semantics, the text is cut into several independent subtexts, so that the analysis of the text is reduced to the analysis of the subtext, and the accuracy of the text analysis can be improved.
[0039] Therefore, in the embodiment, in order to improve the accuracy of the text emotion analysis, the text to be analyzed is first segmented into N subtexts by a text segmentation algorithm, N is an integer greater than 1, and each subtext is input into a trained emotion classification model for feature extraction and emotion classification, and the emotion category of each subtext is output as the basis for emotion scoring of the text to be analyzed.
[0040] The emotion category can be set according to actual conditions. For example, in the embodiment, the emotion categories are set as positive, calm and negative emotions. Correspondingly, according to the order of positive, calm and negative emotion categories, the risk occurrence probability corresponding to the subtext gradually increases.
[0041] The embodiment takes the text emotion analysis in the insurance industry as an example. The text emotion analysis task in this scenario is to solve the insurance problems existing in the customer through multiple telephone communications between the insurance customer service and the customer, and to predict the possibility of customer complaints through the telephone communication content. After each telephone communication, the corresponding call audio is first translated into the call text to be analyzed based on automatic speech recognition technology. The call text is composed of multiple dialogue sentences, and the call text can be segmented into N dialogue sentences as call subtexts of the call text. Then, each call subtext is input into a trained emotion classification model for feature extraction and emotion classification, and the emotion category of each call subtext is output to represent the size of the complaint possibility corresponding to each call subtext.
[0042] Optionally, the trained emotion classification model includes a trained encoder and a trained fully connected layer.
[0043] Each subtext is input into the trained emotion classification model for classification, and the emotion category of each subtext is output, including:
[0044] Each subtext is input into the trained encoder for feature extraction to obtain an emotion feature vector of each subtext.
[0045] inputting the emotion feature vector of each subtext into the trained full connection layer for classification, and outputting the emotion category of each subtext.
[0046] The trained emotion classification model is used for feature extraction and emotion classification of the input subtext, and the emotion category of each subtext is predicted.
[0047] Correspondingly, the trained emotion classification model includes a trained encoder and a trained full connection layer, wherein the trained encoder is used for feature extraction of the input subtext to obtain the emotion feature vector of each subtext, and the trained full connection layer is used for emotion classification of the corresponding subtext according to the emotion feature vector, and outputs the emotion category of each subtext to represent the risk occurrence probability of the corresponding subtext.
[0048] In this embodiment, by inputting each subtext into the trained emotion classification model, the emotion feature vector of each subtext is obtained by feature extraction of the input subtext according to the trained encoder, and the emotion category of each subtext is outputted by emotion classification of the corresponding subtext according to the trained full connection layer, so as to represent the risk degree of the corresponding subtext, and the prediction efficiency and accuracy of the emotion category are improved.
[0049] The above steps of obtaining N subtexts of the text to be analyzed, inputting each subtext into the trained emotion classification model for classification, and outputting the emotion category of each subtext, by dividing the text to be analyzed into N independent subtexts, the analysis of the text to be analyzed is reduced to the analysis of the subtexts, and the feature extraction and emotion classification of the subtexts are performed according to the trained emotion classification model, so as to improve the prediction efficiency and accuracy of the emotion category of the subtexts, and further improve the accuracy of the emotion analysis result of the text to be analyzed.
[0050] In step S202, for any subtext, the adjacent subtexts of the subtext are determined according to the corresponding positions of the N subtexts in the text to be analyzed, the category difference of the subtext is obtained according to the emotion category of the subtext and the emotion category of the adjacent subtexts, and the category difference is mapped to the emotion transition parameter according to the preset mapping table, and the mapping table includes the mapping relationship between the category difference and the emotion transition parameter.
[0051] Wherein, the N subtexts of the text to be analyzed are obtained by text segmentation of the text to be analyzed, then for any subtext, the adjacent subtexts adjacent to the position of the subtext and corresponding to the position smaller than the position corresponding to the subtext can be determined according to the position corresponding to each subtext in the text to be analyzed.
[0052] For any subtext, according to the emotion category of the subtext and the emotion category of the adjacent subtext, the category difference between the two emotion categories can be obtained, and different category differences can represent different emotion transition situations in the text to be analyzed. For the same subtext, when the category difference between the subtext and the adjacent subtext is different, the risk level corresponding to the subtext is also different.
[0053] For example, for a subtext with a calm emotion category, when the emotion category of the adjacent subtext is negative, the category difference between the subtext and the adjacent subtext can represent that the emotional state of the text to be analyzed at the subtext is improving, and then the risk level of the text to be analyzed represented by the subtext can be reduced based on the emotion level of the subtext; when the emotion category of the adjacent subtext is positive, the category difference between the subtext and the adjacent subtext can represent that the emotional state of the text to be analyzed at the subtext is deteriorating, and then the risk level of the text to be analyzed represented by the subtext can be increased based on the emotion level of the subtext.
[0054] Therefore, in order to quantify the emotional state of the text to be analyzed at the subtext based on the category difference between the subtext and the adjacent subtext, and to measure the risk level of the text to be analyzed at the subtext according to the emotional state of the text to be analyzed at the subtext, thereby improving the accuracy of the emotion analysis of the text to be analyzed, the embodiment obtains a preset mapping table, which maps the category difference between the subtext and the adjacent subtext to an emotion transition parameter of the subtext as a basis for the emotion score of the subtext. Correspondingly, the mapping table includes the mapping relationship between the category difference and the emotion transition parameter.
[0055] It should be noted that for the first subtext in the text to be analyzed, since there is no adjacent subtext adjacent to the position of the subtext and corresponding to a position smaller than that of the subtext, the embodiment presets a full-zero text as the adjacent subtext of the subtext, and the emotion category of the adjacent subtext is calm, which is used for the calculation of the category difference of the subtext and the mapping of the emotion transition parameter, so as to improve the uniformity in the calculation of the subtext and improve the reliability and accuracy of the emotion analysis of the text to be analyzed.
[0056] The embodiment takes the text emotion analysis in the insurance industry as an example, and for any call subtext, according to the positions of the N call subtexts in the call text, the adjacent call subtexts of the call subtext are determined, the category difference of the call subtext is obtained according to the emotion category of the call subtext and the emotion category of the adjacent call subtext, and the category difference is mapped to the emotion transition parameter according to the preset mapping table.
[0057] Optionally, obtaining the category difference of the subtext according to the emotion category of the subtext and the emotion category of the adjacent subtext comprises:
[0058] The preset emotion level corresponding to each emotion category is obtained, the level difference between the preset emotion level corresponding to the emotion category of the subtext and the preset emotion level corresponding to the emotion category of the adjacent subtext is calculated, and the level difference is determined as the category difference of the subtext.
[0059] In order to determine the specific value of the category difference between the subtext and the adjacent subtext, the embodiment obtains the preset emotion level corresponding to each emotion category, that is, the preset emotion levels of the first level, the second level and the third level corresponding to the positive, the calm and the negative respectively.
[0060] Then the level difference of the preset emotion level corresponding to the emotion category of the subtext minus the preset emotion level corresponding to the emotion category of the adjacent subtext is calculated, and the level difference is determined as the category difference of the subtext.
[0061] Correspondingly, when the preset emotion level of the emotion category of the subtext is greater than the preset emotion level corresponding to the emotion category of the adjacent subtext, it indicates that the emotional state of the text to be analyzed at the subtext is deteriorating, and the corresponding category difference is positive, and the greater the value of the category difference, the higher the degree of emotional state deterioration. When the preset emotion level of the emotion category of the subtext is less than the preset emotion level corresponding to the emotion category of the adjacent subtext, it indicates that the emotional state of the text to be analyzed at the subtext is improving, and the corresponding category difference is negative, and the smaller the value of the category difference, the higher the degree of emotional state improvement. Therefore, the greater the value of the category difference, the higher the risk degree of the text to be analyzed corresponding to the subtext.
[0062] For example, the emotion categories of positive, calm and negative correspond to the preset emotion levels of the first level, the second level and the third level respectively, the level difference of the preset emotion level corresponding to the emotion category of the subtext minus the preset emotion level corresponding to the emotion category of the adjacent subtext is calculated, and after obtaining the category difference of the subtext, the category difference is normalized, and the normalized result is taken as the corresponding emotion transition parameter.
[0063] Then the emotion category of the adjacent subtext is recorded as A, the emotion category of the subtext is recorded as B, the preset emotion level of the emotion category of the adjacent subtext is recorded as a, and the preset emotion level of the emotion category of the subtext is recorded as b. The mapping table including the mapping relationship between the category difference and the emotion transition parameter can be obtained as:
[0064] A-B a-b Category difference Emotional transition parameter Positive - Calm Secondary - Primary 1 0.5 Positive - Negative Tertiary - Primary 2 1 Calm - Positive Primary - Secondary -1 -0.5 Calm - Negative Tertiary - Secondary 1 0.5 Negative - Positive Primary - Tertiary -2 -1 Negative - Calm Secondary - Tertiary -1 -0.5 Positive - Positive Primary - Primary 0 0 Calm - Calm Secondary - Secondary 0 0 Negative - Negative Tertiary - Tertiary 0 0
[0065] Correspondingly, when the emotion categories of the adjacent subtext and the subtext are positive and calm respectively, or calm and negative respectively, the emotion transition parameter of the corresponding subtext is 0.5; when the emotion categories of the adjacent subtext and the subtext are calm and positive respectively, or negative and calm respectively, the emotion transition parameter of the corresponding subtext is -0.5; when the emotion categories of the adjacent subtext and the subtext are positive and negative respectively, the emotion transition parameter of the corresponding subtext is 1; when the emotion categories of the adjacent subtext and the subtext are negative and positive respectively, the emotion transition parameter of the corresponding subtext is -1; when the emotion categories of the adjacent subtext and the subtext are all positive, or all calm, or all negative, the emotion transition parameter of the corresponding subtext is 0.
[0066] The embodiment obtains a preset emotion level corresponding to each emotion category, subtracts the level difference between the preset emotion level corresponding to the emotion category of the subtext and the preset emotion level corresponding to the emotion category of the adjacent subtext, and determines the level difference as the category difference of the subtext, so that the greater the numerical value of the category difference is, the higher the risk degree of the to-be-analyzed text represented by the subtext is. The combination of the category difference and the risk degree improves the emotion analysis accuracy of the to-be-analyzed text.
[0067] Optionally, the adjacent subtext of the subtext is determined according to the positions of the N subtexts in the to-be-analyzed text, including:
[0068] The position numbers of all the subtexts are determined according to the positions of the N subtexts in the to-be-analyzed text.
[0069] A preset value is obtained, the position number of the subtext is subtracted from the preset value, the subtraction result is determined as the adjacent number, and the subtext corresponding to the adjacent number is determined as the adjacent subtext of the subtext.
[0070] For any subtext, the adjacent subtext is the subtext adjacent to the position of the subtext and corresponding to a position smaller than the position corresponding to the subtext. The embodiment quantitatively represents the position corresponding to each subtext to compare the positions corresponding to the subtexts scientifically.
[0071] Specifically, the position numbers of all the subtexts are determined according to the positions of the N subtexts in the to-be-analyzed text, a preset value is obtained, the position number of the subtext is subtracted from the preset value, the subtraction result is determined as the adjacent number, and the subtext corresponding to the adjacent number is determined as the adjacent subtext of the subtext.
[0072] For example, the position numbers of the first, second, …, Nth subtext are 1, 2, …, N respectively, the preset value is set as 1, for the ith subtext, the position number i of the subtext is subtracted by the preset value 1, the subtraction result i-1 is determined as the adjacent number, and the subtext corresponding to the adjacent number i-1 is determined as the adjacent subtext of the subtext.
[0073] The embodiment determines the corresponding positions of each subtext by determining the position numbers of all subtexts, and determines the adjacent subtext of the subtext by determining the subtraction result of the position number of the subtext and the preset value as the adjacent number, thereby improving the reliability of determining the adjacent subtext.
[0074] The above step of determining the adjacent subtext of any subtext according to the corresponding positions of the N subtexts in the text to be analyzed, obtaining the category difference of the subtext according to the emotion category of the subtext and the emotion category of the adjacent subtext, and mapping the category difference to the emotion transition parameter according to the preset mapping table, the mapping table including the mapping relationship between the category difference and the emotion transition parameter, quantizes the emotion state of the text to be analyzed at the subtext by the category difference between the subtext and the adjacent subtext and the preset mapping table, and measures the risk degree of the text to be analyzed at the subtext according to the emotion state of the text to be analyzed at the subtext, thereby improving the emotion analysis accuracy of the text to be analyzed.
[0075] In step S203, the emotion transition parameters of the subtext and the emotion transition scores of the adjacent subtext are weighted and summed to obtain the emotion transition score of the subtext, and all subtexts are traversed to obtain the emotion transition scores of all subtexts.
[0076] In the calculation of the emotion transition score of the subtext, the emotion transition parameters of the subtext and the emotion transition scores of the adjacent subtext are weighted and summed, so that the emotion transition score of the subtext contains the emotion transition information of the subtext and the adjacent subtext. Correspondingly, the emotion transition score of the adjacent subtext contains the emotion transition information of the adjacent subtext and the adjacent subtext of the adjacent subtext. Therefore, all subtexts whose corresponding positions are before the corresponding position of the subtext are regarded as historical subtexts of the subtext, and the emotion transition score of the subtext contains the emotion transition information of the subtext and all historical subtexts.
[0077] Therefore, the embodiment improves the accuracy of the emotion transition score of the subtext by fusing the emotion transition information of the subtext and all subtexts whose corresponding positions are before the corresponding position of the subtext.
[0078] The embodiment takes text emotion analysis in the insurance industry as an example, and performs weighted summation on the emotion transition parameter of the call subtext and the emotion transition score of the adjacent call subtext to obtain the emotion transition score of the call subtext. The emotion transition score of the call subtext contains the emotion transition information of the call subtext and all historical call subtexts. By traversing all call subtexts, the emotion transition scores of all call subtexts can be obtained.
[0079] Optionally, the emotion transition parameter of the subtext and the emotion transition score of the adjacent subtext are weighted and summed to obtain the emotion transition score of the subtext, including:
[0080] obtaining a preset first emotion transition score weight and a second emotion transition score weight;
[0081] calculating the product of the emotion transition parameter of the subtext and the first emotion transition score weight, adding the product of the emotion transition score of the adjacent subtext and the second emotion transition score weight, and obtaining the emotion transition score of the subtext.
[0082] The greater the gap between the corresponding position of the historical subtext and the corresponding position of the subtext, the smaller the influence of the emotion transition information of the historical subtext on the emotion transition score of the subtext.
[0083] Therefore, the embodiment presets the first emotion transition score weight and the second emotion transition score weight, takes the first emotion transition score weight as the weight of the emotion transition parameter of the subtext, and takes the second emotion transition score weight as the weight of the emotion transition score of the adjacent subtext.
[0084] Therefore, the embodiment presets the first emotion transition score weight and the second emotion transition score weight, takes the first emotion transition score weight as the weight of the emotion transition parameter of the subtext, and takes the second emotion transition score weight as the weight of the emotion transition score of the adjacent subtext.
[0085] The embodiment maps the gap between the corresponding positions and the influence degree of the historical subtext on the emotion transition score of the subtext, and presets the first emotion transition score weight and the second emotion transition score weight for the weighted summation calculation of the emotion transition parameter of the subtext and the emotion transition score of the adjacent subtext, thereby improving the calculation accuracy of the emotion transition score of the subtext.
[0086] The step of performing weighted summation on the emotion transition parameter of the subtext and the emotion transition score of the adjacent subtext to obtain the emotion transition score of the subtext, and traversing all subtexts to obtain the emotion transition scores of all subtexts, makes the emotion transition score of the subtext integrate emotion transition information of the subtext and all subtexts before the corresponding position of the subtext, and improves the accuracy of the emotion transition score of the subtext.
[0087] In step S204, the emotion category score of each emotion category is obtained, the sum of the emotion category scores of all emotion categories is calculated to obtain a first emotion score, the sum of the emotion transition scores of all subtexts is calculated to obtain a second emotion score, and weighted summation is performed on the first emotion score and the second emotion score to obtain the emotion score of the text to be analyzed.
[0088] The emotion category score of each emotion category can be used to represent the risk degree of each emotion category, and the emotion transition score of each subtext can be used to represent emotion transition information of the subtext and all subtexts before the corresponding position of the subtext. Correspondingly, the greater the emotion category score and the emotion transition score, the higher the corresponding risk degree.
[0089] After obtaining the emotion category score of each emotion category, the embodiment first calculates the sum of the emotion category scores of all emotion categories to obtain a first emotion score, then calculates the sum of the emotion transition scores of all subtexts to obtain a second emotion score, and further performs weighted summation on the first emotion score and the second emotion score, for example, obtains preset first emotion score weight and second emotion score weight, calculates the product of the first emotion score and the first emotion score weight, and adds the product of the second emotion score and the second emotion score weight to obtain the emotion score of the text to be analyzed, which is used to represent the risk degree of the subtext to be analyzed. By integrating the emotion category score of the emotion category of the subtext itself and the emotion transition score between subtexts, the accuracy of the emotion score is improved.
[0090] The embodiment takes text emotion analysis in the insurance industry as an example. The emotion category score of each emotion category can be used to represent the complaint probability of the corresponding customer of the call text. The emotion transition score of each call subtext can be used to represent the emotion transition information of the call subtext and all call subtexts before the corresponding position of the call subtext. Correspondingly, the greater the emotion category score and the emotion transition score are, the higher the complaint probability of the corresponding customer of the call text is. Then, the emotion category score of each emotion category is obtained, the sum of the emotion category scores of all emotion categories is calculated to obtain a first emotion score, the sum of the emotion transition scores of all call subtexts is calculated to obtain a second emotion score, and the first emotion score and the second emotion score are weighted and summed to obtain an emotion score of the call text, which is used to represent the complaint probability of the corresponding customer of the call text. The emotion score is used to guide the insurance personnel to propose corresponding risk prevention countermeasures, improve the scientific level of project decision-making, and avoid major decision-making mistakes.
[0091] Optionally, obtaining the emotion category score of each emotion category comprises:
[0092] determining the number of subtexts of each emotion category according to the emotion categories of all subtexts;
[0093] obtaining a preset emotion category score weight of each emotion category, and determining the product of the number of subtexts of each emotion category and the preset emotion category score weight of the corresponding emotion category as the emotion category score of each emotion category.
[0094] wherein each emotion category represents a different corresponding risk level, and the corresponding risk level gradually increases according to the order of positive, calm and negative emotion categories.
[0095] The embodiment obtains a preset emotion category score weight of each emotion category before calculating the emotion category score of each emotion category. The preset emotion category score weight gradually increases according to the order of positive, calm and negative emotion categories, so as to correspond to the risk level corresponding to each emotion category.
[0096] After emotion classification of the N subtexts is performed to obtain the emotion category of each subtext, the number of subtexts of each emotion category is determined. Then, the product of the number of subtexts of each emotion category and the preset emotion category score weight of the corresponding emotion category can be determined as the emotion category score of each emotion category.
[0097] The embodiment obtains a preset emotion category score weight of each emotion category to correspond to the risk level corresponding to each emotion category, and calculates the emotion category score of each emotion category in combination with the number of subtexts of each emotion category, thereby improving the calculation accuracy of the emotion category score.
[0098] The step of obtaining the emotion category score of each emotion category, calculating the sum of the emotion category scores of all emotion categories to obtain a first emotion score, calculating the sum of the emotion change scores of all subtexts to obtain a second emotion score, and performing weighted summation on the first emotion score and the second emotion score to obtain the emotion score of the text to be analyzed, fuses the emotion category score of the emotion category of the subtext itself and the emotion change score between the subtexts, and improves the accuracy of the emotion score and the emotion analysis accuracy of the text to be analyzed.
[0099] The embodiment of the present application obtains N subtexts of the text to be analyzed, inputs each subtext into a trained emotion classification model for classification, and outputs the emotion category of each subtext. For any subtext, the adjacent subtexts of the subtext are determined according to the positions of the N subtexts in the text to be analyzed, the category difference of the subtext is obtained according to the emotion category of the subtext and the emotion category of the adjacent subtexts, the category difference is mapped to an emotion change parameter according to a preset mapping table, the emotion change parameter of the subtext and the emotion change score of the adjacent subtexts are weighted and summed to obtain the emotion change score of the subtext, all subtexts are traversed to obtain the emotion change scores of all subtexts, the emotion category score of each emotion category is obtained, the sum of the emotion category scores of all emotion categories is calculated to obtain a first emotion score, the sum of the emotion change scores of all subtexts is calculated to obtain a second emotion score, and the first emotion score and the second emotion score are weighted and summed to obtain the emotion score of the text to be analyzed. By fusing the emotion category score of the emotion category of the subtext itself and the emotion change score between the subtexts, the accuracy of the emotion score is improved, and the emotion analysis accuracy of the text to be analyzed is improved.
[0100] The data analysis method corresponding to the above embodiment, Figure 3 The structural block diagram of the data analysis device for emotion expression in a text provided by the second embodiment of the present application is given. For ease of illustration, only the parts related to the embodiments of the present application are shown.
[0101] Referring to Figure 3 The data analysis device comprises:
[0102] The emotion classification module 31 is configured to obtain N subtexts of the text to be analyzed, input each subtext into a trained emotion classification model for classification, and output the emotion category of each subtext, wherein N is an integer greater than 1.
[0103] The parameter mapping module 32 is configured to determine, for any subtext, adjacent subtexts of the subtext according to positions of the N subtexts in the text to be analyzed respectively, determine a category difference of the subtext according to an emotion category of the subtext and emotion categories of the adjacent subtexts, and map the category difference to an emotion transition parameter according to a preset mapping table, the mapping table comprising a mapping relationship between the category difference and the emotion transition parameter.
[0104] The emotion transition calculation module 33 is configured to perform weighted summation on the emotion transition parameter of the subtext and emotion transition scores of the adjacent subtexts to obtain an emotion transition score of the subtext, and obtain emotion transition scores of all subtexts by traversing all subtexts.
[0105] The emotion score calculation module 34 is configured to obtain an emotion category score of each emotion category, calculate a sum of emotion category scores of all emotion categories to obtain a first emotion score, calculate a sum of emotion transition scores of all subtexts to obtain a second emotion score, and perform weighted summation on the first emotion score and the second emotion score to obtain an emotion score of the text to be analyzed.
[0106] Optionally, the trained emotion classification model comprises a trained encoder and a trained fully connected layer, and the emotion classification module 31 comprises:
[0107] The feature extraction submodule is configured to input each subtext into the trained encoder to perform feature extraction to obtain an emotion feature vector of each subtext.
[0108] The emotion classification submodule is configured to input the emotion feature vector of each subtext into the trained fully connected layer to perform classification to output an emotion category of each subtext.
[0109] Optionally, the emotion transition mapping module 32 comprises:
[0110] The position number determination submodule is configured to determine position numbers of all subtexts according to positions of the N subtexts in the text to be analyzed respectively.
[0111] The adjacent subtext determination submodule is configured to obtain a preset value, subtract the position number of the subtext from the preset value to determine an adjacent number, and determine the subtext corresponding to the adjacent number as the adjacent subtext of the subtext.
[0112] Optionally, the emotion transition mapping module 32 comprises:
[0113] The category difference determination submodule is configured to obtain a preset emotion level corresponding to each emotion category, calculate a level difference between the preset emotion level corresponding to the emotion category of the subtext and the preset emotion level corresponding to the emotion category of the adjacent subtext, and determine the level difference as the category difference of the subtext.
[0114] Optionally, the mood shift score module 33 comprises:
[0115] a mood shift score weight obtaining sub-module, configured to obtain a preset first mood shift score weight and a second mood shift score weight;
[0116] a mood shift score calculating sub-module, configured to calculate a product of the mood shift parameter of the subtext and the first mood shift score weight, and add a product of the mood shift score of the adjacent subtext and the second mood shift score weight, to obtain the mood shift score of the subtext.
[0117] Optionally, the mood score calculating module 34 comprises:
[0118] a subtext quantity counting sub-module, configured to determine the quantity of subtexts of each mood category according to the mood categories of all subtexts;
[0119] a mood category score calculating sub-module, configured to obtain a preset mood category score weight of each mood category, and determine the mood category score of each mood category as a product of the quantity of subtexts of each mood category and the preset mood category score weight of the corresponding mood category.
[0120] Optionally, the mood score calculating module 34 comprises:
[0121] a mood score weight obtaining sub-module, configured to obtain a preset first mood score weight and a second mood score weight;
[0122] a mood score calculating sub-module, configured to calculate a product of the first mood score and the first mood score weight, and add a product of the second mood score and the second mood score weight, to obtain the mood score of the text to be analyzed.
[0123] It should be noted that the information interaction between the above modules, the execution process and the like, since based on the same concept as the method embodiments of the present application, the specific functions and the technical effects brought by them can be referred to the method embodiments part, and will not be repeated here.
[0124] Figure 4 A structural schematic diagram of a computer device provided for the third embodiment of the present application is shown in FIG. 3. As shown in the figure, the computer device of this embodiment comprises at least one processor (only one is shown in the figure), a memory, and a computer program stored in the memory and executable on the at least one processor, and the processor implements the steps in any of the above data analysis method embodiments when executing the computer program. Figure 4 Figure 4 The computer device can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the computer device can further include other components, which are not shown in the figure.
[0125] The computer device can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the computer device can further include other components, which are not shown in the figure.Figure 4 The computer device is only an example and does not limit the computer device, which can include more or less components than shown, or combine some components, or have different components, such as a network interface, a display screen, an input device, and the like.
[0126] The processor can be a CPU, and can also be other general-purpose processors, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, and the like. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0127] The memory includes a readable storage medium, an internal memory, and the like. The internal memory can be a memory of the computer device, and provides an environment for running the operating system and computer-readable instructions in the readable storage medium. The readable storage medium can be a hard disk of the computer device, and in other embodiments, can also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, and the like. Further, the memory can include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a BootLoader, data, and other programs, such as program codes of computer programs, and the like. The memory can also be used to temporarily store data that has been output or will be output.
[0128] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the unit and module in the above device can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here. If the integrated unit is realized in the form of software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the present application realizes all or part of the processes in the above-mentioned embodiment methods, which can be completed by a computer program to instruct related hardware. The computer program can be stored in a computer readable storage medium, and when the processor executes the computer program, the steps of the above-mentioned method embodiment can be realized. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form, etc. The computer readable medium can at least include any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium cannot be an electrical carrier signal and a telecommunication signal.
[0129] The present application realizes all or part of the processes in the above-mentioned embodiment methods, which can also be completed by a computer program product. When the computer program product runs on the computer device, it makes the computer device execute the steps that can realize the above-mentioned method embodiments.
[0130] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.
[0131] Those skilled in the art can understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0132] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / computer device and method can be implemented in other ways. For example, the embodiments of the apparatus / computer device described above are merely schematic, and the division of the modules or units is merely a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.
[0133] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.
[0134] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit it; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method of data analysis of emotional expression in text, characterized by, The data analysis method comprises: Obtaining N subtexts of the text to be analyzed, inputting each subtext into the trained emotion classification model for classification, and outputting the emotion category of each subtext, wherein N is an integer greater than 1; For any subtext, according to the corresponding positions of the N subtexts in the text to be analyzed, the adjacent subtexts of the subtext are determined, the category difference of the subtext is obtained according to the emotion category of the subtext and the emotion category of the adjacent subtext, and the category difference is mapped to the emotion transition parameter of the subtext according to a preset mapping table, and the mapping table comprises the mapping relationship between the category difference and the emotion transition parameter. The emotion transition parameters of the subtext and the adjacent subtext are weighted and summed to obtain the emotion transition score of the subtext, and the emotion transition scores of all subtexts are obtained by traversing all subtexts. Obtaining the emotion category score of each emotion category, calculating the sum of the emotion category scores of all emotion categories to obtain a first emotion score, calculating the sum of the emotion transition scores of all subtexts to obtain a second emotion score, and performing weighted summation on the first emotion score and the second emotion score to obtain the emotion score of the text to be analyzed.
2. The data analysis method of claim 1, wherein, The trained emotion classification model comprises a trained encoder and a trained fully connected layer. The inputting each subtext into the trained emotion classification model for classification and outputting the emotion category of each subtext comprises: Inputting each subtext into the trained encoder for feature extraction to obtain the emotion feature vector of each subtext; Inputting the emotion feature vector of each subtext into the trained fully connected layer for classification to output the emotion category of each subtext.
3. The data analysis method of claim 1, wherein, The determination of the adjacent subtexts of the subtext according to the corresponding positions of the N subtexts in the text to be analyzed comprises: Determine the position number of all subtexts according to the corresponding positions of the N subtexts in the text to be analyzed; Obtaining a preset value, subtracting the position number of the subtext from the preset value to determine the adjacent number, and determining the subtext corresponding to the adjacent number as the adjacent subtext of the subtext.
4. The data analysis method of claim 1, wherein, The determination of the category difference of the subtext according to the emotion category of the subtext and the emotion category of the adjacent subtext comprises: Obtaining a preset emotion level corresponding to each emotion category, calculating the level difference between the preset emotion level corresponding to the emotion category of the subtext and the preset emotion level corresponding to the emotion category of the adjacent subtext, and determining the level difference as the category difference of the subtext.
5. The data analysis method of claim 1, wherein, The weighted summation of the emotion transition parameter of the subtext and the emotion transition score of the adjacent subtext to obtain the emotion transition score of the subtext comprises: Obtaining a preset first emotion transition score weight and a second emotion transition score weight; Calculating the product of the emotion transition parameter of the subtext and the first emotion transition score weight, adding the product of the emotion transition score of the adjacent subtext and the second emotion transition score weight, and obtaining the emotion transition score of the subtext.
6. The data analysis method of claim 1, wherein, The obtaining of the emotion category score of each emotion category comprises: determining the number of subtexts of each emotion category according to the emotion category of all subtexts; obtaining a preset emotion category score weight of each emotion category, and determining the product of the number of subtexts of each emotion category and the preset emotion category score weight of the corresponding emotion category as the emotion category score of each emotion category.
7. The data analysis method of claim 1, wherein, The weighted sum of the first emotion score and the second emotion score to obtain the emotion score of the text to be analyzed comprises: obtaining a preset first emotion score weight and a second emotion score weight; calculating the product of the first emotion score and the first emotion score weight, adding the product of the second emotion score and the second emotion score weight, and obtaining the emotion score of the text to be analyzed.
8. A data analysis apparatus for sentiment expression in text, characterized by, The data analysis device comprises: an emotion classification module configured to obtain N subtexts of a text to be analyzed, input each subtext into a trained emotion classification model for classification, and output the emotion category of each subtext, wherein N is an integer greater than 1; a parameter mapping module configured to, for any subtext, determine the adjacent subtexts of the subtext according to the positions of the N subtexts in the text to be analyzed respectively, obtain the category difference of the subtext according to the emotion category of the subtext and the emotion categories of the adjacent subtexts, and map the category difference to an emotion transition parameter according to a preset mapping table, wherein the mapping table comprises a mapping relationship between the category difference and the emotion transition parameter; an emotion transition calculation module configured to perform a weighted sum of the emotion transition parameter of the subtext and the emotion transition scores of the adjacent subtexts to obtain the emotion transition score of the subtext, and obtain the emotion transition scores of all subtexts by traversing all subtexts; an emotion score calculation module configured to obtain the emotion category score of each emotion category, calculate the sum of the emotion category scores of all emotion categories to obtain a first emotion score, calculate the sum of the emotion transition scores of all subtexts to obtain a second emotion score, and perform a weighted sum of the first emotion score and the second emotion score to obtain the emotion score of the text to be analyzed.
9. A computer device, comprising: The computer device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the data analysis method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the data analysis method of any one of claims 1 to 7.
Citation Information
Patent Citations
Emotion recognition method and device in interactive dialogue
CN112100337A
Open domain targeted sentiment classification using semisupervised dynamic generation of feature attributes
US20200349229A1