Emotion classification method and apparatus

By extracting character and emoji text data, and using a pre-trained and fine-tuned language model combined with an emotion dictionary for emotion enhancement processing, the problem of single feature dimension in existing technologies is solved, the accuracy of emotion classification is improved and the labeling cost is reduced.

CN115270995BActive Publication Date: 2026-04-07BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-31
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing text sentiment analysis methods rely on sentiment dictionaries and traditional machine learning, resulting in single feature dimensions, inability to accurately locate contextual information, low accuracy in sentiment classification prediction, and high annotation costs.

Method used

We extract comment data containing character text and emoji text, utilize a pre-trained language model without task labels and a fine-tuned language model with task labels, combine it with a pre-set sentiment dictionary for sentiment enhancement, and perform sentiment classification through a fully connected layer.

Benefits of technology

It improves the accuracy of sentiment classification, reduces reliance on labeled data, lowers data labeling costs, and enhances sentiment recognition capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115270995B_ABST
    Figure CN115270995B_ABST
Patent Text Reader

Abstract

This disclosure relates to a sentiment classification method and apparatus, belonging to the field of natural language processing technology. The method includes: extracting comment text data containing character text and emoticon text; inputting the comment text data into a preset language model to obtain a first feature vector of the character text and a second feature vector of the emoticon text; the preset language model being a language representation model pre-trained using unlabeled first sample comment text data and fine-tuned using labeled second sample comment text data; performing sentiment enhancement processing on the first feature vector according to a preset sentiment dictionary to obtain a third feature vector of the character text; and inputting a concatenated feature vector of the third and second feature vectors into a fully connected layer in the preset language model to obtain the sentiment classification result corresponding to the comment text data. This method reduces reliance on labeled data during sentiment classification and performs sentiment prediction from multiple feature dimensions, improving prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of natural language processing, and particularly relates to a sentiment classification method and device. BACKGROUND

[0002] With the intelligentization of terminal mobile devices and the rapid development of interactive technology, people's online communication is more efficient and frequent, and people are more and more used to expressing their thoughts and ideas through the Internet, such as publishing their views and attitudes on short video platforms, expressing their moods, and how to analyze the emotional tendency of information publishers from text information in the Internet is one of the important contents in the field of natural language processing technology.

[0003] Currently, text sentiment analysis methods mainly include sentiment analysis methods based on sentiment dictionaries and sentiment analysis methods based on traditional machine learning. The sentiment analysis method based on the sentiment dictionary mainly depends on the construction of the sentiment dictionary. In today's information explosion, various network slang, homophonic language, pun and other new words emerge in an endless stream, which requires the sentiment dictionary to be continuously expanded to ensure the accuracy of the analysis. The sentiment analysis method based on traditional machine learning often excessively relies on the extraction of text sentiment features and the design of the classifier. Under this kind of technical implementation, only from the perspective of text features, the feature dimension of sentiment analysis is relatively single, which cannot accurately locate the context information, and thus the accuracy of sentiment classification prediction is not high. SUMMARY

[0004] The present disclosure provides a sentiment classification method and device, which can perform sentiment prediction analysis from multiple feature dimensions during the sentiment classification process, and perform sentiment enhancement processing on text features, so as to accurately locate the context information and improve the prediction accuracy of sentiment classification. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, a sentiment classification method is provided, comprising:

[0006] extracting comment text data containing character text and expression text;

[0007] inputting the comment text data into a preset language model to obtain a first feature vector of the character text and a second feature vector of the expression text, wherein the preset language model is a language representation model obtained by pre-training a first sample comment text data without a labeled task label and fine-tuning a second sample comment text data with a labeled task label;

[0008] performing sentiment enhancement processing on the first feature vector according to a preset sentiment dictionary to obtain a third feature vector of the character text;

[0009] The spliced feature vector of the third feature vector and the second feature vector is input into a full connection layer in the preset language model to obtain a sentiment classification result corresponding to the comment text data.

[0010] In some embodiments of the present disclosure, the comment text data containing character text and emoji text is extracted, including:

[0011] Initial comment text data containing initial character text and at least one initial emoji text is obtained.

[0012] The initial comment text data is preprocessed to obtain the comment text data containing character text and emoji text.

[0013] The preprocessing includes filtering out meaningless text in the initial character text, and retaining initial emoji text in the at least one initial emoji text that meets a preset condition.

[0014] In some embodiments of the present disclosure, before the initial emoji text in the at least one initial emoji text that meets the preset condition is retained, the method further includes:

[0015] The cumulative occurrence number of each initial emoji text in the at least one initial emoji text in the initial comment text data is counted, and a sentiment attribute value of each initial emoji text is obtained.

[0016] Based on at least one indicator of the cumulative occurrence number and the sentiment attribute value, the initial emoji text in the at least one initial emoji text that meets the preset condition is determined.

[0017] In some embodiments of the present disclosure, the comment text data is input into a preset language model to obtain a first feature vector of the character text and a second feature vector of the emoji text, including:

[0018] The character text and the emoji text in the comment text data are separately subjected to covering processing.

[0019] The comment text data after covering the character text is input into a preset language model to obtain a first feature vector of the character text.

[0020] The comment text data after covering the emoji text is input into a preset language model to obtain a second feature vector of the emoji text.

[0021] In some embodiments of the present disclosure, the first feature vector contains character vectors corresponding to respective characters in the character text.

[0022] The third feature vector of the character text is obtained by performing sentiment enhancement processing on the first feature vector according to a preset sentiment dictionary, and the third feature vector of the character text comprises:

[0023] The spatial vectors of the multiple text segments are obtained by performing linear combination processing on each character vector in the first feature vector.

[0024] The third feature vector of the character text is obtained by performing weighting processing on the spatial vectors of the multiple text segments according to the maximum weight values of the multiple text segments.

[0025] In some embodiments of the present disclosure, the maximum weight values of the multiple text segments are determined according to the preset sentiment dictionary, and the maximum weight values of the multiple text segments are obtained by:

[0026] The initial weight values of the multiple text segments are determined.

[0027] For each text segment, the matching result of the text segment and the preset sentiment dictionary is obtained, and the initial weight values are increased according to the matching result to obtain the maximum weight values of the multiple text segments.

[0028] In some embodiments of the present disclosure, the full connection layer in the preset language model comprises a preset number of hierarchical nodes, and each hierarchical node represents a sentiment polarity.

[0029] The spliced feature vector of the third feature vector and the second feature vector is input into the full connection layer in the preset language model to obtain the sentiment classification result corresponding to the comment text data, and the sentiment classification result corresponding to the comment text data comprises:

