A text sentiment analysis method and device, electronic equipment and storage medium
By performing attribute classification and sentiment analysis on service dialogue text, and using BERT and CNN models to extract features and combine them with multi-label classification, the accuracy problem of text sentiment analysis is solved, enabling accurate identification of user emotions and product optimization.
Patent Information
- Application Number
- CN202310773947.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-06-27
AI Technical Summary
In existing technologies, the complexity of text data syntax and the diversity of attribute expressions lead to a decrease in the accuracy of text sentiment analysis, making it difficult to accurately extract useful information about user satisfaction with customer service quality or products from massive amounts of service information.
By classifying the target service dialogue text by attribute, pre-trained BERT and CNN models are used to extract features, and a multi-label classification model is combined for attribute recognition. Subsequently, attribute sentiment analysis is performed, using a pre-trained BERT model and fully connected layers for word embedding and sentiment analysis. A normalized exponential function is used to process the feature vectors to identify sentiment categories and probability values.
It improves the accuracy of text sentiment analysis, enabling targeted analysis of multi-tag attribute features, optimization of product design, and enhancement of customer service quality.
Smart Images

Figure CN116910249B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and in particular to a text sentiment analysis method and device, an electronic device and a computer readable storage medium. BACKGROUND
[0002] With the development of Internet technology and the increasing maturity of artificial intelligence technology, more and more companies tend to collect user feedback service information, such as text information about the quality of service or satisfaction of users to customer service, to improve customer experience or product design. Then, a major challenge is how to extract useful information from a large amount of service information, and sentiment analysis is a key means to solve this problem. Sentiment analysis can identify useful value information from service information, and in particular, attribute-level fine-grained sentiment analysis has received widespread attention.
[0003] In related technologies, a large amount of text data of dialogues can be obtained by converting service information in a service system (such as a 10000 customer service system) through automatic speech recognition technology (ASR, Automatic Speech Recognition). However, due to the complexity of the syntax structure of the text data and the diversity of attribute expression, the text sentiment analysis is not accurate.
[0004] Therefore, how to accurately analyze the quality of service of users to customer service or the satisfaction of users to existing products of an enterprise from these large amounts of text data is a problem to be solved. SUMMARY
[0005] The present application provides a text sentiment analysis method, device, electronic device and computer readable storage medium to at least solve the technical problem of reduced accuracy of text sentiment analysis due to the complexity of the syntax structure of the text data and the diversity of attribute expression in related technologies. The technical solutions of the present application are as follows:
[0006] According to a first aspect of an embodiment of the present application, a text sentiment analysis method is provided, comprising:
[0007] obtaining a target service dialogue text;
[0008] performing attribute classification on the target service dialogue text to obtain a corresponding attribute label category set;
[0009] performing attribute sentiment analysis on the target service dialogue text and the corresponding attribute label category set to obtain a sentiment analysis result of each attribute in the attribute label category set.
[0010] Optionally, the attribute classification of the target service dialogue text obtains a corresponding attribute label category set, including:
[0011] The target service dialogue text is segmented to obtain an ordered set;
[0012] The attribute recognition model is called to classify the ordered set to obtain an attribute label category set of the target service dialogue text.
[0013] Optionally, before the attribute classification of the target service dialogue text, the method further comprises: pre-training the attribute recognition model:
[0014] A first training set is obtained, which includes a plurality of historical service dialogue texts and an attribute label category set corresponding to each historical service dialogue text;
[0015] Language text features and convolution text features in each historical service dialogue text are extracted respectively;
[0016] The language text features and the convolution text features are fused to obtain a fused feature vector;
[0017] The feature vector in each historical service dialogue text is trained by a full connection layer and a multi-label classification model. In the training process, the training result of each historical service dialogue text is compared with the corresponding attribute label category set. According to the difference of the comparison result, a loss value is calculated. Based on the loss value, the parameters of the multi-label classification model are updated through a back propagation mechanism. After multiple iterations, the multi-label classification model converges to obtain a trained multi-label classification model, and the trained multi-label classification model is used as the attribute recognition model.
[0018] Optionally, the language text features and the convolution text features in each historical service dialogue text are extracted respectively, including:
[0019] Each historical service dialogue text is input into a pre-trained language model BERT and a convolution neural network CNN model for feature extraction to obtain extracted language text features and convolution text features.
[0020] Optionally, attribute sentiment analysis is performed on the target service dialogue text and the corresponding attribute label category set to obtain a sentiment analysis result of each attribute in the attribute label category set, including:
[0021] When the attribute label category set is not empty, the attribute label category set and the target service dialogue text are spliced to obtain an attribute label category list.
[0022] perform attribute sentiment analysis on the attribute label category list to obtain a sentiment analysis result of each attribute in the attribute label category set.
[0023] Optionally, the attribute label category set is spliced with the target service dialogue text to obtain an attribute label category list, including:
[0024] performing word segmentation on the attribute label category set to obtain an ordered word set;
[0025] splicing each word in the ordered word set with the ordered set in turn to obtain an attribute label category list.
[0026] Optionally, the attribute sentiment analysis on the attribute label category list to obtain a sentiment analysis result of each attribute in the attribute label category set includes:
[0027] calling an attribute sentiment analysis model to perform attribute sentiment analysis on each attribute label in the attribute label category list in turn to obtain a sentiment category corresponding to each attribute in the attribute label category list and a corresponding probability value.
[0028] Optionally, the method further includes pre-training the attribute sentiment analysis model, including:
[0029] obtaining a second training set, the second training set including a plurality of historical service dialogue texts and attribute labels corresponding to each historical service dialogue text;
[0030] inputting each historical service dialogue text and the corresponding attribute label into a pre-trained language model BERT for training to obtain a word embedding vector;
[0031] inputting the word embedding vector into a full connection layer and a missing layer to obtain a vector score pair;
[0032] processing the vector score using a normalized exponential function to obtain a probability value of each attribute label:
[0033] selecting the maximum probability value as the sentiment category of the attribute label;
[0034] taking the probability value of each attribute label and the corresponding sentiment category as a training result of the attribute sentiment analysis model.
[0035] Optionally, the method further includes:
[0036] obtaining a length of the attribute label category list;
[0037] determining whether the current length reaches the length of the attribute label category list;
[0038] when the length of the attribute label category list is reached, outputting the sentiment categories and the corresponding probability values of all attributes in the target service dialogue text.
[0039] when the length of the attribute label category list is reached, outputting the sentiment categories and the corresponding probability values of all attributes in the target service dialogue text.
[0040] According to a second aspect of the embodiment of the present application, a text sentiment analysis device is provided, comprising:
[0041] a first obtaining module, configured to obtain a target service dialogue text;
[0042] an attribute classification module, configured to perform attribute classification on the target service dialogue text to obtain a corresponding attribute label category set;
[0043] a sentiment analysis module, configured to perform attribute sentiment analysis on the target service dialogue text and the corresponding attribute label category set to obtain a sentiment analysis result of each attribute in the attribute label category set.
[0044] Optionally, the attribute classification module comprises:
[0045] a first tokenization module, configured to perform tokenization on the target service dialogue text to obtain an ordered set;
[0046] a first calling module, configured to call an attribute recognition model to perform attribute classification on the ordered set to obtain an attribute label category set of the target service dialogue text.
[0047] Optionally, the device further comprises:
[0048] a second obtaining module, configured to obtain a first training set, the first training set comprising a plurality of historical service dialogue texts and a corresponding attribute label category set of each historical service dialogue text;
[0049] an extraction module, configured to extract language text features and convolution text features in the each historical service dialogue text, respectively;
[0050] a fusion module, configured to perform feature fusion on the language text features and the convolution text features to obtain a fused feature vector;
[0051] The first training module is configured to train the feature vector in each historical service dialogue text by using a multi-label classification model after passing through a full connection layer, compare the training result of each historical service dialogue text with the corresponding attribute label category set during the training process, calculate a loss value according to the gap of the comparison result, update the parameters of the multi-label classification model based on the loss value through a back propagation mechanism, and obtain a trained multi-label classification model through multiple iterations until the multi-label classification model converges.
[0052] Optionally, the extraction module is specifically configured to input each historical service dialogue text into a pre-trained language model and a convolutional neural network model respectively to extract language text features and convolutional text features.
[0053] Optionally, the sentiment analysis module includes:
[0054] The concatenation module is configured to concatenate the attribute label category set and the target service dialogue text to obtain an attribute label category list when the attribute label category set is non-empty.
[0055] The attribute sentiment analysis module is configured to perform attribute sentiment analysis on the attribute label category list to obtain a sentiment analysis result of each attribute in the attribute label category set.
[0056] Optionally, the concatenation module includes:
[0057] The second tokenization module is configured to tokenize the attribute label category set to obtain an ordered word set when the attribute label category set is non-empty.
[0058] The word concatenation module is configured to concatenate each word in the ordered word set with the ordered set in sequence to obtain an attribute label category list.
[0059] Optionally, the attribute sentiment analysis module is specifically configured to call an attribute sentiment analysis model to perform attribute sentiment analysis on each attribute label in the attribute label category list in sequence to obtain a sentiment category and a corresponding probability value of each attribute in the attribute label category list.
[0060] Optionally, the apparatus further includes pre-training the attribute sentiment analysis model, including:
[0061] The third acquisition module is configured to acquire a second training set, and the second training set includes multiple historical service dialogue texts and attribute labels corresponding to each historical service dialogue text.
[0062] a second training module configured to input each of the historical service dialogue text and the corresponding attribute label into a pre-trained language model BERT for training to obtain a word embedding vector;
[0063] a hierarchical processing module configured to input the word embedding vector into a full connection layer and a dropout layer to obtain a vector score pair;
[0064] a normalization processing module configured to process the vector score by using a normalized exponential function to obtain a probability value of each attribute label;
[0065] a selection module configured to select a maximum probability value as a sentiment category of the attribute label;
[0066] a determination module configured to determine the probability value of each attribute label and the corresponding sentiment category as a training result of the attribute sentiment analysis model.
[0067] Optionally, the apparatus further comprises:
[0068] a second acquisition module configured to acquire a length of the attribute label category list;
[0069] a first judgment module configured to judge whether a current length reaches the length of the attribute label category list;
[0070] the attribute sentiment analysis module is further configured to, when the first judgment module determines that the current length does not reach the length of the attribute label category list, execute the step of sequentially performing attribute sentiment analysis on each attribute label in the attribute label category list by using the attribute sentiment analysis model to obtain a sentiment category corresponding to each attribute in the attribute label category list and a corresponding probability value; or
[0071] an output module configured to, when the first judgment module determines that the current length reaches the length of the attribute label category list, output the sentiment category corresponding to all attributes of the target service dialogue text and the corresponding probability value.
[0072] According to a third aspect of the embodiment of the present application, an electronic device is provided, comprising:
[0073] a processor;
[0074] a memory for storing instructions executable by the processor;
[0075] wherein the processor is configured to execute the instructions to implement the text sentiment analysis method as described above.
[0076] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, which, when instructions in the computer readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the text sentiment analysis method as described above.
[0077] According to a fifth aspect of the embodiments of the present application, a computer program product is provided, which comprises a computer program or instructions, which, when executed by a processor of an electronic device, implements the text sentiment analysis method as described above.
[0078] The technical solutions provided by the embodiments of the present application at least have the following beneficial effects:
[0079] In the embodiments of the present application, the obtained target service dialogue text is classified by attributes to obtain a corresponding attribute label category set; and attribute sentiment analysis is performed on the target service dialogue text and the corresponding attribute label category set to obtain a sentiment analysis result of each attribute in the attribute label category set. That is, the target service dialogue text is classified by attributes in the embodiments of the present application, attribute sentiment analysis is performed on the dialogue text based on the obtained attribute label category set, the related multi-label attribute features can be analyzed in a targeted manner, and the accuracy of text sentiment analysis is improved; and the product can be optimized and the service quality of customer service can be improved.
[0080] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0081] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present application and, together with the specification, serve to explain the principles of the present application, and do not constitute an improper limitation on the present application. In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiment or prior art description will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0082] Figure 1 is a flowchart of a text sentiment analysis method provided by the embodiments of the present application.
[0083] Figure 2 is a training schematic diagram of an attribute recognition model provided by the embodiments of the present application.
[0084] Figure 3 is an application flowchart of a text sentiment analysis method provided by the embodiments of the present application.
[0085] Figure 4 is a block diagram of a text sentiment analysis device provided by an embodiment of the present application.
[0086] Figure 5 is a block diagram of a text attribute classification module provided by an embodiment of the present application.
[0087] Figure 6 is another block diagram of a text sentiment analysis device provided by an embodiment of the present application.
[0088] Figure 7 is a block diagram of a sentiment analysis module provided by an embodiment of the present application.
[0089] Figure 8 is a block diagram of an electronic device provided by an embodiment of the present application.
[0090] Figure 9 is a block diagram of a text sentiment analysis device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0091] In order for those skilled in the art to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings.
[0092] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0093] Figure 1 is a flowchart of a text sentiment analysis method provided by an embodiment of the present application, as shown in Figure 1 the method comprises the following steps:
[0094] Step 101: Obtain target service dialogue text.
[0095] Step 102: Classify the attributes of the target service dialogue text to obtain a corresponding attribute label category set (labels).
[0096] Step 103: Perform attribute sentiment analysis on the target service dialogue text and the corresponding attribute label category set to obtain sentiment analysis results for each attribute in the attribute label category set.
[0097] The text sentiment analysis method described in the application can be applied to terminals, servers, etc., and the terminal implementation device can be a smart phone, a notebook computer, a tablet computer, a desktop computer, a personal digital assistant (PDA, Personal Digital Assistant), a wearable device, etc. The server can be a stand-alone server, a server cluster, or a server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, intermediate services, domain name services, security services, content distribution networks, or big data and artificial intelligence platforms, etc. The application is not limited in this regard.
[0098] The specific implementation steps of the text sentiment analysis method provided by the embodiments of the application will be described in detail below. Figure 1 The specific implementation steps of the text sentiment analysis method provided by the embodiments of the application will be described in detail below.
[0099] In step 101, the target service dialogue text is obtained.
[0100] In this step, the target service dialogue text can be obtained from a local server, or from a cloud server, or from a customer service system (such as a 10000 customer service system, etc.), and the application is not limited in this regard.
[0101] In this step, the target service dialogue text includes the dialogue text between the user and the customer service, and can also be the dialogue text of other services, and the application is not limited in this regard. The service dialogue text can be the service dialogue text to be identified generated within a specified time. For example, the dialogue text between the user and the customer service about how to handle a phone sub-card, or whether to inquire about the price of a group ticket for a scenic spot, etc.
[0102] In step 102, the target service dialogue text is classified by attributes to obtain a corresponding attribute label category set (labels).
[0103] In this embodiment, the input target service dialogue text is represented as input_text, and after attribute classification, the obtained attribute label category set is represented as labels; wherein,
[0104] labels=[L0,L1,L2,...,L n ], n is the number of labels to which input_text belongs, n≤C, C is the total number of attribute labels, and Ln represents the nth attribute label. n
[0105] In this step, the target service dialogue text is classified by attributes in the following manner:
[0106] 1) Tokenize the target service dialogue text to obtain an ordered set X.
[0107] In this step, the tokenizer can be used to parse the code stream of the target service dialogue text into corresponding tokens, thereby obtaining the ordered set X:
[0108] X = tokenize(input_text) = {[CLS], x1, x2,..., xm, [SEP]} m
[0109] Where m is the length of the input target service dialogue text; [CLS] represents the category; and [SEP] is a sentence separator.
[0110] 2) Call the attribute recognition model (MLSC_Model) to classify the attributes of the ordered set to obtain the attribute label category set of the target service dialogue text.
[0111] In this step, the ordered set X is input into the attribute recognition model (MLSC_Model) for attribute classification. After feature extraction, feature fusion, full connection layer, and sigmoid function, the attribute label category list is obtained.
[0112] Optionally, the attribute recognition model is a pre-trained model. Its training process is as follows: a first training set is obtained, the first training set includes a plurality of historical service dialogue texts and an attribute label category set corresponding to each historical service dialogue text; language text features and convolution text features in each historical service dialogue text are extracted respectively; the language text features and the convolution text features are fused to obtain a fused feature vector; the feature vector in each historical service dialogue text is input into a multi-label classification model through a full connection layer; in the training process, the training result of each historical service dialogue text is compared with the corresponding attribute label category set, and a loss value is calculated according to the difference between the comparison results. Based on the loss value, the parameters of the multi-label classification model are updated through a back propagation mechanism. After multiple iterations, the multi-label classification model converges, a trained multi-label classification model is obtained, and the trained multi-label classification model is used as the attribute recognition model.
[0113] The extracting the language text features and the convolution text features in each historical service dialogue text respectively includes: inputting each historical service dialogue text into a pre-trained language model (BERT, Bidirectional Encoder Representation from Transformers) and a convolution neural network (CNN, Convolutional Neural Networks) respectively for feature extraction, to obtain the extracted language text features and the convolution text features, that is, inputting a plurality of historical service dialogue texts in the first training set into a BERT feature extractor and a CNN feature extractor respectively for feature extraction, to obtain a first feature vector F1 and a second feature vector F2, then fusing the first feature vector F1 and the second feature vector F2 to obtain a feature vector Feature, and finally inputting the feature vector Feature into a multi-label classifier for training, so that the trained multi-label classification model is used as an attribute classification model, and the attribute classification model is specifically as shown in Figure 2 FIG. 1 is a schematic diagram of attribute classification model training provided by an embodiment of the present application.
[0114] The embodiment of the present application adopts the feature fusion method to fuse the text features extracted by the BERT feature extractor and the CNN feature extractor, and can accurately and efficiently identify the implicit attributes in the text.
[0115] That is, the attribute recognition model is based on user and customer historical dialogue text data sets, and text features are extracted by using the algorithm principles of the pre-trained language model BERT and the convolution neural network CNN respectively to obtain corresponding feature vectors F1 and F2, the feature vectors F1 and F2 are fused to obtain a feature vector Feature, wherein Feature = concatenate (F1, F2), the feature vector Feature is input into a full connection layer, and the obtained result is input into a multi-label classifier, so as to train a multi-label classification model.
[0116] The loss function of the multi-label classifier is Focal Loss, and the loss function is represented by the following formula:
[0117]
[0118] y i ∈{0,1}, i=1,2,3,...,C;
[0119] The real label of the target service dialogue text input_text is:
[0120] y=[y1,y2,...,y C ]
[0121] The label probability value corresponding to the target service dialogue text input_text is specifically:
[0122] z = [z1, z2,..., z C ]
[0123] r is an adjustable focusing parameter, generally taking a value of 2;
[0124] p i = sigmoid(z i )
[0125] p i ∈ [0, 1] is a probability value of the sample belonging to the i-th category, z i ∈ z.
[0126] In this step, the attribute classification accuracy can be improved by performing attribute classification on the ordered set X through the pre-trained attribute recognition model.
[0127] In step 103, attribute sentiment analysis is performed on the target service dialogue text and the corresponding attribute label category set to obtain the sentiment analysis result of each attribute in the attribute label category set.
[0128] The sentiment analysis result can include the sentiment category and corresponding probability value of each attribute.
[0129] This step specifically includes:
[0130] 1) When the attribute label category set is non-empty, the attribute label category set and the target service dialogue text are spliced to obtain an attribute label category list;
[0131] In this step, it is first determined whether the attribute label category set is empty. When it is determined that the attribute label category set is non-empty, the attribute label category set is tokenized to obtain an ordered word set (ensemble). Each word in the ordered word set is spliced with the ordered set in turn to obtain an attribute label category list. When it is determined that the attribute label category set is empty, i.e., there is no attribute label in the target service dialogue text, the operation is ended.
[0132] That is, in this step, the attribute label category set (labels) is first tokenized to obtain an ordered word set (ensemble): that is, the code of each attribute label in labels is parsed into corresponding tokens using a tokenizer, thereby obtaining an ordered word set (ensemble); the formula is as follows:
[0133] ensemble=tokenize(labels)={t1,t2,...,t n}
[0134] Wherein, t j ={[CLS],l1,l2,...,l q ,[SEP]},q is the length of the list after tokenizing each label, [CLS] represents the category, and [SEP] is a sentence separator.
[0135] Secondly, the ordered word set ensemble is spliced with the ordered set X to obtain an attribute label category list (input_text_list).
[0136] input_text_list={[[CLS],l1,l2,...,l q ,[SEP],x1,x2,...,x m ,[SEP]]}
[0137] 2) performing attribute sentiment analysis on the attribute label category list to obtain a sentiment analysis result of each attribute in the attribute label category set.
[0138] In this step, attribute sentiment analysis is performed on each attribute label in the attribute label category list by calling an attribute sentiment analysis model (ACSA_Model), to obtain a corresponding sentiment category (emotion) and a corresponding probability value (emotion_p[k]) of each attribute label (labels[k]) in the attribute label category list. In this step, the trained attribute sentiment analysis model can be directly called from the data, or the attribute sentiment analysis model can be pre-trained, and the present embodiment does not make any limitation.
[0139] In the present embodiment, the attribute label category set is spliced with the target service dialogue text, and an attribute sentiment analysis model is called, thereby improving the recognition efficiency of the sentiment category and probability corresponding to the attribute.
[0140] Optionally, the attribute sentiment analysis model (ACSA_Model) is pre-trained, and the training process includes: obtaining a second training set, the second training set including a plurality of historical service dialogue texts and attribute labels corresponding to each historical service dialogue text; inputting each historical service dialogue text and the corresponding attribute label into a pre-trained language model BERT for training to obtain a word embedding vector (embedding); inputting the word embedding vector into a full connection layer and a dropout layer to obtain a vector score pair (logits); processing the vector score using a normalization exponential (softmax) function to obtain a probability value of each attribute label; selecting the maximum probability value as the sentiment category of the attribute label; and taking the probability value of each attribute label and the corresponding sentiment category as the training result of the attribute sentiment analysis model.
[0141] That is, the attribute sentiment analysis model ACSA_Model is obtained according to the user and the historical dialogue text data and the corresponding attribute label of the customer service, through the BERT model to obtain the corresponding word embedding vector (embedding), denoted as E2; then input into the full connection layer and the dropout layer to obtain the vector score pair (logits), and the normalization exponential (softmax) function is used to obtain the probability value P of each attribute sentiment:
[0142] P = softmax (logits)
[0143] Finally, the maximum value of P is taken as the sentiment category of the attribute label:
[0144] emotion[k] = argmax (P), emotion[k] ∈ {positive, neutral, negative}
[0145] The probability value of the attribute label is emotion_p[k] = max (P); wherein positive, neutral, and negative represent the probabilities of the target service dialogue text being positive, neutral, and negative in the sentiment category, respectively.
[0146] Finally, the attribute label labels[k] corresponding to input_text_list[k], the sentiment category emotion[k], and the corresponding probability value emotion_p[k] are obtained as the training result of the attribute sentiment analysis model.
[0147] In this embodiment of the invention, the acquired target service dialogue text is classified by attributes to obtain a corresponding set of attribute tag categories. Sentiment analysis is then performed based on the target service dialogue text and the corresponding set of attribute tag categories to obtain the sentiment analysis result for each attribute in the set of attribute tag categories. In other words, this embodiment of the invention can classify complex dialogue text according to attributes. Based on the attribute tag category set obtained from the classification, and combined with the dialogue text, targeted sentiment analysis can be performed on relevant multi-tag attribute features, improving the accuracy of text sentiment analysis; this helps optimize products and improve customer service quality.
[0148] Optionally, in another embodiment, based on the above embodiment, the method may further include: obtaining the length of the attribute tag category list; determining whether the current length has reached the length of the attribute tag category list; if the length of the attribute tag category list has not been reached, executing the step of calling the attribute sentiment analysis model to perform attribute sentiment analysis on each attribute tag in the attribute tag category list in turn, to obtain the sentiment category and corresponding probability value corresponding to each attribute in the attribute tag category list; or, if the length of the attribute tag category list has been reached, outputting the sentiment category and corresponding probability value corresponding to all attributes in the target service dialogue text.
[0149] In this embodiment of the invention, the attributes of multi-label classification of customer service text based on semantic understanding can accurately and efficiently identify implicit attributes in the text, thereby improving the accuracy of sentiment analysis in multi-label classification of service text dialogues.
[0150] Please also see Figure 3 The above is an application flowchart of a text sentiment analysis method provided in an embodiment of the present invention. The method includes:
[0151] Step 301: Input dialogue text; for example, the dialogue text of the target service.
[0152] Step 302: Input the input_text into the attribute recognition model (MLSC_Model) for attribute classification, and obtain the attribute label category set labels of the input_text, where labels = [L0, L1, L2, ..., L... n ], where n is the number of tags to which input_text belongs, n≤C, and C is the total number of attribute tags.
[0153] Wherein, the step firstly tokenizes the input_text to obtain an ordered set X; secondly inputs the ordered set X into the attribute recognition model (MLSC_Model) to obtain an attribute label category list through feature extraction, feature fusion, full connection layer and activation (sigmoid) function; the specific implementation process is described above and will not be repeated here.
[0154] Step 303: Determine whether the attribute label category set (labels) is empty: if the labels are not empty, execute step 304, otherwise, execute step 311.
[0155] Step 304: Combine the dialogue text (input_text) and the attribute label category set (labels) to obtain an attribute label category list (input_text_list), wherein input_text_list = [t0, t1, …, t n ], the specific combination process includes:
[0156] First, tokenize the labels to obtain an ordered word set (ensemble); secondly, splice the ensemble and the ordered set X to obtain the input_text_list; the specific implementation process is described above and will not be repeated here.
[0157] Step 305: Initialize variable k = 0, L1 = length(input_text_list), wherein L1 is the length of the attribute label category list.
[0158] Step 306: Determine whether the initialized variable k is equal to L1, if k is not equal to L1, execute step 307: otherwise, execute step 308.
[0159] Step 307: Input input_text_list[k] into ACSA_Model for text attribute sentiment analysis.
[0160] Step 308: Obtain the sentiment category emotion[k] corresponding to the attribute label labels[k] in the input_text_list[k] and the corresponding probability value emotion_p[k].
[0161] Step 309: Execute k = k + 1 and return to step 306 until k is equal to L1.
[0162] Step 310: Output the sentiment category (emotion) corresponding to all attribute labels (labels) of the input_text and the corresponding probability (emotion_p).
[0163] Step 311: output T, wherein T = "No attribute label is recognized in this sentence".
[0164] The embodiment of the application is based on a trained attribute recognition model and an attribute sentiment analysis model; first, the attribute recognition model is used to classify the obtained service dialogue text to obtain a corresponding attribute category set; when the attribute label category set is not empty, the attribute label category set and the service dialogue text are combined into an attribute label category list; finally, the attribute sentiment analysis model is used to obtain the sentiment category and probability value of each attribute in the attribute label category list. The application can analyze the sentiment of relevant attribute features, and is suitable for user portrait analysis, public opinion analysis and other fields of the customer service system, which helps to optimize products and improve customer service quality.
[0165] In order to explain the embodiment of the application, the following two application examples are described.
[0166] First application example
[0167] In this application example, the target service dialogue text is taken as an example of the dialogue text between the user and the customer service in the 10000 customer service system, as shown in Table 1:
[0168] Table 1
[0169]
[0170] The specific process of the text sentiment analysis method includes:
[0171] S1: input the dialogue text between the user and the customer service (input_text), wherein input_text = "I have a question mark in my wireless network, how to solve it?";
[0172] S2: call the trained attribute recognition model (MLSC_Model) to classify input_text to obtain an attribute label category set labels = ["fault", "network cannot be used"], and the specific classification method is as follows:
[0173] S2.1: Tokenize input_text to obtain an ordered set X:
[0174] X = [[CLS], I, my, home, of, wireless, network, how, always, have, a, feeling, question mark, need, like, how, to, solve,?, [SEP]];
[0175] S2.2. Input X into the MLSC_Model model, and go through feature extraction, feature fusion, full connection layer, and sigmoid function to obtain the attribute label set labels = ["fault", "network cannot be used"];
[0176] S3: Determine whether the attribute label category set (labels) is empty: if labels is not empty, execute step S4, otherwise, execute S11;
[0177] S4: Concatenate input_text and labels to obtain the attribute label category list input_text_list = [[[CLS], fault, [SEP], my, house, of, no, line, network, how, always, have, a, sigh, number,, need, to, how, to, solve,?, [SEP]], [[CLS], network, cannot, be, used, [SEP], my, house, of, no, line, network, how, always, have, a, sigh, number,, need, to, how, to, solve,?, [SEP]]], and the specific concatenation method is as follows:
[0178] S4.1. Tokenize labels to obtain an ordered word set (ensemble):
[0179] ensemble = [[[CLS], fault, [SEP]], [[CLS], network, cannot, be, used, [SEP]]]
[0180] S4.2. Concatenate ensemble with the ordered set X to obtain the attribute label category set input_text_list:
[0181] input_text_list = [[[CLS], fault, [SEP], my, house, of, no, line, network, how, always, have, a, sigh, number,, need, to, how, to, solve,?, [SEP]], [[CLS], network, cannot, be, used, [SEP], my, house, of, no, line, network, how, always, have, a, sigh, number,, need, to, how, to, solve,?, [SEP]]];
[0182] S5. Set the initial variable k = 0, L1 = length(input_text_list): in this embodiment, L1 = 2;
[0183] S6. Determine whether k == L1, 0 < 2, execute S7;
[0184] S7. Call attribute sentiment analysis model ACSA_Model to predict the sentiment category and probability value of attribute label "failure";
[0185] S8. Output the attribute label "failure" of input_text_list[0], the sentiment category emotion="negative", and the corresponding probability value emotion_p=0.7;
[0186] S9. Set k=k+1, k=1, and execute S6;
[0187] S6. Determine whether k==L1, 1<2, and execute S7;
[0188] S7. Call attribute sentiment analysis model ACSA_Model to predict the sentiment category and probability value of attribute label "network cannot be used";
[0189] S8. Output the attribute label "network cannot be used" of input_text_list[1], the sentiment category emotion="negative", and the corresponding probability value emotion_p=0.78;
[0190] S9. Set k=k+1, k=2, and execute S6;
[0191] S6. Determine whether k==L1, 2==2, and execute S10;
[0192] S10. Output the attribute category label, sentiment category, and corresponding probability value of input_text, that is, [{label: "failure", emotion: negative, emotion_p: 0.7}, {label: "network cannot be used", emotion: negative, emotion_p: 0.78}].
[0193] S11. Output that no attribute label is recognized in the sentence.
[0194] Second application embodiment: In this embodiment, the target service dialogue text is still taken as the user and customer service dialogue text in the 10000 customer service system. As shown in Table 2:
[0195] Table 2
[0196]
[0197] The specific process of the text sentiment analysis method includes:
[0198] S1: Input the user and customer service dialogue text input_text="can, can contact me";
[0199] S2: calling the trained attribute recognition model MLSC_Model to perform attribute classification on the input_text, to obtain an attribute label set labels as [], and the specific method is as follows:
[0200] S2.1. Tokenizing the input_text to obtain an ordered set X;
[0201] X = [[CLS], can, can be associated with me, [SEP]];
[0202] S2.2. Inputting the ordered set X into the MLSC_Model model, and obtaining an attribute label list labels = [] through feature extraction, feature fusion, full connection layer and sigmoid function;
[0203] S3: judging whether the attribute label list labels is empty: if the labels is empty, outputting T = "no attribute label is recognized in the sentence"; if the labels is not empty, the specific implementation process is similar to the process of the corresponding part in the first application embodiment, and details are specifically seen in the above, which will not be repeated here.
[0204] In the above application examples, the attribute recognition model and the attribute sentiment analysis model are trained based on the dialogue text between the user and the customer service in the 10000 customer service system and the historical dialogue text data; then the attribute classification of the dialogue text between the user and the customer service is performed through the attribute recognition model, to obtain the corresponding attribute category list, and when it is judged that the attribute category label set is not empty; the attribute category label set and the dialogue text between the user and the customer service are spliced, and finally the sentiment category and probability value of each attribute in the attribute category label set are obtained through the attribute sentiment analysis model. The embodiment of the application can perform sentiment analysis on the relevant attribute features, is suitable for user portrait analysis of the customer service system, and of course, can also be applied to many other fields, which is helpful for optimizing products and improving the quality of customer service.
[0205] It should be noted that, for the method embodiments, in order to simply describe, they are all described as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited to the action sequence described, because according to the present application, certain steps can be performed in other sequences or at the same time. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily necessary for the present application.
[0206] Figure 4 is a text sentiment analysis device block diagram provided by the embodiment of the application. Referring to Figure 4 The device comprises a first acquisition module 401, an attribute classification module 402 and an emotion analysis module 403, wherein,
[0207] The first acquisition module 401 is configured to acquire target service dialogue text.
[0208] The attribute classification module 402 is configured to perform attribute classification on the target service dialogue text to obtain a corresponding attribute label category set.
[0209] The sentiment analysis module 403 is configured to perform attribute sentiment analysis on the target service dialogue text and the corresponding attribute label category set to obtain a sentiment analysis result of each attribute in the attribute label category set.
[0210] Optionally, in another embodiment, the attribute classification module 402 includes a first tokenization module 501 and a first calling module 502 in the above embodiment, and a structural block diagram is as shown in Figure 5
[0211] The first tokenization module 501 is configured to perform tokenization on the target service dialogue text to obtain an ordered set.
[0212] The first calling module 502 is configured to call an attribute recognition model to perform attribute classification on the ordered set to obtain an attribute label category set of the target service dialogue text.
[0213] Optionally, in another embodiment, the device further includes a second acquisition module 601, an extraction module 602, a fusion module 603 and a first training module 604 in the above embodiment, and a structural block diagram is as shown in Figure 6
[0214] The second acquisition module 601 is configured to acquire a first training set before the first calling module 502 calls the attribute recognition model to perform attribute classification on the ordered set, the first training set including a plurality of historical service dialogue texts and an attribute label category set corresponding to each historical service dialogue text.
[0215] The extraction module 602 is configured to extract language text features and convolution text features in the each historical service dialogue text, respectively.
[0216] The fusion module 603 is configured to perform feature fusion on the language text features and the convolution text features to obtain a fused feature vector.
[0217] The first training module 604 is configured to train the feature vector in each historical service dialogue text by using a multi-label classification model after passing through a full connection layer, compare the training result of each historical service dialogue text with the corresponding attribute label category set during the training process, calculate a loss value according to the gap of the comparison result, update the parameters of the multi-label classification model based on the loss value through a back propagation mechanism, and obtain a trained multi-label classification model through multiple iterations until the multi-label classification model converges, and use the trained multi-label classification model as the attribute recognition model.
[0218] Optionally, in another embodiment, the extraction module is specifically configured to input each historical service dialogue text into a pre-trained language model and a convolutional neural network model for feature extraction, and obtain extracted language text features and convolutional text features.
[0219] Optionally, in another embodiment, the sentiment analysis module includes a splicing module 701 and an attribute sentiment analysis module 702, and a structural block diagram is as shown in Figure 7
[0220] The splicing module 701 is configured to splice the attribute label category set and the target service dialogue text to obtain an attribute label category list when the attribute label category set is not empty.
[0221] The attribute sentiment analysis module 702 is configured to perform attribute sentiment analysis on the attribute label category list to obtain a sentiment analysis result of each attribute in the attribute label category set.
[0222] Optionally, in another embodiment, the splicing module includes a second word segmentation module and a word splicing module, and the second word segmentation module is configured to perform word segmentation on the attribute label category set to obtain an ordered word set when the attribute label category set is not empty.
[0223] The second word segmentation module is configured to perform word segmentation on the attribute label category set to obtain an ordered word set when the attribute label category set is not empty.
[0224] The word splicing module is configured to splice each word in the ordered word set with the ordered set in sequence to obtain an attribute label category list.
[0225] Optionally, the attribute sentiment analysis module is specifically configured to call an attribute sentiment analysis model to perform attribute sentiment analysis on each attribute label in the attribute label category list in sequence to obtain a sentiment category and a corresponding probability value of each attribute in the attribute label category list.
[0226] Optionally, in another embodiment, the embodiment is based on the above-mentioned embodiments, the device further comprises: a third acquisition module, a second training module, a hierarchical processing module, a normalization processing module, a selection module and a determination module, wherein,
[0227] The third acquisition module is configured to acquire a second training set before the attribute sentiment analysis module calls an attribute sentiment analysis model to sequentially perform attribute sentiment analysis on each attribute label in the attribute label category list, the second training set comprising a plurality of historical service dialogue texts and attribute labels corresponding to each historical service dialogue text.
[0228] The second training module is configured to input each historical service dialogue text and the corresponding attribute label into a pre-trained language model BERT for training to obtain a word embedding vector.
[0229] The hierarchical processing module is configured to input the word embedding vector into a full connection layer and a missing layer to obtain a vector score pair.
[0230] The normalization processing module is configured to process the vector score using a normalized exponential function to obtain a probability value of each attribute label.
[0231] The selection module is configured to select the maximum probability value as the sentiment category of the attribute label.
[0232] The determination module is configured to take the probability value of each attribute label and the corresponding sentiment category as the training result of the attribute sentiment analysis model.
[0233] Optionally, in another embodiment, the embodiment is based on the above-mentioned embodiments, the device further comprises: a second acquisition module, a first judgment module and an output module, wherein,
[0234] The second acquisition module is configured to acquire the length of the attribute label category list.
[0235] The first judgment module is configured to determine whether the current length reaches the length of the attribute label category list.
[0236] The attribute sentiment analysis module is further configured to, when the first judgment module determines that the length has not reached the length of the attribute label category list, execute the step of calling the attribute sentiment analysis model to sequentially perform attribute sentiment analysis on each attribute label in the attribute label category list to obtain the sentiment category and the corresponding probability value of each attribute in the attribute label category list; or,
[0237] The output module is configured to output all attribute corresponding sentiment categories and corresponding probability values of the target service dialogue text when the first judging module determines that the length of the attribute label category list is reached.
[0238] As to the apparatus in the above-mentioned embodiments, the specific manners in which various modules perform operations have been described in detail in the embodiments of the method, and thus will not be described in detail here.
[0239] The apparatus embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed 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. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment scheme. Those skilled in the art can understand and implement without creative labor.
[0240] Figure 8 is a block diagram of an electronic device 800 provided by an embodiment of the present application. For example, the electronic device 800 can be a mobile terminal or a server, and in the present embodiment, the electronic device is taken as a mobile terminal for illustration. For example, the electronic device 800 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0241] Referring to Figure 8 , the electronic device 800 can include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0242] The processing component 802 usually controls overall operations of the electronic device 800, such as operations associated with displaying, making phone calls, data communications, camera operations and recording operations. The processing component 802 can include one or more processors 820 to execute instructions to complete all or part of steps of the methods described above. In addition, the processing component 802 can include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0243] The memory 804 is configured to store various types of data to support the operation of the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 can be implemented by any type of volatile or nonvolatile memory, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disc, or optical disc.
[0244] The power component 806 supplies power for various components of the electronic device 800. The power component 806 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
[0245] The multimedia component 808 includes a screen providing an output interface between the electronic device 800 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes the touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or a sliding action, but also detect duration and pressure related to the touching or sliding action. In some embodiments, the multimedia component 808 includes a front camera and / or a back camera. The front camera and / or the back camera can receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each of the front camera and the back camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0246] The audio component 810 is configured to output and / or input an audio signal. For example, the audio component 810 includes a microphone (MIC) when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting an audio signal.
[0247] The audio component 810 is configured to output and / or input an audio signal. For example, the audio component 810 includes a microphone (MIC) when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting an audio signal.
[0248] The I / O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which can include a keyboard, a click wheel, buttons, and so on. These buttons can include, but are not limited to, a home button, a volume button, a power button, and a lock button.
[0249] The sensor component 814 includes one or more sensors for providing status assessments for various aspects of the electronic device 800. For example, the sensor component 814 can detect an open / closed position of the device 800, relative positioning of components, such as a display and a keypad of the electronic device 800, a change in position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and a temperature change of the electronic device 800. The sensor component 814 can include an accelerometer, a gyroscope, a magnetometer, a pressure sensor or a temperature sensor. The sensor component 814 can also include proximity sensor configured to detect presence of nearby objects without any physical contact. The sensor component 814 can further include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 814 can also include an
[0250] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a cellular network standard (such as 2G, 3G, 4G or 5G), or a combination thereof. In an example embodiment, the communication component 816 receives broadcast signals or broadcast-related information from external broadcast management systems via a broadcast channel. In an example embodiment, the communication component 816 can further include a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) techniques, infrared data association (IrDA) techniques, ultra-wideband (UWB) techniques, Bluetooth (BT) techniques, and other techniques.
[0251] In embodiments, the electronic device 800 can be implemented with one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, other electronic units, or a combination thereof, for performing the above-described text sentiment analysis method.
[0252] In an embodiment, a computer readable storage medium is also provided, which, when instructions in the computer readable storage medium are executed by a processor of an electronic device, enables the electronic device 800 to perform the text sentiment analysis method shown above. For example, the computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.
[0253] In an embodiment, a computer program product is also provided, which includes a computer program or instructions, when the computer program or instructions are executed by the processor 820 of the electronic device 800, enables the electronic device 800 to perform the text sentiment analysis method shown above.
[0254] Figure 9 is a block diagram of an apparatus 900 for text sentiment analysis provided by an embodiment of the present application. For example, the apparatus 900 can be provided as a server. Referring to Figure 9 , the apparatus 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932, for storing instructions executable by the processing component 922, such as an application program. The application program stored in the memory 932 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute the instructions to perform the method described above.
[0255] The apparatus 900 can also include a power supply component 926 configured to perform power management of the apparatus 900, a wired or wireless network interface 950 configured to connect the apparatus 900 to a network, and an input output (I / O) interface 958. The apparatus 900 can operate based on an operating system stored in the memory 932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.
[0256] The content of the target service conversation text (including but not limited to user's device information, user's personal information, etc.) and related data involved in the embodiments of the present application are all information authorized by the user or authorized by each party.
[0257] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.
[0258] It should be understood that the application is not limited to the precise construction which has been described above and which shown in the drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application should be limited only by the appended claims.
Claims
1. A method of text sentiment analysis, characterized in that, The method comprises the following steps: obtaining target service dialogue text; performing attribute classification on the target service dialogue text to obtain a corresponding attribute label category set; performing attribute sentiment analysis on the target service dialogue text and the corresponding attribute label category set to obtain a sentiment analysis result of each attribute in the attribute label category set, specifically comprising: when the attribute label category set is not empty, splicing the attribute label category set and the target service dialogue text to obtain an attribute label category list; when the current length of the attribute label category list does not reach the length of the attribute label category list, calling an attribute sentiment analysis model to perform attribute sentiment analysis on each attribute label in the attribute label category list in turn to obtain a corresponding sentiment category and a corresponding probability value of each attribute in the attribute label category list.
2. The method of claim 1, wherein, The method further comprises the following steps: performing word segmentation on the target service dialogue text to obtain an ordered set; calling an attribute recognition model to perform attribute classification on the ordered set to obtain an attribute label category set of the target service dialogue text.
3. The method of claim 2, wherein, Before calling the attribute recognition model to perform attribute classification on the ordered set, the method further comprises the following steps of pre-training the attribute recognition model: obtaining a first training set, wherein the first training set comprises a plurality of historical service dialogue texts and an attribute label category set corresponding to each historical service dialogue text; extracting language text features and convolution text features from each historical service dialogue text respectively; performing feature fusion on the language text features and the convolution text features to obtain a fused feature vector; training the feature vector in each historical service dialogue text through a fully connected layer and then using a multi-label classification model, comparing the training result of each historical service dialogue text with the corresponding attribute label category set during the training process, calculating a loss value according to the difference between the comparison results, updating the parameters of the multi-label classification model based on the loss value through a back propagation mechanism, and after multiple iterations, the multi-label classification model converges to obtain a trained multi-label classification model, and the trained multi-label classification model is used as the attribute recognition model.
4. The method of claim 3, wherein, The method further comprises the following steps of extracting language text features and convolution text features from each historical service dialogue text respectively: inputting each historical service dialogue text into a pre-trained language model BERT and a convolution neural network CNN model for feature extraction to obtain extracted language text features and convolution text features.
5. The method of text sentiment analysis as claimed in claim 1, wherein, The method further comprises the following steps of splicing the attribute label category set and the target service dialogue text to obtain an attribute label category list: performing word segmentation on the attribute label category set to obtain an ordered word set; splicing each word in the ordered word set with the ordered set in turn to obtain an attribute label category list.
6. The method of text sentiment analysis as claimed in claim 1, wherein, The method further comprises the following steps of pre-training the attribute sentiment analysis model: obtaining a second training set, the second training set comprising a plurality of historical service dialogue texts and attribute labels corresponding to each historical service dialogue text; inputting each historical service dialogue text and the corresponding attribute label into a pre-trained language model BERT for training to obtain a word embedding vector; inputting the word embedding vector into a fully connected layer and a missing layer to obtain a vector score pair; processing the vector score using a normalized exponential function to obtain a probability value of each attribute label: selecting the maximum probability value as the sentiment category of the attribute label; using the probability value of each attribute label and the corresponding sentiment category as the training result of the attribute sentiment analysis model.
7. The method of text sentiment analysis as claimed in claim 1, wherein, The method further comprises: obtaining the length of the attribute label category list; determining whether the current length reaches the length of the attribute label category list; when the length of the attribute label category list is reached, outputting the sentiment category and the corresponding probability value of each attribute in the target service dialogue text.
8. A text sentiment analysis apparatus, characterized by, comprises: a first obtaining module for obtaining a target service dialogue text; an attribute classification module for classifying the target service dialogue text to obtain a corresponding attribute label category set; a sentiment analysis module for performing attribute sentiment analysis on the target service dialogue text and the corresponding attribute label category set to obtain a sentiment analysis result of each attribute in the attribute label category set; wherein the sentiment analysis module comprises: a splicing module for splicing the attribute label category set and the target service dialogue text to obtain an attribute label category list when the attribute label category set is not empty; an attribute sentiment analysis module for calling an attribute sentiment analysis model to perform attribute sentiment analysis on the attribute label category list when the current length of the attribute label category list does not reach the length of the attribute label category list to obtain a sentiment analysis result of each attribute in the attribute label category set.
9. An electronic device, comprising: comprises: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the text sentiment analysis method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, When the instructions in the computer readable storage medium are executed by the processor of the electronic device, the electronic device can perform the text sentiment analysis method of any one of claims 1 to 7.
Citation Information
Patent Citations
Order-preserving submatrix (OPSM) and frequent sequence mining based emotion classification method for e-commerce comments
CN107357837A
Comment text attribute-level sentiment analysis method based on deep learning
CN111680154A