[0030] The spliced feature vector of the third feature vector and the second feature vector is input into the full connection layer in the preset language model to obtain the prediction score corresponding to each hierarchical node.

[0031] The sentiment polarity corresponding to the highest prediction score is determined from the sentiment polarities represented by each hierarchical node.

[0032] The sentiment polarity corresponding to the highest prediction score is determined as the sentiment classification result of the comment text data.

[0033] In some embodiments of the present disclosure, before the comment text data is input into the preset language model to obtain the first feature vector of the character text and the second feature vector of the expression text, the method further comprises:

[0034] Obtaining first sample comment text data without task label and second sample comment text data with task label.

[0035] Pre-train an initial language representation model by using the pre-processed first sample review text data;

[0036] When the pre-training of the initial language representation model is completed, fine-tune the initial language representation model by using the pre-processed second sample review text data to obtain the preset language model.

[0037] In some embodiments of the present disclosure, the pre-training of the initial language representation model by using the pre-processed first sample review text data comprises:

[0038] Perform word segmentation processing on the pre-processed first sample review text data to obtain a sample text sequence;

[0039] Update the model parameters of the initial language representation model by performing random masking training on the sample text sequence, and calculate a loss value;

[0040] When the loss value meets the model convergence requirement, it is determined that the pre-training of the initial language representation model is completed.

[0041] In some embodiments of the present disclosure, the second sample review text data is configured with a masking area, and the task label is used to label the character text feature or the expression text feature corresponding to the masking area.

[0042] When the pre-training of the initial language representation model is completed, fine-tune the initial language representation model by using the pre-processed second sample review text data to obtain a preset language model, comprising:

[0043] Input the second sample review text data into the initial language representation model whose pre-training is completed, and obtain a feature prediction result of the masking area;

[0044] If the correctness of the feature prediction result is greater than a preset threshold based on the task label, the initial language representation model is determined as the preset language model;

[0045] If the correctness of the feature prediction result is less than or equal to the preset threshold based on the task label, the initial language representation model is repeatedly fine-tuned by using the task label data, so that the initial language representation model meets the preset fine-tuning standard.

[0046] According to a second aspect of the embodiments of the present disclosure, a sentiment classification device is provided, comprising:

[0047] An extraction module configured to extract review text data containing character text and expression text;

[0048] The determining module is configured to input the comment text data into a preset language model to obtain a first feature vector of the character text and a second feature vector of the expression text, wherein the preset language model is a language representation model obtained by pre-training first sample comment text data without a task label and fine-tuning second sample comment text data with a task label.

[0049] The processing module is configured to perform sentiment enhancement processing on the first feature vector according to a preset sentiment dictionary to obtain a third feature vector of the character text.

[0050] The input module is configured to input a spliced feature vector of the third feature vector and the second feature vector into a full connection layer in the preset language model to obtain a sentiment classification result corresponding to the comment text data.

[0051] In some embodiments of the present disclosure, the extracting module is configured to:

[0052] obtain initial comment text data containing initial character text and at least one initial expression text;

[0053] perform preprocessing on the initial comment text data to obtain the comment text data containing the character text and the expression text;

[0054] The preprocessing includes filtering out meaningless text in the initial character text and retaining initial expression text in the at least one initial expression text that meets a preset condition.

[0055] In some embodiments of the present disclosure, the extracting module is configured to:

[0056] count a cumulative occurrence number of each initial expression text in the initial comment text data and obtain a sentiment attribute value of the each initial expression text;

[0057] determine initial expression text that meets the preset condition from the at least one initial expression text based on at least one index in the cumulative occurrence number and the sentiment attribute value.

[0058] In some embodiments of the present disclosure, the determining module is configured to:

[0059] perform separate covering processing on the character text and the expression text in the comment text data;

[0060] input the comment text data after covering the character text into a preset language model to obtain a first feature vector of the character text;

[0061] input the comment text data after covering the expression text into a preset language model to obtain a second feature vector of the expression text.

[0062] In some embodiments of the present disclosure, the first feature vector comprises a character vector corresponding to each character in the character text.

[0063] The processing module is configured to:

[0064] linearly combine each character vector in the first feature vector to obtain a spatial vector of the plurality of text segments.

[0065] According to the preset emotion dictionary, determine the maximum weight value of each text segment, and according to the maximum weight value of each text segment, perform weighting processing on the spatial vector of the plurality of text segments to obtain a third feature vector of the character text.

[0066] In some embodiments of the present disclosure, the processing module is configured to:

[0067] determine an initial weight value of each text segment;

[0068] For each text segment, obtain a matching result of the text segment and the preset emotion dictionary, and according to the matching result, perform weight increasing processing on the initial weight value to obtain the maximum weight value of each text segment.

[0069] In some embodiments of the present disclosure, the full connection layer in the preset language model comprises a preset number of hierarchical nodes, and each hierarchical node represents a sentiment polarity.

[0070] The input module is configured to:

[0071] input the spliced feature vector of the third feature vector and the second feature vector into the full connection layer in the preset language model to obtain a predicted score corresponding to each hierarchical node;

[0072] determine a corresponding sentiment polarity with the highest predicted score from the sentiment polarities represented by each hierarchical node;

[0073] determine the corresponding sentiment polarity with the highest predicted score as a sentiment classification result of the comment text data.

[0074] In some embodiments of the present disclosure, the sentiment classification device further comprises:

[0075] The obtaining module is configured to obtain first sample comment text data without a task label and second sample comment text data with a task label;

[0076] The training module is configured to pre-train an initial language representation model by using the preprocessed first sample review text data.

[0077] The fine-tuning module is configured to fine-tune the initial language representation model by using the preprocessed second sample review text data when the pre-training of the initial language representation model is completed, to obtain the preset language model.

[0078] In some embodiments of the present disclosure, the training module is configured to:

[0079] perform word segmentation processing on the preprocessed first sample review text data to obtain a sample text sequence;

[0080] update model parameters of the initial language representation model by performing random masking training on the sample text sequence, and calculate a loss value;

[0081] determine that the pre-training of the initial language representation model is completed when the loss value meets a model convergence requirement.

[0082] In some embodiments of the present disclosure, the second sample review text data is configured with a masking area, and the task label is used to label a character text feature or an expression text feature corresponding to the masking area.

[0083] The fine-tuning module is configured to:

[0084] input the second sample review text data into the initial language representation model whose pre-training is completed, to obtain a feature prediction result of the masking area;

[0085] if the correctness of the feature prediction result is greater than a preset threshold based on the task label, determine the initial language representation model as the preset language model;

[0086] if the correctness of the feature prediction result is less than or equal to the preset threshold based on the task label, repeatedly fine-tune the initial language representation model by using the task label data, so that the initial language representation model meets a preset fine-tuning standard.

[0087] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising:

[0088] a processor;

[0089] a memory for storing instructions executable by the processor;

[0090] The processor is configured to execute the instructions to implement the sentiment classification method according to the first aspect.

[0091] According to a fourth aspect of the embodiments of the present disclosure, a storage medium is provided, and when instructions in the storage medium are executed by a processor of an electronic device, the electronic device can perform the emotion classification method according to the first aspect.

[0092] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, and the computer program product comprises a computer program, and when the computer program is executed by a processor, the emotion classification method according to the first aspect is implemented.

[0093] The embodiments of the present disclosure provide at least the following beneficial effects: the embodiments of the present disclosure can first extract comment text data containing character text and expression text; further input the comment text data into a preset language model to determine a first feature vector of the character text and a second feature vector of the expression text; to improve the accuracy of emotion prediction, the first feature vector can be subjected to emotion enhancement processing to obtain a third feature vector after emotion feature enhancement; finally, the spliced feature vector of the third feature vector and the second feature vector is input into a full connection layer in the preset language model to obtain an emotion classification result corresponding to the comment text data. In the technical solution of the present application, the preset language model can be trained by using less labeled sample comment texts in the emotion classification process, thereby reducing the dependence on labeled data and reducing the data labeling cost. At the same time, in the emotion classification process, the feature dimension of expression text is introduced in addition to character text, and the character text and the expression text are used to comprehensively predict the emotion classification result, which can enhance the emotion recognition capability. In addition, by using the information enhancement of the first feature vector of the character text output by the preset language model, the representation capability of the character text corresponding feature vector can be enhanced, and the accuracy of emotion prediction can be improved.

[0094] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0095] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure, and do not constitute an improper limitation on the present disclosure.

[0096] Figure 1 is a flowchart of an emotion classification method according to an exemplary embodiment;

[0097] Figure 2 is a flowchart of an emotion classification method according to an exemplary embodiment;

[0098] Figure 3 is a schematic diagram of the principle of emotion classification according to an exemplary embodiment;

[0099] Figure 4 FIG. 1 is a flow diagram of a preset language model training method according to an example embodiment;

[0100] Figure 5 FIG. 2 is a structural diagram of a sentiment classification device according to an example embodiment;

[0101] Figure 6 FIG. 2 is a structural diagram of a sentiment classification device according to an example embodiment.

[0102] Figure 7 FIG. 3 is a block diagram of an electronic device according to an example embodiment;

[0103] Figure 8 FIG. 3 is a block diagram of an electronic device according to an example embodiment. DETAILED DESCRIPTION

[0104] In order for those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings.

[0105] It should be noted that the terms "first", "second", and the like in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. The embodiments described in the following example embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0106] In the sentiment classification process, the text sentiment analysis method mainly includes a sentiment analysis method based on a sentiment dictionary and a sentiment analysis method based on traditional machine learning. The sentiment analysis method based on the sentiment dictionary mainly relies on the construction of the sentiment dictionary. In today's information explosion, various network popular words, homophonic words, puns, and other new words emerge in an endless stream, which requires the sentiment dictionary to be continuously expanded to ensure the accuracy of the analysis. The sentiment analysis method based on traditional machine learning often excessively relies on the extraction of text sentiment features and the design of the classifier. Under this kind of technical implementation, only from the perspective of text features, the dimension of the sentiment analysis is relatively single, which cannot accurately locate the context information, and thus causes the accuracy of the sentiment prediction to be not high. In addition, this method requires a large amount of labeled data, and the labeling cost is high.

[0107] To solve the above technical problems, the present application provides an emotion classification method and device, which can reduce the dependence on labeled data in the emotion classification process and improve the prediction accuracy by performing emotion enhancement processing on emotion words.

[0108] Figure 1 is a flow chart of an emotion classification method according to an exemplary embodiment, as shown in the figure, comprising the following steps. Figure 1

[0109] In step S11, the comment text data containing character text and expression text is extracted.

[0110] The comment text data is the key data obtained by cleaning and filtering the initial comment text data uploaded by the user, and the comment text data contains character text and expression text. The expression text is the expression conversion text corresponding to the preset expression symbol, such as 75 types of expressions such as

like

angry

angry

[0111] In step S12, the comment text data is input into a preset language model to obtain a first feature vector of the character text and a second feature vector of the expression text.

[0112] ​The preset language model can be a language representation model (Bidirectional Encoder Representation from Transformers, BERT) obtained by pre-training using first sample review text data without task label annotation and fine-tuning using second sample review text data with task label annotation. The BERT is a language model constructed based on a bidirectional Transformer. The Transformer is an annotation mechanism used to learn the context relationship between words in a text. A basic Transformer includes an encoder used to read text input and a decoder used to generate a prediction about a task. Since the objective of the BERT pre-training model is to generate a language representation model, it only needs the encoder part. The input of the encoder of the BERT pre-training model is a string sequence (the elements of which are generally referred to as tokens or words), which is first converted into a vector and then processed in a neural network. When the BERT performs embedding on a sentence, special characters [CLS] and [SEP] are introduced. The first token of each sentence sequence is always [CLS], and for a classification task, the output of the Transformer corresponding to the token can be used in the overall representation of the sequence. The [SEP] is used to distinguish the sentence pairs packed together.

[0113] In the embodiments of the present disclosure, the initial BERT model can be pre-trained using first sample review text data with emoticons and without task label annotation, and then the initial BERT model can be fine-tuned using second sample review text data with task label annotation and matching the sentiment classification task, that is, task training is performed on the basis of the prediction capability. After the fine-tuning is completed, the preset language model can be obtained. Further, after the preset language model is obtained, the review text data containing character text and emoticon text can be input into the preset language model, and the first feature vector of the character text and the second feature vector of the emoticon text can be output based on the model parameters of the fine-tuned model.

[0114] In the embodiments of the present disclosure, by pre-training the initial BERT model using first sample review text data without task label annotation and fine-tuning the pre-trained initial BERT model using second sample review text data with task label annotation, the dependence on annotated data can be reduced and the data annotation cost can be reduced while ensuring the prediction accuracy of the preset language model.

[0115] In step S13, the first feature vector is subjected to sentiment enhancement processing according to a preset sentiment dictionary, and a third feature vector of the character text is obtained.

[0116] The preset sentiment dictionary is a pre-built sentiment enhancement lexicon. In Chinese sentences, words expressing emotions are generally preceded by adverbs of degree, such as "very" or "especially." Furthermore, while some sentences may contain words indicating positive or negative emotions, these words are often preceded by negative words, effectively making the emotional polarity of the sentence opposite. Considering these issues, a preset sentiment dictionary can be built beforehand in this embodiment. For example, the preset sentiment dictionary can consist of adverbs of degree and negative words.

[0117] In specific application scenarios, one possible implementation is to use the first feature vector of the character text and the second feature vector of the emoticon text directly output by a preset language model to predict the sentiment classification result. However, the BERT model typically uses the [CLS] positional encoding information directly, which leads to the loss of some feature information in the character text and insufficient representation ability. Therefore, in this embodiment, an extended space weighting method can be used to further enhance the sentiment of the first feature vector of the character text output by the preset language model based on a preset sentiment dictionary, resulting in the third feature vector of the character text. Through this embodiment, the representation ability of the corresponding feature vector of the character text can be enhanced, and the accuracy of sentiment prediction can be improved.

[0118] In step S14, the concatenated feature vector of the third feature vector and the second feature vector is input into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data.

[0119] The sentiment classification result is the sentiment polarity corresponding to the comment text data. In this embodiment, preset sentiment polarities can be configured, such as "very negative", "negative", "neutral", "positive", "very positive", etc. After inputting the concatenated feature vector of the third feature vector and the second feature vector into the fully connected layer of the preset language model, the fully connected layer can output the predicted score for each preset sentiment polarity. Furthermore, the preset sentiment polarity with the highest predicted score can be determined as the sentiment classification result of the comment text data.

[0120] The embodiments of this disclosure first extract comment text data containing character text and emoticon text; then, the comment text data is input into a preset language model to determine a first feature vector of the character text and a second feature vector of the emoticon text; to improve the accuracy of sentiment prediction, the first feature vector can be processed by sentiment enhancement to obtain a third feature vector with enhanced sentiment features; finally, the concatenated feature vector of the third feature vector and the second feature vector is input into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data. The technical solution in this application can train the preset language model using fewer labeled sample comment texts during the sentiment classification process, thereby reducing the dependence on labeled data and lowering data labeling costs. Simultaneously, in the sentiment classification process, in addition to character text, an emoticon text feature dimension is introduced, and the prediction of the sentiment classification result using a combination of character text and emoticon text can enhance the sentiment recognition capability. Furthermore, an expanded space approach is used to enhance the information of the first feature vector of the character text output by the preset language model, which can enhance the representational ability of the corresponding feature vector of the character text and improve the accuracy of sentiment prediction.

[0121] Furthermore, as a refinement and extension of the above embodiments, in order to fully illustrate the specific implementation process of the method in this embodiment, this embodiment provides the following: Figure 2 The specific method shown includes:

[0122] In step S21, initial comment text data containing initial character text and at least one emoji text is obtained.

[0123] The initial comment text data consists of text sentences requiring sentiment classification and identification. Specifically, it can be the original comment text data uploaded by users on the data interaction platform, containing initial character text and at least one emoji text. Unlike the comment text data, which is the most concise and key data reflecting the commenter's true intentions, containing only character text expressing emotional information and the emoji text corresponding to one emoji, the initial comment text data may contain a large number of meaningless redundant characters. These redundant characters are not analytically significant for sentiment classification and can easily increase the workload in the sentiment classification prediction process. The initial comment text data may also contain multiple emoji texts. In the case of multiple emoji texts, it is also necessary to select the emoji text with the strongest emotional attribute that best reflects the commenter's comment context.

[0124] In step S22, the initial comment text data is preprocessed to obtain comment text data containing character text and emoticon text.

[0125] In an embodiment of this disclosure, step S22 may include:

[0126] Step S221: Filter out meaningless text from the initial character text.

[0127] In the embodiments of this disclosure, the initial comment text data may include character text and emoji text. The character text often contains multiple redundant texts that are of no help to sentiment recognition, such as non-text characters, hyperlinks, some special symbols, and meaningless text (such as @xxx). Therefore, in order to improve the efficiency of sentiment classification, the character text can be cleaned to remove redundant text.

[0128] Step S222: Count the cumulative number of occurrences of each initial emoticon text in the initial comment text data, and obtain the sentiment attribute value of each initial emoticon text.

[0129] In this embodiment of the disclosure, the initial comment text data may contain multiple emoji texts. To make the emoji texts more realistically reflect the true emotions of the user's comment, further statistical analysis can be performed on the multiple emoji texts. Specifically, the cumulative occurrence count of each initial emoji text in the initial comment text data can be counted, and the emotional attribute value of each initial emoji text can be obtained. This allows for the selection of the emoji text with the strongest emotional attribute and best reflecting the commenter's comment context from among the multiple emoji texts based on the statistical results. Specifically, before obtaining the emotional attribute value of each initial emoji text, corresponding emotional attribute values ​​can be pre-set for different preset emoji symbols. When obtaining the emotional attribute value of each initial emoji text, the target emoji symbol described by each initial emoji text can be determined first, and the emotional attribute value corresponding to the target emoji symbol can be used as the emotional attribute value of that initial emoji text.

[0130] Step S223: Based on at least one of the indicators, namely the cumulative occurrence count and the emotion attribute value, determine the initial emoticon text that meets the preset conditions from at least one initial emoticon text.

[0131] The preset condition can be to select the emoticon text that appears most frequently and / or has the strongest emotional attribute from at least one initial emoticon text.

[0132] In this embodiment of the disclosure, step S223 may include:

[0133] Step S2231: Determine the initial emoticon text that appears most frequently in at least one initial emoticon text as the initial emoticon text that meets the preset conditions; and / or,

[0134] Step S2232: Determine the emoji text with the highest emotional attribute value among at least one initial emoji text as the initial emoji text that meets the preset conditions.

[0135] Correspondingly, when there are multiple emojis in the initial review text data, when determining the initial emoji text that meets the preset conditions: As a possible implementation, the initial emoji text with the highest cumulative occurrence count in the initial review text data can be determined as the initial emoji text that meets the preset conditions; As a possible implementation, the initial emoji text with the highest emotional attribute value in the initial review text data can be determined as the initial emoji text that meets the preset conditions; As a possible implementation, first extract multiple initial emoji texts with the highest cumulative occurrence count from the initial review text data, and then determine the emoji text with the highest emotional attribute value among the multiple initial emoji texts as the initial emoji text that meets the preset conditions; As a possible implementation, first extract multiple initial emoji texts with the highest emotional attribute value from the initial review text data, and then determine the emoji text with the highest cumulative occurrence count among the multiple initial emoji texts as the initial emoji text that meets the preset conditions.

[0136] Step S224: Retain the initial emoji text that meets the preset conditions among at least one initial emoji text.

[0137] For the embodiments of the present disclosure, after determining the initial emoji text that meets the preset conditions among at least one initial emoji text, as a possible implementation, if the selected initial emoji text that meets the preset conditions is a single-character emoji text, the single-character emoji text can be further expanded into a multi-character emoji text to display the emotional attribute of the emoji. For example, expand the single-character emoji text [赞] into the multi-character emoji text [点赞].

[0138] In step S23, input the review text data into a preset language model to obtain the first feature vector of the character text and the second feature vector of the emoji text.

[0139] Correspondingly, for the embodiments of the present disclosure, step S23 may include:

[0140] Step S231: Separately perform masking processing on the character text and the emoji text in the review text data.

[0141] Step S232: Input the review text data after masking the character text into the preset language model to obtain the first feature vector of the character text.

[0142] Step S233: Input the review text data after masking the emoji text into the preset language model to obtain the second feature vector of the emoji text.

[0143] In the disclosed embodiment, comment text data can be input into a preset language model in the form of "[MASK]...[MASK]+emoji text". [CLS] is used as the marker for the beginning of the text, and [SEP] is used as the marker for the separation and end of the text. That is, a [CLS] token is added to the input word token at the beginning of the first text, and a [SEP] token is inserted at the end of each text. The MASK positions are further predicted using an MLM masking language model based on the preset language model. Specifically, this can be encoded through a 12-layer Transformer mechanism encoder layer to determine the hidden states h1, h2...hn corresponding to n character positions [MASK] in the character text. The vector dimensions of the n [MASK] positions h1, h2...hn are then summed and averaged to obtain the first feature vector of the character text. Similarly, assuming the emoji text consists of two characters, the comment text data can be input into the preset language model in the form of "character text + [MASK][MASK]" to determine the hidden states h1 and h2 corresponding to the two characters [MASK]. The vector dimensions of the two [MASK] positions h1 and h2 are then summed and averaged to obtain the second feature vector of the emoji text.

[0144] In step S24, the first feature vector is subjected to sentiment enhancement processing according to a preset sentiment dictionary to obtain the third feature vector of the character text.

[0145] The first feature vector contains the character vectors corresponding to each character in the character text.

[0146] In specific application scenarios, one possible implementation is to use the first feature vector of the character text and the second feature vector of the emoticon text directly output by a preset language model to predict the sentiment classification result. However, the BERT model typically uses the [CLS] positional encoding information directly, which leads to the loss of some feature information in the character text and insufficient representation ability. Therefore, in this embodiment, an extended space weighting method can be used to further enhance the sentiment of the first feature vector of the character text output by the preset language model based on a preset sentiment dictionary, resulting in the third feature vector of the character text. Through this embodiment, the representation ability of the corresponding feature vector of the character text can be enhanced, and the accuracy of sentiment prediction can be improved.

[0147] Accordingly, for embodiments of this disclosure, step S24 may include:

[0148] Step S241: Perform linear combination processing on each character vector in the first feature vector to obtain spatial vectors of multiple text segments;

[0149] Step S242: Determine the final weight value of each text segment according to the preset sentiment dictionary, and perform weighted processing on the spatial vectors of multiple text segments according to the final weight value of each text segment to obtain the third feature vector of the character text.

[0150] In this embodiment of the disclosure, when determining the final weight value of each text segment based on a preset sentiment dictionary, step S242 may include:

[0151] Step S2421: Determine the initial weight values ​​for each text segment.

[0152] Step S2421: For each text segment, obtain the matching result between the text segment and the preset sentiment dictionary, and increase the weight value of the initial weight value according to the matching result to obtain the final weight value of each text segment.

[0153] For example, the sentence "This song is sung really well" yields the first feature vector of the text. This first feature vector contains the character vectors corresponding to each character in the text: h1, h2, ..., h7. A linear combination of these character vectors is then performed to obtain spatial vectors for multiple text segments, such as h1~h2, h1~h3, ..., h1~h7, ...

[0154]

[0155] W = [w1, w2, w3, w4], w i ∈R D×D

[0156] Where D is the dimension of the embedding.

[0157] An attention mechanism is used to calculate the initial weights of different text segments, and sentiment word matching is added to further enhance the weights. Calculation method:

[0158] o(i,j)=h T h(i,j), h∈R 1×D

[0159] The text segment corresponding to h(i,j) is matched with any degree adverb and / or negation word in the preset sentiment dictionary. If a match is successful, the matched text segment is weighted, and the formulaic feature of the weighted processing is described as follows:

[0160] o(i,j)=o(i,j)+R

[0161] Here, R is a hyperparameter used to increase the weight of the text segment. Then, based on the weighted processing results, the final weight values ​​of multiple text segments are calculated, resulting in the following final weight values ​​for each text segment:

[0162]

[0163] Furthermore, based on the final weight values ​​of each text segment, the spatial vectors of multiple text segments can be weighted to obtain the third feature vector of the character text:

[0164]

[0165] In step S25, the concatenated feature vector of the third feature vector and the second feature vector is input into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data.

[0166] The fully connected layer in the preset language model contains a preset number of hierarchical nodes, and each hierarchical node represents an emotional polarity.

[0167] Accordingly, for embodiments of this disclosure, step S25 may include:

[0168] Step S251: Input the concatenated feature vector of the third feature vector and the second feature vector into the fully connected layer of the preset language model to obtain the prediction scores corresponding to each level node.

[0169] Step S252: Determine the sentiment polarity with the highest prediction score from the sentiment polarities represented by each level node.

[0170] Step S253: The sentiment polarity with the highest predicted score is determined as the sentiment classification result of the comment text data.

[0171] In this embodiment of the present disclosure, the concatenated feature vector of the third feature vector and the second feature vector can be input into the fully connected layer in the preset language model. The fully connected layer has n level nodes, where n represents the number of preset sentiment polarities. The two are in one-to-one correspondence. The value of each level node represents the probability value of predicting the comment text data as the corresponding sentiment polarity. SOFTMAX is used for normalization processing so that the sum of the probability values ​​of the n level nodes is 1. Finally, the sentiment polarity with the largest corresponding probability value is determined as the sentiment classification result of the comment text data.

[0172] For the emotion classification process based on facial expression pre-training in this disclosure, please refer to [link to relevant documentation]. Figure 3The diagram illustrates the principle of sentiment classification. After extracting the comment text data "Great workers, you've worked hard! [Like]", which contains both character text and emoji text, the character text in the comment text data is masked and input into a preset language model in the form of "[MASK][MASK][MASK][MASK][MASK][MASK][MASK][MASK][MASK][MASK][MASK][MASK][Like]", resulting in the first feature vector of the character text "Great workers, you've worked hard!". Similarly, the emoji text in the comment text data is masked and input into the preset language model in the form of "Great workers, you've worked hard! [MASK][MASK]", resulting in the second feature vector corresponding to the emoji text "[Like]". Further, sentiment enhancement processing is applied to the first feature vector to obtain the third feature vector h of the character text. Then, according to the order in which the character text and emoji text appear in the comment text data, the third feature vector h and the second feature vector are concatenated. The concatenated feature vector is input into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data. The sentiment classification result can be the sentiment polarity corresponding to the comment text data. Sentiment polarity can include "very negative", "negative", "neutral", "positive", "very positive", etc.

[0173] The embodiments of this disclosure first extract comment text data containing character text and emoticon text; then, the comment text data is input into a preset language model to determine a first feature vector of the character text and a second feature vector of the emoticon text; to improve the accuracy of sentiment prediction, the first feature vector can be processed by sentiment enhancement to obtain a third feature vector with enhanced sentiment features; finally, the concatenated feature vector of the third feature vector and the second feature vector is input into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data. The technical solution in this application can train the preset language model using fewer labeled sample comment texts during the sentiment classification process, thereby reducing the dependence on labeled data and lowering data labeling costs. Simultaneously, in the sentiment classification process, in addition to character text, an emoticon text feature dimension is introduced, and the prediction of the sentiment classification result using a combination of character text and emoticon text can enhance the sentiment recognition capability. Furthermore, an expanded space approach is used to enhance the information of the first feature vector of the character text output by the preset language model, which can enhance the representational ability of the corresponding feature vector of the character text and improve the accuracy of sentiment prediction.

[0174] It should be noted that before performing steps S23 to S25 of the embodiment, the language representation model needs to be pre-trained and fine-tuned to obtain a preset language model suitable for performing the sentiment classification task in this disclosure. This embodiment provides, for example... Figure 4 The specific method shown includes:

[0175] In step S31, the first sample comment text data without task tags and the second sample comment text data with task tags are obtained.

[0176] In this embodiment of the disclosure, by using first sample comment text data without task labels to pre-train the initial BERT model, and using second sample comment text data with task labels to further fine-tune the pre-trained initial BERT model, the prediction accuracy of the preset language model can be guaranteed while reducing the dependence on labeled data and lowering the cost of data labeling.

[0177] In step S32, the initial language representation model is pre-trained using the preprocessed first sample comment text data.

[0178] The initial language representation model can be a language representation model (Bidirectional Encoder Representation from Transformers, BERT).

[0179] Accordingly, for embodiments of this disclosure, step S32 may include:

[0180] Step S321: Perform word segmentation on the preprocessed first sample comment text data to obtain a sample text sequence.

[0181] The specific details of preprocessing the first sample comment text data can be found in step S22 of the embodiment, and will not be repeated here.

[0182] Step S322: By randomly masking the sample text sequence for training, update the model parameters of the initial language representation model and calculate the loss value.

[0183] In this embodiment of the disclosure, when training the sample text sequence with random masking, the BERT masked language model (MLM) can be used. For the input text, 15% of the tokens are randomly selected and operated on. The operation method is as follows: 80% are replaced with MASK, 10% remain unchanged, and 10% are replaced with other words.

[0184] That is, for each word (token) in a sentence:

[0185] There is an 85% probability that the original words will remain unchanged.

[0186] With a 15% probability, use the following replacement method:

[0187] There is an 80% probability that the current token will be replaced with the character [MASK].

[0188] There is a 10% probability that the current token will be replaced with a token randomly selected from the vocabulary.

[0189] There is a 10% probability that the original words will remain unchanged.

[0190] Step S323: When the loss value reaches the model convergence requirement, it is determined that the initial language representation model pre-training is complete.

[0191] In step S33, when the initial language representation model pre-training is completed, the initial language representation model is fine-tuned using the pre-processed second sample comment text data to obtain the preset language model.

[0192] The second sample comment text data includes a masked area, and the task label is used to annotate the character text features or emoji text features corresponding to the masked area.

[0193] Accordingly, for embodiments of this disclosure, step S33 may include:

[0194] Step S331: Input the second sample comment text data into the pre-trained initial language representation model to obtain the feature prediction results of the occluded area.

[0195] Step S332: If the accuracy of the feature prediction result based on the task label is greater than the preset threshold, then the initial language representation model is determined as the preset language model.

[0196] The preset threshold is a value greater than 0 and less than 1. The closer the set value is to 1, the higher the prediction accuracy of the preset language model, and vice versa. The specific value can be set according to the actual application scenario, which will not be elaborated here.

[0197] Step S333: If the accuracy of the feature prediction result based on the task label is less than or equal to a preset threshold, the initial language representation model is repeatedly fine-tuned using the task-labeled data so that the initial language representation model meets the preset fine-tuning standard.

[0198] In this embodiment of the disclosure, the emoji text in the second sample comment text data can be masked, and the masked language model (MLM) of the BERT pre-trained model can be used to predict the mask position, thereby obtaining the feature prediction result of the mask position. Furthermore, by matching the feature prediction result with the task labels configured in the second sample comment text data, and statistically analyzing the prediction accuracy of the initial language representation model based on the matching results, when the prediction accuracy meets the prediction requirements, the initial language representation model is determined to be a preset language model after fine-tuning, and can then be reused in the sentiment classification task of the technical solution of this disclosure.

[0199] In this embodiment of the disclosure, by sequentially pre-training and fine-tuning the initial language representation model, the model can recognize the emotional differences between different words with fewer annotated samples, making it more suitable for sentiment classification tasks and thus improving the accuracy of sentiment classification prediction.

[0200] Based on the above Figures 1-4 The specific implementation of the method shown in this embodiment provides an emotion classification device, such as... Figure 5 As shown, the device includes: an extraction module 41, a determination module 42, a processing module 43, and an input module 44.

[0201] Extraction module 41 is configured to extract comment text data containing character text and emoticon text;

[0202] The determination module 42 is configured to input the comment text data into a preset language model to obtain the first feature vector of the character text and the second feature vector of the emoticon text. The preset language model is a language representation model that is pre-trained using the first sample comment text data without task labels and fine-tuned using the second sample comment text data with task labels.

[0203] Processing module 43 is configured to perform sentiment enhancement processing on the first feature vector according to a preset sentiment dictionary to obtain the third feature vector of the character text;

[0204] Input module 44 is configured to input the concatenated feature vector of the third feature vector and the second feature vector into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data.

[0205] In some embodiments of this disclosure, the extraction module 41 is configured to:

[0206] Retrieve initial comment text data containing initial character text and at least one initial emoji text;

[0207] Preprocess the initial comment text data to obtain comment text data containing character text and emoji text;

[0208] The preprocessing includes: filtering out meaningless text from the initial character text, and retaining at least one initial emoticon text that meets preset conditions.

[0209] In some embodiments of this disclosure, the extraction module 41 is configured to:

[0210] Count the cumulative occurrence of each initial emoji text in the initial comment text data, and obtain the sentiment attribute value of each initial emoji text;

[0211] Based on at least one of the indicators, namely the cumulative occurrence count and the emotion attribute value, an initial emoticon text that meets the preset conditions is determined from at least one initial emoticon text.

[0212] In some embodiments of this disclosure, the determining module 42 is configured to:

[0213] The character text and emoji text in the comment text data are masked separately;

[0214] Input the comment text data after masking the character text into a preset language model to obtain the first feature vector of the character text;

[0215] Input the comment text data after covering the emoji text into a preset language model to obtain the second feature vector of the emoji text.

[0216] In some embodiments of this disclosure, the first feature vector includes character vectors corresponding to each character in the character text;

[0217] Processing module 43 is configured as follows:

[0218] The character vectors in the first feature vector are linearly combined to obtain spatial vectors of multiple text segments.

[0219] The final weight value of each text segment is determined based on the preset sentiment dictionary. Based on the final weight value of each text segment, the spatial vectors of multiple text segments are weighted to obtain the third feature vector of the character text.

[0220] In some embodiments of this disclosure, processing module 43 is configured to:

[0221] Determine the initial weight values ​​for each text segment;

[0222] For each text segment, the matching results between the text segment and the preset sentiment dictionary are obtained, and the initial weight values ​​are weighted according to the matching results to obtain the final weight values ​​of each text segment.

[0223] In some embodiments of this disclosure, the fully connected layer in the preset language model contains a preset number of hierarchical nodes, each representing an emotional polarity;

[0224] Input module 44 is configured as follows:

[0225] The concatenated feature vector of the third feature vector and the second feature vector is input into the fully connected layer in the preset language model to obtain the prediction scores corresponding to each level node.

[0226] From the sentiment polarities represented by nodes at each level, determine the sentiment polarity with the highest predicted score;

[0227] The sentiment polarity with the highest predicted score is determined as the sentiment classification result of the comment text data.

[0228] In some embodiments of this disclosure, such as Figure 6 As shown, the emotion classification device also includes:

[0229] The acquisition module 45 is configured to acquire first sample comment text data without task tags and second sample comment text data with task tags;

[0230] Training module 46 is configured to pretrain an initial language representation model using preprocessed first sample comment text data;

[0231] The fine-tuning module 47 is configured to fine-tune the initial language representation model using the pre-processed second sample comment text data when the initial language representation model pre-training is completed, so as to obtain a preset language model.

[0232] In some embodiments of this disclosure, training module 46 is configured to:

[0233] The preprocessed first sample comment text data is segmented into words to obtain a sample text sequence;

[0234] By training the sample text sequence with random masking, the model parameters of the initial language representation model are updated, and the loss value is calculated.

[0235] When the loss value reaches the model convergence requirement, the initial language representation model pre-training is considered complete.

[0236] In some embodiments of this disclosure, the second sample comment text data is configured with a masking region, and the task label is used to annotate the character text features or emoticon text features corresponding to the masking region;

[0237] Fine-tuning module 47 is configured as follows:

[0238] Input the second sample comment text data into the pre-trained initial language representation model to obtain the feature prediction results of the occluded area;

[0239] If the accuracy of the feature prediction result based on the task label is greater than the preset threshold, then the initial language representation model is determined as the preset language model.

[0240] If the accuracy of feature prediction based on task labels is less than or equal to a preset threshold, the initial language representation model is repeatedly fine-tuned using task-labeled data to make the initial language representation model conform to the preset fine-tuning standard.

[0241] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0242] The embodiments of this disclosure first extract comment text data containing character text and emoticon text; then, the comment text data is input into a preset language model to determine a first feature vector of the character text and a second feature vector of the emoticon text; to improve the accuracy of sentiment prediction, the first feature vector can be processed by sentiment enhancement to obtain a third feature vector with enhanced sentiment features; finally, the concatenated feature vector of the third feature vector and the second feature vector is input into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data. The technical solution in this application can train the preset language model using fewer labeled sample comment texts during the sentiment classification process, thereby reducing the dependence on labeled data and lowering data labeling costs. Simultaneously, in the sentiment classification process, in addition to character text, an emoticon text feature dimension is introduced, and the prediction of the sentiment classification result using a combination of character text and emoticon text can enhance the sentiment recognition capability. Furthermore, an expanded space approach is used to enhance the information of the first feature vector of the character text output by the preset language model, which can enhance the representational ability of the corresponding feature vector of the character text and improve the accuracy of sentiment prediction.

[0243] Figure 7 This is a block diagram of an electronic device 800 disclosed herein. For example, the electronic device 800 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0244] Reference Figure 7The electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power 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.

[0245] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the information platform selection method of any embodiment. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.

[0246] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0247] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.

[0248] Multimedia component 808 includes a screen that provides an output interface between electronic device 800 and a user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0249] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.

[0250] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0251] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0252] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0253] In an exemplary embodiment, the electronic device 800 may be implemented by 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, microcontrollers, microprocessors, or other electronic components to perform the emotion classification method of any embodiment.

[0254] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of an electronic device 800 to complete the information platform selection method of any embodiment. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0255] In an exemplary embodiment, a computer program product is also provided, comprising readable program code executable by a processor 820 of device 800 to perform the emotion classification method of any embodiment. Optionally, the program code may be stored in a storage medium of device 800, which may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device.

[0256] Figure 8 This is a block diagram of an electronic device 1900 disclosed herein. For example, the electronic device 1900 may be provided as a server.

[0257] Reference Figure 8 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the emotion classification method described in any embodiment.

[0258] Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input / output (I / O) interface 1958. Electronic device 1900 can operate on an operating system stored in memory 1932, such as Windows Server™, MacOSX™, Unix™, Linux™, FreeBSD™, or similar.

[0259] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0260] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. An emotion classification method, characterized in that, include: Extract comment text data that includes character text and emoji text; The comment text data is input into a preset language model to obtain the first feature vector of the character text and the second feature vector of the emoticon text. The preset language model is a language representation model that is pre-trained using the first sample comment text data without task labels and fine-tuned using the second sample comment text data with task labels. The first feature vector is subjected to sentiment enhancement processing based on a preset sentiment dictionary to obtain the third feature vector of the character text; The concatenated feature vector of the third feature vector and the second feature vector is input into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data; The step of inputting the comment text data into a preset language model to obtain the first feature vector of the character text and the second feature vector of the emoticon text includes: The character text and the emoji text in the comment text data are each individually masked; Input the comment text data after covering the character text into a preset language model to obtain the first feature vector of the character text; The comment text data after the emoticon text is covered is input into a preset language model to obtain the second feature vector of the emoticon text.

2. The method according to claim 1, characterized in that, The extraction of comment text data containing character text and emoji text includes: Retrieve initial comment text data containing initial character text and at least one initial emoji text; The initial comment text data is preprocessed to obtain the comment text data containing character text and emoji text; The preprocessing includes: filtering out meaningless text from the initial character text, and retaining the initial emoticon text that meets preset conditions from the at least one initial emoticon text.

3. The method according to claim 2, characterized in that, Before retaining the initial emoji text that meets the preset conditions from the at least one initial emoji text, the method further includes: The cumulative number of occurrences of each initial emoticon text in the initial comment text data is counted, and the sentiment attribute value of each initial emoticon text is obtained. Based on at least one of the cumulative occurrence counts and the emotional attribute values, an initial emoticon text that meets the preset conditions is determined from the at least one initial emoticon text.

4. The method according to claim 1, characterized in that, The first feature vector contains the character vectors corresponding to each character in the character text; The step of performing sentiment enhancement processing on the first feature vector according to a preset sentiment dictionary to obtain the third feature vector of the character text includes: The character vectors in the first feature vector are linearly combined to obtain spatial vectors of multiple text segments. The final weight value of each text segment is determined according to the preset emotion dictionary. Based on the final weight value of each text segment, the spatial vectors of the multiple text segments are weighted to obtain the third feature vector of the character text.

5. The method according to claim 4, characterized in that, The step of determining the final weight value of each text segment based on the preset sentiment dictionary includes: Determine the initial weight values ​​for each text segment; For each text segment, the matching result between the text segment and the preset sentiment dictionary is obtained, and the initial weight value is weighted according to the matching result to obtain the final weight value of each text segment.

6. The method according to claim 1, characterized in that, The fully connected layer in the preset language model contains a preset number of hierarchical nodes, and each hierarchical node represents an emotional polarity; The step of inputting the concatenated feature vector of the third feature vector and the second feature vector into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data includes: The concatenated feature vector of the third feature vector and the second feature vector is input into the fully connected layer of the preset language model to obtain the prediction scores corresponding to each level node. From the sentiment polarities represented by nodes at each level, determine the sentiment polarity with the highest predicted score; The sentiment polarity with the highest corresponding predicted score is determined as the sentiment classification result of the comment text data.

7. The method according to claim 1, characterized in that, Before inputting the comment text data into a preset language model to obtain the first feature vector of the character text and the second feature vector of the emoticon text, the method further includes: Obtain the first sample of comment text data without task tags and the second sample of comment text data with task tags; The initial language representation model was pre-trained using the preprocessed first sample comment text data; When the initial language representation model is pre-trained, the initial language representation model is fine-tuned using the pre-processed second sample comment text data to obtain the preset language model.

8. The method according to claim 7, characterized in that, The process of pre-training an initial language representation model using preprocessed first sample comment text data includes: The preprocessed first sample comment text data is segmented into words to obtain a sample text sequence; By training the sample text sequence with random masking, the model parameters of the initial language representation model are updated, and the loss value is calculated. When the loss value reaches the model convergence requirement, the initial language representation model pre-training is considered complete.

9. The method according to claim 7, characterized in that, The second sample comment text data is configured with a masking region, and the task label is used to annotate the character text features or emoji text features corresponding to the masking region; When the initial language representation model pre-training is complete, the initial language representation model is fine-tuned using preprocessed second sample comment text data to obtain a preset language model, including: Input the second sample comment text data into the pre-trained initial language representation model to obtain the feature prediction results of the covered area; If the accuracy of the feature prediction result is greater than a preset threshold based on the task label, then the initial language representation model is determined as the preset language model. If the accuracy of the feature prediction result is less than or equal to a preset threshold based on the task label, the initial language representation model is repeatedly fine-tuned using the task label data so that the initial language representation model meets the preset fine-tuning standard.

10. An emotion classification device, characterized in that, include: The extraction module is configured to extract comment text data that includes character text and emoji text; The determining module is configured to input the comment text data into a preset language model to obtain a first feature vector of the character text and a second feature vector of the emoticon text, wherein the preset language model is a language representation model obtained by pre-training using a first sample comment text data without task labels and fine-tuning using a second sample comment text data with task labels. The processing module is configured to perform sentiment enhancement processing on the first feature vector according to a preset sentiment dictionary to obtain the third feature vector of the character text; The input module is configured to input the concatenated feature vector of the third feature vector and the second feature vector into the fully connected layer of the preset language model to obtain the sentiment classification result corresponding to the comment text data; The step of inputting the comment text data into a preset language model to obtain the first feature vector of the character text and the second feature vector of the emoticon text includes: The character text and the emoji text in the comment text data are each individually masked; Input the comment text data after covering the character text into a preset language model to obtain the first feature vector of the character text; The comment text data after the emoticon text is covered is input into a preset language model to obtain the second feature vector of the emoticon text.

11. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the emotion classification method as described in any one of claims 1 to 9.

12. A storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the emotion classification method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Text emotion recognition method and device, electronic equipment and readable storage medium

    CN113609865A

  • Model training method, analysis method, device, equipment and medium

    CN114357170A

  • Course comment text sentiment analysis method and system based on deep learning

    CN114548111A