Method and System for High-Accuracy Emotion Judgment and Negative Data Recall
Through the emotion judgment model combined with deep neural network and shallow neural network, the problem of low accuracy of emotion analysis in the existing technology is solved, and high-accuracy emotion judgment and negative data recall are achieved, adapting to user emotional changes and improving user experience.
Patent Information
- Application Number
- CN202411138731.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2044-08-19
AI Technical Summary
The existing emotion analysis methods have low accuracy when dealing with complex sentence patterns, metaphors and satire, and it is difficult to efficiently identify users' emotional tendencies, especially negative emotions.
The emotion judgment model combined with deep neural network and shallow neural network is adopted, and the emotion judgment and negative data recall are achieved through text word segmentation, feature extraction, preliminary and deep emotion classification models, combined with model integration and data enhancement.
The emotional judgment accuracy rate is more than 90% and the negative data recall rate is more than 95%, which can quickly respond to user emotional changes, adapt to new emotional expression methods, and maintain the long-term effectiveness and accuracy of the model.
Smart Images

Figure CN119088964B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sentiment analysis, and particularly to a method and system for high-accuracy sentiment determination and negative data recall. Background Art
[0002] In recent years, with the rapid development of the Internet and social media, a large amount of user-generated content (UGC) has emerged on various platforms. The text data published by users on platforms such as social media, forums, and online reviews contains their emotions, opinions, and attitudes. How to automatically extract emotional information from this large amount of text data and accurately identify the emotional tendencies of users has become an important research direction in the field of natural language processing (NLP). This technology is not only widely used in business decision-making and market analysis, but also plays an important role in user experience optimization, product recommendation, etc.
[0003] Sentiment Analysis, also known as sentiment classification or opinion mining, is a process of identifying, extracting, and analyzing subjective information through technologies such as natural language processing, text analysis, and computational linguistics. Traditional sentiment analysis methods are mostly based on sentiment dictionaries and rules, relying on predefined sentiment words and grammar rules to judge sentiment tendencies. However, these methods perform poorly in dealing with complex sentence patterns, metaphors, irony, etc., and have low accuracy. Summary of the Invention
[0004] To solve the above technical problems, the present invention proposes a method and system for high-accuracy sentiment determination and negative data recall to solve at least one of the above technical problems.
[0005] The present application provides a method for high-accuracy sentiment determination and negative data recall, the method comprising:
[0006] S1. Obtain user text data, and perform text tokenization on the user text data to obtain user text tokenization data;
[0007] S2. Extract features from the user text tokenization data to obtain text tokenization feature data;
[0008] S3. Construct a preliminary sentiment classification model for the text tokenization data to obtain a preliminary sentiment classification model, and construct a deep sentiment classification model for the text tokenization feature data to obtain a deep sentiment classification model; integrate the preliminary sentiment classification model and the deep sentiment classification model to obtain a sentiment determination model;
[0009] S4. Obtain real-time user text data, and use the sentiment determination model to determine the sentiment of the real-time user text data to obtain sentiment classification label data, where the sentiment classification label data includes positive sentiment label data, negative sentiment label data, and neutral sentiment label data;
[0010] S5. Extract negative data according to the negative sentiment label data in the sentiment classification label data to obtain user negative text data; perform clustering processing on the user negative text data to obtain negative text feature data; perform negative data enhancement according to the negative text feature data to obtain negative text feature enhanced data for sentiment determination model optimization operations.
[0011] In the present invention, the system currently runs two sets of sentiment determination models, namely a deep neural network and a shallow neural network, achieving an accuracy rate of over 90% for sentiment determination of all data and a recall rate of over 95% for negative data; at the same time, the staff continuously adds more training data to train and optimize the sentiment model to achieve a higher sentiment determination accuracy rate. By continuously obtaining new negative sentiment data and using it for model training and optimization, it is ensured that the sentiment determination model can adapt to new sentiment expression methods and user behavior changes, and can maintain the long-term effectiveness and accuracy of the model. The rapid recognition and processing of negative sentiment in the present invention can quickly respond to user dissatisfaction and improve the user experience.
[0012] Optionally, S1 includes:
[0013] Obtain user text data;
[0014] Perform word boundary detection on the user text data to obtain text word boundary data;
[0015] Perform disambiguation on the text word boundary data to obtain text disambiguation data;
[0016] Perform out-of-vocabulary word processing on the text disambiguation data and the preset word segmentation dictionary data to obtain text new word data;
[0017] Perform word segmentation on the text new word data to obtain user text segmented data.
[0018] In the present invention, accurately detecting word boundaries in text can effectively segment coherent text into independent words or phrases, which is the basis for subsequent natural language processing tasks. Especially in languages without obvious boundaries (such as Chinese), word boundary detection is particularly important. After word boundary detection, there may be multiple ways to segment words in the text. The disambiguation step selects the most appropriate word segmentation method through context information, reducing misunderstandings caused by ambiguous words and improving the accuracy of word segmentation, which is particularly beneficial for languages with rich word meanings and strong context dependence. In the preset word segmentation dictionary, some words may not exist, especially emerging words, proper nouns, or misspelled words. The out-of-vocabulary word processing step can identify and include new words by detecting and processing these words, thereby increasing the vocabulary coverage and adaptability of the model. Combining the preset word segmentation dictionary for word segmentation processing helps ensure the accurate segmentation of common words and specific domain terms. By processing new words and out-of-vocabulary words, the dictionary can be dynamically updated, enabling the system to remain efficient and accurate when facing new text data. Due to considering disambiguation and out-of-vocabulary word processing, the word segmentation results can better retain context information, thus providing more accurate input for subsequent tasks such as sentiment analysis and topic modeling. The out-of-vocabulary word processing enables the system to dynamically adapt to language changes and the introduction of new words, especially in real-time updated content such as social media and news, enabling the system to keep up with the times. From word boundary detection to the final word segmentation, each step is interrelated, ensuring the coherence and accuracy of the word segmentation results, helping to reduce the occurrence of mis-segmentation and improving the quality of text analysis.
[0019] Optionally, S2 includes:
[0020] Performing word vector conversion on the user text word segmentation data to obtain word vector data;
[0021] Performing inverse document frequency calculation on the word vector data to obtain inverse document frequency data;
[0022] Constructing a syntax tree based on the word vector data to obtain syntax tree data;
[0023] Performing topic modeling on the inverse document frequency data to obtain topic distribution data;
[0024] Performing sentiment dictionary matching based on the user text word segmentation data to obtain word segmentation sentiment feature data;
[0025] Performing dependency relationship analysis based on the word vector data to obtain word segmentation dependency relationship feature data;
[0026] Performing sentiment intensity calculation based on the word segmentation sentiment feature data to obtain user text sentiment feature data;
[0027] Integrate the inverse document frequency data, syntax tree data, topic distribution data, word segmentation dependency relationship feature data, and user text sentiment feature data to obtain text word segmentation feature data.
[0028] In the present invention, by converting text word segmentation data into word vectors, the words in the text are mapped into a high-dimensional vector space, capturing the semantic relationships between words. This provides a semantic basis for subsequent analysis tasks. By calculating the importance of words in a document, TF-IDF can effectively distinguish common words and discriminative keywords, identifying words that are significantly meaningful in the text. Syntax tree analysis reveals the syntactic structure of sentences, helping to understand complex grammatical relationships in the text, which is of great help for more in-depth language understanding and analysis, such as semantic analysis and information extraction. Through topic modeling (such as LDA), the main topics in the text can be identified, helping to understand the macro content and topic distribution of the text, which is very useful for text classification, clustering, and topic analysis. By matching the words in the text with a sentiment dictionary, the sentiment features of the text are extracted, providing direct support for sentiment analysis and sentiment classification. Dependency relationship analysis reveals the grammatical relationships between words in the text, especially the subject-predicate-object structure, modification relationships, etc., which is of great significance for understanding the core semantic structure of sentences. By calculating the sentiment intensity of the text based on the sentiment feature data, the polarity and intensity of the sentiment are quantified, providing support for more fine-grained sentiment analysis.
[0029] Optionally, the construction of the preliminary sentiment classification model includes:
[0030] Perform data balancing based on the text word segmentation feature data to obtain feature-balanced data;
[0031] Perform batch processing input layer processing based on the feature-balanced data to obtain feature input layer data;
[0032] Perform word vector embedding layer processing on the feature input layer data to obtain feature word vector embedding layer data;
[0033] Perform convolutional layer processing on the feature word vector embedding layer data to obtain feature convolutional layer data;
[0034] Perform activation layer calculation on the feature convolutional layer data to obtain feature activation layer data;
[0035] Perform pooling layer processing on the feature activation layer data to obtain feature pooling layer data;
[0036] Perform feature splicing on the feature pooling layer data to obtain feature splicing data;
[0037] Perform fully connected layer processing based on the feature splicing data to obtain feature fully connected layer data;
[0038] Process the data of the feature fully connected layer through the output layer to obtain the feature category probability data;
[0039] Optimize and iterate the feature category probability data based on the text tokenization feature data to obtain a preliminary sentiment classification model.
[0040] In the training data of the present invention, the sentiment categories may be unbalanced (for example, the positive sentiment data is much more than the negative sentiment data), which may cause the model to be biased towards the majority class. The data balancing step balances the dataset by oversampling the minority class or undersampling the majority class. It improves the model's recognition ability for the minority class (such as negative sentiment), prevents the model from being overly biased towards the majority class, and enhances the fairness and generalization ability of the model. Batch processing makes the training process more efficient and stable, reduces the memory pressure, and at the same time helps to optimize the convergence speed of algorithms (such as SGD). Utilizing the semantic expression ability of word vectors can better understand and represent the semantic information in the text, providing rich semantic features for subsequent feature extraction. The convolutional layer can efficiently capture local patterns and features in the text, such as phrase-level sentiment expressions, and improve the sensitivity to local features. The activation layer introduces non-linearity to help the model capture complex sentiment patterns, improving the model's expression ability and classification accuracy. The pooling layer reduces the dimension of the features, reduces the computational complexity, and at the same time retains the key features to prevent overfitting. Feature concatenation combines the features extracted by different convolutional kernels to form a richer feature representation, which helps to capture various feature information of the text. The fully connected layer maps the high-dimensional features to the category space, which helps the final decision of the classification task and extracts global feature information. The probability distribution of the output layer makes the classification result interpretable and helps to judge the confidence of the classification. Continuously optimize the performance of the model, improve the classification accuracy, gradually reduce the classification error through iterative training, and improve the generalization ability of the model.
[0041] Optionally, the construction of the deep sentiment classification model includes:
[0042] Perform word sequence input layer processing on the text tokenization feature data to obtain the feature word sequence input layer data;
[0043] Perform word vector embedding on the feature word sequence input layer data to obtain the feature word embedding data;
[0044] Perform hidden layer processing on the feature word embedding data to obtain the feature hidden layer data;
[0045] Perform linear output layer processing on the feature hidden layer data to obtain the feature linear output layer data;
[0046] Optimize and iterate the feature linear output layer data based on the text tokenization feature data to obtain the construction of the deep sentiment classification model.
[0047] In the present invention, the multi-layer hidden layer processing can extract complex features and emotional patterns in the text, improving the accuracy of emotional classification. The word vector embedding provides rich semantic information, enabling the model to better understand and process the emotional expressions in the text. The linear output layer maps the high-dimensional features to specific categories, providing clear classification results and probability distributions, which helps in result interpretation. The optimization iteration process continuously adjusts the model to enhance its performance and generalization ability in practical applications.
[0048] Optionally, the hidden layer processing includes:
[0049] Performing multi-scale convolution processing on the feature word embedding data to obtain feature word multi-scale convolution data;
[0050] Performing multi-dimensional activation calculation on the feature word multi-scale convolution data to obtain feature multi-dimensional activation data;
[0051] Performing global-local pooling processing on the feature multi-dimensional activation data to obtain feature global-local pooling data;
[0052] Performing multi-head self-attention processing on the feature global-local pooling data to obtain feature multi-head attention data;
[0053] Performing dense connection on the feature multi-head attention data to obtain feature dense connection data;
[0054] Serializing the feature dense connection data to obtain feature serialized data;
[0055] Performing instance normalization processing on the feature serialized data to obtain feature hidden layer data.
[0056] In the present invention, the multi-scale convolution can capture different local features in the text, such as phrases, sentence structures, etc. Convolution kernels of different scales can identify multi-level information in the text, enabling the model to more comprehensively understand the text content and emotional expression. The activation function introduces non-linearity, enabling the model to learn more complex feature relationships and patterns. This is very important for processing complex emotional expressions and identifying emotional nuances. Global pooling can capture the overall features of the entire sentence, while local pooling can retain more fine-grained local information, providing a richer and more refined feature representation, which helps improve the model's ability to identify different emotions. The multi-head self-attention can identify long-range dependencies in the text, enabling the model to focus on different parts of the text, enhancing the model's sensitivity to emotional cues, and helping to identify implicit emotional information and complex emotional patterns. Dense Connection can promote the transmission and reuse of features, enhancing the diversity of feature representations. This structure helps the model capture more detailed information and improve the comprehensiveness of feature expression. Serialization helps to manage features in a structured manner, enabling subsequent processing to better utilize these features, helps the model retain the order information of input features, and enhances the understanding of text structure. Instance normalization can reduce the heterogeneity of data, balance the feature scales of different instances, help improve the training stability and convergence speed of the model, and enhance the generalization ability of the model on different input data.
[0057] Optionally, the model integration includes:
[0058] Performing weighted average integration on the preliminary sentiment classification model and the deep sentiment classification model to obtain the integrated model output data;
[0059] Adding an output probability screening layer based on the integrated model output data, the preliminary sentiment classification model, and the deep sentiment classification model to obtain the sentiment determination model.
[0060] In the present invention, the weighted average integration can utilize the advantages of different models and make up for the deficiencies of a single model. For example, the preliminary sentiment classification model may be better at quickly capturing simple emotional features, while the deep sentiment classification model can deeply extract complex emotional features. Through weighted average, a more comprehensive classification result can be obtained. By combining the outputs of multiple models, the integrated model can usually improve the overall classification accuracy. The weighted average can assign different weights according to the performance of each model to optimize the final result. The output probability screening layer can set a threshold to filter out prediction results with low confidence, improving the final prediction quality. For example, if the prediction probabilities of all classes are lower than a certain threshold, the sample can be marked as "uncertain" to avoid misjudgment. Through the processing of the screening layer, more fine-grained sentiment classification information is provided, such as the confidence of the classification result, the most likely class and its alternative classes, etc.
[0061] Optionally, S4 includes:
[0062] Obtain real-time user text data, and use a sentiment determination model to determine the sentiment of the real-time user text data to obtain sentiment probability distribution data, where the sentiment probability distribution data includes preliminary sentiment classification probability data, in-depth sentiment classification probability data, and sentiment determination data;
[0063] Calculate the sentiment probability similarity based on the preliminary sentiment classification probability data, in-depth sentiment classification probability data, and sentiment determination data to obtain sentiment probability similarity data;
[0064] When it is determined that the sentiment probability similarity data is less than or equal to the preset sentiment probability similarity threshold data, then integrate the preliminary sentiment classification probability data, in-depth sentiment classification probability data, and sentiment determination data to obtain sentiment classification label data;
[0065] When it is determined that the sentiment probability similarity data is greater than the preset sentiment probability similarity threshold data, then vote based on the preliminary sentiment classification probability data, in-depth sentiment classification probability data, and sentiment determination data to obtain sentiment classification label data.
[0066] In the present invention, through the output and integration of multiple models, the credibility and stability of the sentiment classification result are ensured. The similarity calculation and voting mechanism help to effectively handle the differences between different models and provide a reasonable solution. Real-time acquisition and analysis of user text data can timely respond to sentiment changes and can adjust the decision-making mechanism according to actual needs. By combining multiple decision-making strategies, the robustness and adaptability of the model in dealing with complex sentiment expressions and fuzzy sentiment states are improved.
[0067] Optionally, S5 includes:
[0068] Extract negative data according to the negative sentiment label data in the sentiment classification label data to obtain user negative text data;
[0069] Extract features from the user negative text data to obtain user negative text feature data;
[0070] Perform clustering processing on the user negative text feature data to obtain negative text feature data;
[0071] Perform cluster area screening on the negative text feature data to obtain negative text feature screening data;
[0072] Perform cluster analysis on the negative text feature screening data to obtain negative text pattern data;
[0073] Perform data expansion on the negative text pattern data to obtain negative text expansion data;
[0074] Merge the negative text extension data and the user negative text data, and perform feature extraction to obtain enhanced negative text feature data for optimizing the sentiment determination model.
[0075] In the present invention, multi-level clustering and pattern analysis help to identify and understand the diversity and complexity of negative sentiment. Cluster area screening and data merging ensure the representativeness of the analysis and the quality of the data, reducing noise. Data extension increases the diversity of training data, improving the robustness and generalization ability of the model. By constructing more comprehensive negative sentiment feature data, it provides richer inputs for the training and optimization of the model, improving the accuracy and effectiveness of sentiment determination.
[0076] Optionally, a high-accuracy sentiment determination and negative data recall system for performing the high-accuracy sentiment determination and negative data recall method as described above, the high-accuracy sentiment determination and negative data recall system includes:
[0077] A user text tokenization module for obtaining user text data and tokenizing the user text data to obtain user text tokenized data;
[0078] A text tokenization feature extraction module for extracting features from the user text tokenized data to obtain text tokenization feature data;
[0079] A sentiment determination model construction module for constructing a preliminary sentiment classification model for the text tokenized data to obtain a preliminary sentiment classification model, and constructing a deep sentiment classification model for the text tokenization feature data to obtain a deep sentiment classification model; integrating the preliminary sentiment classification model and the deep sentiment classification model to obtain a sentiment determination model;
[0080] A real-time user text sentiment determination module for obtaining real-time user text data and using the sentiment determination model to perform sentiment determination on the real-time user text data to obtain sentiment classification label data, where the sentiment classification label data includes positive sentiment label data, negative sentiment label data, and neutral sentiment label data;
[0081] A negative data recall optimization module for extracting negative data according to the negative sentiment label data in the sentiment classification label data to obtain user negative text data; performing clustering processing on the user negative text data to obtain negative text feature data; performing negative data enhancement on the negative text feature data to obtain enhanced negative text feature data for optimizing the sentiment determination model.
[0082] The purpose of the present invention is:
[0083] 1. Through multi-level feature extraction, subtle emotional changes and deep semantic information in the text can be captured, providing a more accurate basis for sentiment analysis. The efficient execution of the word segmentation and feature extraction processes ensures the performance and efficiency of the system when dealing with large-scale data.
[0084] 2. For the shallow judgment model, a preliminary integration of fasttext and textcnn or one of them is adopted. For the deep judgment model, multi-head attention is used, which can be cnn + mutilhead or encoder-decoder, realizing a multi-level understanding of text sentiment. The preliminary model is good at capturing simple emotional features, while the deep model can identify more complex emotional patterns. The outputs of different models are weighted and averaged, and at the same time, the final classification result is optimized through the output probability screening layer, combining the advantages of multiple models and improving the accuracy and robustness of sentiment judgment.
[0085] 3. Real-time processing and judgment of user sentiment enable the system to quickly respond to changes in the user's emotional state and adapt to a dynamic user interaction environment. Support for real-time data stream processing can update sentiment analysis results in a timely manner when the data source changes. Through data augmentation and feature merging, the model can learn more diverse negative emotional expressions, enhancing the adaptability and generalization ability of the model in different emotional scenarios. The model can continuously adjust and optimize according to new data and emotional patterns, improving the long-term stability and accuracy of the system. By accurately identifying and responding to the user's negative emotions, it helps enterprises or platforms quickly handle user dissatisfaction and improve user experience and satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] Other features, objectives, and advantages of this application will become more apparent by reading the detailed description of the non-restrictive embodiments with reference to the following drawings:
[0087] Figure 1 The flowchart of the steps of a high-accuracy sentiment judgment and negative data recall method according to an embodiment is shown;
[0088] Figure 2 The flowchart of the steps of a user text word segmentation method according to an embodiment is shown;
[0089] Figure 3 The flowchart of the steps of a text word segmentation feature extraction method according to an embodiment is shown;
[0090] Figure 4 The flowchart of the steps of a real-time user text sentiment judgment method according to an embodiment is shown;
[0091] Figure 5 The flowchart of the steps of a negative data recall optimization method according to an embodiment is shown;
[0092] The realization, functional features and advantages of the present invention will be further described in conjunction with embodiments with reference to the accompanying drawings. Specific Embodiments
[0093] The technical method of the present invention for the patent will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0094] In addition, the accompanying drawings are only schematic diagrams of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor methods and / or microcontroller methods.
[0095] It should be understood that although the terms "first", "second", etc. may be used here to describe each unit, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, the first unit can be called the second unit, and similarly the second unit can be called the first unit. The term "and / or" used here includes any and all combinations of one or more of the listed associated items.
[0096] Please refer to Figures 1 to 5 , the present application provides a method for high-accuracy sentiment determination and negative data recall, and the method includes:
[0097] S1. Obtain user text data, and perform text tokenization on the user text data to obtain user text tokenization data;
[0098] Specifically, obtain the text data input by the user through the user interface, API, or file import, etc. Remove stop words, punctuation marks, special characters, etc., and perform normalization processing on the text. Use a tokenization algorithm (such as jieba tokenization, LTP, SnowNLP, etc.) to split the text into a list of words.
[0099] S2. Extract features from the user text tokenization data to obtain text tokenization feature data;
[0100] Specifically, convert the tokenized text data into vector representations (such as Word2Vec, GloVe, BERT, etc.). Extract specific features, such as term frequency (TF), inverse document frequency (IDF), part-of-speech tagging, etc.
[0101] S3. Construct a preliminary sentiment classification model for the tokenized data of this article to obtain a preliminary sentiment classification model, and construct a deep sentiment classification model for the text tokenization feature data to obtain a deep sentiment classification model; integrate the preliminary sentiment classification model and the deep sentiment classification model to obtain a sentiment determination model.
[0102] Specifically, the deep sentiment classification model is a deep neural network and the preliminary sentiment classification model is a shallow neural network. Integrate the preliminary sentiment classification model and the deep sentiment classification model (such as adding a voting layer) to obtain a sentiment determination model.
[0103] The deep / shallow neural network can be constructed by the FastText algorithm or the TextCNN algorithm. FastText is a fast text classification model based on word embeddings and a linear classifier. It quickly calculates the text representation by averaging word vectors and uses a linear classifier for classification. Tokenize and remove stop words from the text. Use FastText to convert the tokenized text into word vectors and calculate the average word vector. Use the average word vector as a feature to train a linear classifier (such as logistic regression or linear support vector machine). Evaluate the performance of the model and adjust the hyperparameters to improve the model accuracy.
[0104] TextCNN is a text classification model based on convolutional neural networks (CNNs). It extracts local features in the text through multiple convolutional kernels and uses a fully connected layer for classification. Tokenize the text and convert it into word vectors. Use multiple convolutional kernels to extract text features. Use the max pooling layer to extract important features. Use the fully connected layer for classification. Train the TextCNN model with the training data. Evaluate the performance of the model and adjust the hyperparameters to improve the model accuracy.
[0105] Specifically, divide the tokenized data of this article into a training dataset and a test dataset.
[0106] Perform convolutional calculations on the training dataset to obtain the convolutional layer data of the training data.
[0107] Perform multi-head attention calculations on the convolutional layer data of the training data to obtain the multi-head self-attention layer data of the training data.
[0108] Perform pooling processing on the multi-head self-attention layer data of the training data to obtain the pooling layer data of the training data.
[0109] Perform a fully connected calculation on the pooled data of the training data to obtain the fully connected layer data of the training data;
[0110] Perform an exponential calculation on the fully connected layer data of the training data and perform iterative training through the test data set to obtain an emotion determination model.
[0111] Specifically, construct a deep neural network model for the word segmentation data of this article to obtain a preliminary emotion classification model; construct a deep emotion classification model with a multi-head attention layer for the text segmentation feature data to obtain a deep emotion classification model; add a voting layer to the preliminary emotion classification model and the deep emotion classification model to obtain an emotion determination model.
[0112] S4. Obtain real-time user text data, and use the emotion determination model to perform emotion determination on the real-time user text data to obtain emotion classification label data, where the emotion classification label data includes positive emotion label data, negative emotion label data, and neutral emotion label data;
[0113] Specifically, obtain the text data newly input by the user through a real-time interface. Use the emotion determination model to perform emotion classification on the real-time text data and output emotion classification labels.
[0114] S5. Extract negative data according to the negative emotion label data in the emotion classification label data to obtain user negative text data; perform clustering processing on the user negative text data to obtain negative text feature data; perform negative data enhancement according to the negative text feature data to obtain negative text feature enhancement data for emotion determination model optimization operations.
[0115] Specifically, screen out the text data with negative emotions from the classification labels. Perform clustering processing (such as K-means, DBSCAN, etc.) on the negative text data to identify different negative emotion themes. Perform feature enhancement on the clustering results (such as adjusting the word weights of negative texts, generating reverse words, etc.). Use the enhanced negative text feature data to update and optimize the emotion determination model.
[0116] Specifically, obtain user comment data from the platform. Use a word segmentation tool to perform word segmentation on the comment data. Use TF-IDF to extract features from the segmented text. Construct a preliminary emotion classification model and a deep emotion classification model, and integrate the two models to obtain an emotion determination model.
[0117] Obtain the latest real-time user comment data from the platform, use the integrated model to perform emotion classification on the real-time user comment data to obtain classification labels. Extract the comments with negative emotions, perform feature extraction and clustering processing. Perform data enhancement and input it into the model for further training to improve the performance of the emotion determination model.
[0118] In the present invention, the system currently runs two sets of sentiment determination models, namely, a deep neural network and a shallow neural network, achieving an accuracy rate of over 90% for sentiment determination of all data and a recall rate of over 95% for negative data. At the same time, the staff continuously adds more training data to train and optimize the sentiment model to achieve a higher sentiment determination accuracy rate. By continuously obtaining new negative sentiment data and using it for model training and optimization, it is ensured that the sentiment determination model can adapt to new sentiment expression methods and user behavior changes, and can maintain the long-term effectiveness and accuracy of the model. The rapid identification and processing of negative sentiment in the present invention can quickly respond to user dissatisfaction and improve the user experience.
[0119] Optionally, S1 includes:
[0120] S11. Obtain user text data;
[0121] Specifically, obtain user text data through user input interfaces, APIs, file imports, etc.
[0122] S12. Perform word boundary detection on the user text data to obtain text word boundary data;
[0123] Specifically, use algorithms based on statistical models or rules for word boundary detection, such as conditional random fields (CRFs), hidden Markov models (HMMs), etc.
[0124] Conditional random fields (CRFs) are a type of probabilistic graphical model used for labeling and segmenting sequential data. In word boundary detection, CRFs can be used to predict the position labels of each character, such as "this" (start of a word), "of" (inside a word), ". " (end of a word), "goods" (a separate word), etc. Extract features for each character, such as surrounding characters, the part of speech of the character, whether it is a number, whether it is punctuation, etc. Use the labeled text data to train the CRF model to learn the labeling patterns of character sequences. Perform labeling prediction on the newly input text to generate a word boundary label sequence.
[0125] Hidden Markov models (HMMs) are a type of statistical model that models through the transition probabilities between states and the emission probabilities of each state. In word boundary detection, HMMs take word boundary labels as hidden states and characters as observations. Extract the observation features of characters. Use the labeled data to estimate the state transition probabilities and emission probabilities. Use the Viterbi algorithm to find the most likely word boundary label sequence.
[0126] S13. Disambiguate the text word boundary data to obtain text disambiguation data;
[0127] Specifically, use methods such as context analysis and lexical part-of-speech tagging for disambiguation, such as semantic-based algorithms, neural network models (such as BERT), etc.
[0128] By analyzing the context information of words and the part-of-speech of vocabulary, determine the exact meaning of words with multiple interpretations. This method can use a rule-based system or combine statistical and machine learning methods, such as using a part-of-speech tagger and a context window for analysis. Tokenize and perform part-of-speech tagging on the text. Combine the context information and determine the specific meaning of words through rules or models. Use lexical part-of-speech tagging and semantic information to determine the correct meaning of each word.
[0129] Utilize the pre-trained BERT model to obtain the embedding vectors of words through the context, and then perform semantic matching to resolve ambiguity. Neural network models such as BERT can capture the nuances of words through the context and give more accurate word meanings. Tokenize and encode the text to meet the input requirements of the BERT model. Input the sentence to obtain the context embedding vectors of each word. Resolve semantics by matching the embedding vectors of words and predefined semantic vectors.
[0130] S14. Perform out-of-vocabulary processing on the text disambiguation data and the preset tokenization dictionary data to obtain new text word data;
[0131] Specifically, adopt an out-of-vocabulary detection algorithm, such as a rule-based method based on dictionary matching, a statistical method, or a neural network model.
[0132] S15. Perform word segmentation on the new text word data to obtain user text tokenization data.
[0133] Specifically, use a word segmentation algorithm (such as the Viterbi algorithm based on the maximum probability path, the word segmentation algorithm based on bidirectional maximum matching, etc.) to perform word segmentation.
[0134] The Viterbi algorithm is a dynamic programming algorithm widely used to solve the optimal path problem. In word segmentation, the Viterbi algorithm can find the most likely word segmentation path through a probability model. Build a dictionary using a large corpus and calculate the occurrence probability of each word. Define the state transition probability and the emission probability. The state transition probability is the probability of transitioning from one word to the next word. The emission probability is the probability of generating a character sequence given a word. Use dynamic programming to find the optimal word segmentation path.
[0135] The bidirectional maximum matching (BiMM) algorithm combines the forward maximum matching (FMM) and the reverse maximum matching (RMM), and improves the word segmentation accuracy by comparing the word segmentation results of the two methods. The forward maximum matching (FMM) scans the text from left to right and matches the longest word each time. The reverse maximum matching (RMM) scans the text from right to left and matches the longest word each time. Compare the results of the two methods and select the result with fewer segmented words, or select the optimal result according to other rules.
[0136] Specifically, the new word data of the text is segmented to obtain the user text word segmentation data, where the word segmentation is calculated through the word segmentation calculation formula. The word segmentation calculation formula is specifically as follows:
[0137]
[0138] S(w i ) is the segmentation score data of the word w i . The higher the score, the greater the probability of this word segmentation path. exp is the exponential function, and u i is the mean data of the word w i in the Gaussian distribution, and σ i is the mean and standard deviation of the word w i in the Gaussian distribution. P(w i |w i-1 ) is the conditional probability of the word w i given the previous word w i-1 . w i is the i-th new word data of the text, and θ i is the context angle of the word w i , which is used to introduce the directional information of the word in the context.
[0139] In the present invention, accurately detecting word boundaries in text can effectively segment coherent text into independent words or phrases, which is the basis for subsequent natural language processing tasks. Especially in languages without obvious boundaries (such as Chinese), word boundary detection is particularly important. After word boundary detection, there may be multiple ways to segment words in the text. The disambiguation step selects the most appropriate word segmentation method through context information, reducing misunderstandings caused by ambiguous words and improving the accuracy of word segmentation, which is particularly beneficial for languages with rich word meanings and strong context dependence. In the preset word segmentation dictionary, some words may not exist, especially emerging words, proper nouns, or misspelled words. The out-of-vocabulary word processing step can identify and include new words by detecting and processing these words, thereby increasing the vocabulary coverage and adaptability of the model. Combining with the preset word segmentation dictionary for word segmentation processing helps to ensure the accurate segmentation of common words and specific domain terms. By processing new words and out-of-vocabulary words, the dictionary can be dynamically updated, enabling the system to remain efficient and accurate when facing new text data. Due to considering disambiguation and out-of-vocabulary word processing, the word segmentation results can better retain context information, thus providing more accurate input for subsequent tasks such as sentiment analysis and topic modeling. The out-of-vocabulary word processing enables the system to dynamically adapt to language changes and the introduction of new vocabulary, especially in real-time updated content such as social media and news, enabling the system to keep up with the times. From word boundary detection to the final word segmentation, each step is interrelated, ensuring the coherence and accuracy of the word segmentation results, helping to reduce the occurrence of mis-segmented words, and improving the quality of text analysis.
[0140] Optionally, S2 includes:
[0141] S21. Perform word vector conversion on the user text word segmentation data to obtain word vector data;
[0142] Specifically, use a pre-trained word vector model (such as Word2Vec, GloVe, BERT, etc.) to convert the word segmentation data into a vector representation.
[0143] S22. Perform inverse document frequency calculation on the word vector data to obtain inverse document frequency data;
[0144] Specifically, calculate the TF-IDF value, count the frequency of the term in the document set, and calculate the inverse document frequency (IDF).
[0145] S23. Construct a syntax tree based on the word vector data to obtain syntax tree data;
[0146] Specifically, use a syntax parsing algorithm (such as dependency syntax analysis, phrase structure tree, etc.) to construct a syntax tree structure.
[0147] S24. Perform topic modeling on the inverse document frequency data to obtain the topic distribution data;
[0148] Specifically, use a topic modeling algorithm (such as LDA, PCA, etc.) to extract the topic distribution of the text. First, perform preprocessing on the text, such as word segmentation, stop word removal, and lemmatization. Use the bag-of-words model to convert the text data into a word frequency matrix or a TF-IDF matrix. Use the LDA algorithm to train the word frequency matrix and extract a specified number of topics. Calculate the distribution of each topic in each document, that is, the topic distribution data.
[0149] Perform word segmentation, stop word removal, and lemmatization on the text. Represent the document using the bag-of-words model or the TF-IDF matrix. Use PCA to reduce the dimension of the TF-IDF matrix and extract the main components. The projection value of each document on the main components is the topic distribution data.
[0150] S25. Perform sentiment dictionary matching based on the user text word segmentation data to obtain the word segmentation sentiment feature data;
[0151] Specifically, use a predefined sentiment dictionary to match the sentiment words in the text and extract the sentiment features.
[0152] S26. Perform dependency analysis based on the word vector data to obtain the word segmentation dependency feature data;
[0153] Specifically, use a dependency parsing algorithm (such as Stanford Parser) to perform dependency analysis between words. Perform word segmentation and part-of-speech tagging on the text. Convert the segmented words into word vector representations. If using pre-trained word vectors (such as Word2Vec, GloVe, etc.), directly look up the corresponding vectors. Use a dependency parsing algorithm or tool (such as StanfordParser, spaCy, etc.) to analyze the sentence structure and generate a dependency tree. The generated dependency tree is the syntactic tree data, which describes the dependency relationship between words.
[0154] S27. Calculate the sentiment intensity based on the word segmentation sentiment feature data to obtain the user text sentiment feature data;
[0155] Specifically, calculate the sentiment intensity of each sentiment word based on the sentiment dictionary and the sentiment intensity formula.
[0156] S28. Integrate the inverse document frequency data, syntactic tree data, topic distribution data, word segmentation dependency feature data, and user text sentiment feature data to obtain the word segmentation feature data.
[0157] Specifically, perform feature fusion on the inverse document frequency data, syntactic tree data, topic distribution data, word segmentation dependency feature data, and user text sentiment feature data.
[0158] In the present invention, by converting text tokenization data into word vectors, the words in the text are mapped into a high-dimensional vector space, capturing the semantic relationships between the words. This provides a semantic basis for subsequent analysis tasks. By calculating the importance of words in a document, TF-IDF can effectively distinguish common words and discriminative keywords, identifying words that are significantly meaningful in the text. Syntactic tree analysis reveals the syntactic structure of sentences, helping to understand the complex syntactic relationships in the text, which is of great help for deeper language understanding and analysis, such as semantic analysis and information extraction. By means of topic modeling (such as LDA), the main topics in the text can be identified, helping to understand the macro content and topic distribution of the text, which is very useful for text classification, clustering and topic analysis. By matching the words in the text with an emotion dictionary, the emotional features of the text are extracted, providing direct support for sentiment analysis and sentiment classification. Dependency analysis reveals the syntactic relationships between the words in the text, especially the subject-predicate-object structure, modification relationships, etc., which is of great significance for understanding the core semantic structure of sentences. By calculating the emotional intensity of the text based on the emotional feature data, the polarity and intensity of the emotion are quantified, providing support for more fine-grained sentiment analysis.
[0159] Optionally, the construction of the preliminary sentiment classification model includes:
[0160] Balancing the data according to the text tokenization feature data to obtain feature-balanced data;
[0161] Specifically, data balancing techniques such as undersampling, oversampling, SMOTE, etc. are used to balance the proportions of positive, negative, and neutral samples.
[0162] For the text tokenization feature data, the number of samples in different categories (such as positive, negative, neutral) is unbalanced. The minority class samples can be simply copied, or generative methods (such as SMOTE) can be used to generate new samples. The minority class samples are directly copied until their number is equal to the number of majority class samples. Or the synthetic minority over-sampling technique is used to generate new minority class samples by interpolation.
[0163] Performing batch processing input layer processing on the feature-balanced data to obtain feature input layer data;
[0164] Specifically, the balanced feature data is divided into batches and prepared for the input layer of the neural network. During the training process of the neural network, batch processing is a commonly used method. It divides the input data into multiple small batches and performs forward propagation and backward propagation on each batch. This method helps to improve the training efficiency, stabilize the gradient update, and make full use of the hardware resources.
[0165] The balanced feature data and corresponding classification labels obtained from the previous step. Set the number of samples included in each batch (such as 32, 64, etc.). Divide the balanced feature data and label data according to the batch size.
[0166] Perform word vector embedding layer processing on the feature input layer data to obtain feature word vector embedding layer data;
[0167] Specifically, use the embedding layer to transform the input features into a fixed-length word vector embedding representation. Word Embedding is a method of mapping discrete words to a continuous vector space, enabling the semantic relationships between words to be represented by the distance and direction between vectors, including Word2Vec, GloVe, and FastText.
[0168] The input data is usually preprocessed and tokenized text data. Convert the text data into index representation (i.e., each word corresponds to a unique index). Define the embedding layer to convert the input word indices into corresponding word vectors. The embedding layer looks up pre-trained or randomly initialized word vectors according to the word indices and maps them to a fixed-length vector representation.
[0169] The main role of the embedding layer is to convert the high-dimensional sparse word index representation into a low-dimensional dense word vector representation, enabling subsequent neural network layers to process text data more efficiently. The embedding layer captures the semantic relationships between words, enhancing the expressiveness and generalization ability of the model.
[0170] Perform convolutional layer processing on the feature word vector embedding layer data to obtain feature convolutional layer data;
[0171] Specifically, apply a one-dimensional convolutional layer (1D-CNN) to extract local context features. Apply multiple convolutional kernels (filters) to perform convolutional operations on the embedding layer data to extract local features. The convolutional kernels slide in the text, which can capture local n-gram features and help understand the context relationships between words.
[0172] Perform activation layer calculation on the feature convolutional layer data to obtain feature activation layer data;
[0173] Specifically, apply an activation function (such as ReLU) to introduce non-linearity. In a neural network, the activation function is used to introduce non-linearity, enabling the model to learn and represent more complex functions. Commonly used activation functions include ReLU (Rectified Linear Unit), Sigmoid, Tanh, etc. The ReLU activation function sets the part of the input value less than 0 to 0 and retains the part greater than 0. Apply the ReLU activation function element-wise to the feature convolutional layer data to obtain the feature activation layer data.
[0174] Perform pooling layer processing on the feature activation layer data to obtain feature pooling layer data;
[0175] Specifically, apply max pooling or average pooling to reduce the data dimension and prevent overfitting. Define a max pooling layer to downsample the output of the convolutional layer and extract important features. Define a global max pooling layer to take the maximum value of each feature map as the output and further extract features.
[0176] Perform feature concatenation on the feature pooling layer data to obtain feature concatenation data;
[0177] Specifically, concatenate the pooling layer data of multiple layers or channels to form a unified feature vector. In a neural network, feature concatenation is used to concatenate feature data from multiple layers or channels together to form a unified feature vector. Feature concatenation can effectively integrate multi-level information and improve the model's expressive ability and classification performance. Use the concatenation operation to merge the pooling layer data of multiple layers or channels.
[0178] Perform fully connected layer processing on the feature concatenation data to obtain feature fully connected layer data;
[0179] Specifically, use a dense layer to map the concatenated data to the output space. Define a fully connected layer to map the input features to the output space, such as using a linear transformation and an activation function to process the input features.
[0180] Perform output layer processing on the feature fully connected layer data to obtain feature class probability data;
[0181] Specifically, use the softmax activation function to calculate the probability of each class. The output layer is the last layer of the neural network and is used to generate the final prediction result. In a classification task, the softmax activation function is usually used to calculate the probability of each class. The softmax function converts the output of each neuron in the output layer into a probability value, and the sum of all probability values is 1.
[0182] Perform loss optimization and iteration on the feature class probability data according to the text tokenization feature data to obtain a preliminary sentiment classification model.
[0183] Specifically, use the cross-entropy loss function to calculate the loss and apply an optimization algorithm (such as Adam, SGD) for gradient descent and model parameter update.
[0184] In the training data of the present invention, the sentiment categories may be imbalanced (for example, the positive sentiment data is much more than the negative sentiment data), which may cause the model to be biased towards the majority class. The data balancing step balances the data set by oversampling the minority class or undersampling the majority class. It improves the model's recognition ability for the minority class (such as negative sentiment), prevents the model from being overly biased towards the majority class, and enhances the fairness and generalization ability of the model. Batch processing makes the training process more efficient and stable, reduces the memory pressure, and at the same time helps to optimize the convergence speed of algorithms (such as SGD). Utilizing the semantic expression ability of word vectors can better understand and represent the semantic information in the text, providing rich semantic features for subsequent feature extraction. The convolutional layer can efficiently capture local patterns and features in the text, such as phrase-level sentiment expressions, and improve the sensitivity to local features. The activation layer introduces non-linearity to help the model capture complex sentiment patterns, improving the model's expression ability and classification accuracy. The pooling layer reduces the dimension of the features, reduces the computational complexity, and at the same time retains the key features to prevent overfitting. Feature concatenation combines the features extracted by different convolutional kernels to form a richer feature representation, which helps to capture various feature information of the text. The fully connected layer maps the high-dimensional features to the category space, which helps the final decision of the classification task and extracts global feature information. The output layer probability distribution makes the classification result interpretable and helps to judge the confidence of the classification. Continuously optimize the performance of the model, improve the classification accuracy, gradually reduce the classification error through iterative training, and improve the generalization ability of the model.
[0185] Optionally, the construction of the deep sentiment classification model includes:
[0186] Perform word sequence input layer processing on the text tokenization feature data to obtain the feature word sequence input layer data;
[0187] Specifically, convert the text tokenization feature data into a fixed-length sequence data, and often use padding and truncation methods to process text sequences of different lengths.
[0188] Perform word vector embedding on the feature word sequence input layer data to obtain the feature word embedding data;
[0189] Specifically, use a pre-trained word vector model or a custom word vector layer to convert the word sequence into an embedding vector. The custom word vector layer is a technique that maps discrete words to a continuous vector space. Through this mapping, words can be represented as dense vectors of a fixed dimension, and these vectors capture the semantic relationships between words. The custom word vector layer is learned during the training process and can better adapt to specific tasks and domains. The input text data needs to be tokenized and indexed. Define an embedding layer to convert the word index into a word vector.
[0190] Perform a hidden layer process on the feature word embedding data to obtain the feature hidden layer data;
[0191] Specifically, use a deep learning model (such as RNN, LSTM, GRU, etc.) to process the sequence data and extract time and context features.
[0192] Specifically, use an encoder and a decoder for in-depth processing. Sequence encoding: The encoder converts the input sequence into a fixed-length vector to capture the global information of the sequence. Sequence decoding: The decoder uses the context vector to generate the output sequence, capturing the local information and dependencies of the sequence.
[0193] Convert the input word indices into a fixed-length word vector representation. Use an LSTM encoder to encode the input sequence into a fixed-length context vector. Use an LSTM decoder to decode the context vector into the target sequence. Use a fully connected layer to map the output of the decoder to a vector of the vocabulary size, and use the softmax activation function to calculate the probability of each word.
[0194] Perform a linear output layer process on the feature hidden layer data to obtain the feature linear output layer data;
[0195] Specifically, use a fully connected layer (dense layer) (linear transformation and softmax calculation) to map the hidden layer output to the output dimension, and use the softmax activation function to output the class probabilities.
[0196] Optimize and iterate the feature linear output layer data according to the text tokenization feature data to obtain the construction of the deep sentiment classification model.
[0197] Specifically, calculate the loss function (such as cross-entropy), and use an optimization algorithm (such as Adam, SGD, etc.) for gradient descent and parameter update to iteratively optimize the model.
[0198] In the present invention, the multi-layer hidden layer process can extract complex features and sentiment patterns in the text, improving the accuracy of sentiment classification. The word vector embedding provides rich semantic information, enabling the model to better understand and process the sentiment expressions in the text. The linear output layer maps the high-dimensional features to specific categories, providing clear classification results and probability distributions, which helps in result interpretation. The optimization and iteration process continuously adjusts the model, enhancing its performance and generalization ability in practical applications.
[0199] Optionally, the hidden layer process includes:
[0200] Perform a multi-scale convolution process on the feature word embedding data to obtain the feature word multi-scale convolution data;
[0201] Specifically, convolutional operations are performed on the word embedding data using convolutional kernels of different sizes to capture text features at different scales. Multiple sizes of convolutional kernels are applied (such as 3×1, 5×1, 7×1, etc.).
[0202] Multidimensional activation calculations are performed on the multi-scale convolutional data of feature words to obtain multi-dimensional activation data of features;
[0203] Specifically, a non-linear activation function (such as ReLU, tanh, etc.) is used to activate the multi-scale convolutional output.
[0204] Global-local pooling processing is performed on the multi-dimensional activation data of features to obtain global-local pooling data of features;
[0205] Specifically, global pooling (such as global average pooling, global max pooling) and local pooling (such as max pooling, average pooling) are combined to retain important features and reduce the data dimension.
[0206] Multi-head self-attention processing is performed on the global-local pooling data of features to obtain multi-head attention data of features;
[0207] Specifically, a multi-head self-attention mechanism (such as the multi-head attention mechanism in Transformer) is used to capture the dependencies between words in the sequence.
[0208] Dense connection is performed on the multi-head attention data of features to obtain densely connected data of features;
[0209] Specifically, the outputs of multiple attention heads are connected to form a dense feature representation.
[0210] Serialization is performed on the densely connected data of features to obtain serialized data of features;
[0211] Specifically, the connected dense features are serialized for subsequent operations (such as normalization, etc.).
[0212] Instance normalization processing is performed on the serialized data of features to obtain hidden layer data of features.
[0213] Specifically, the instance normalization method (Instance Normalization) is used to standardize the data distribution of each instance. For the serialized data of features, calculate and subtract the mean, and divide by the standard deviation for normalization.
[0214] Specifically, more importantly, the instance normalization processing includes:
[0215] Filter instance normalization processing is performed on the serialized data of features to obtain the first hidden layer data of features;
[0216] Perform extreme value instance normalization on the feature serialized data to obtain the second feature hidden layer data;
[0217] Fuse the first feature hidden layer data and the second feature hidden layer data to obtain the feature hidden layer data;
[0218] Specifically, calculate the mean and standard deviation of each feature, set a threshold (such as 3 times the standard deviation) to detect outliers. Remove the detected outliers from the dataset. Perform normalization on the filtered data to obtain the first feature hidden layer data.
[0219] Use the extreme value normalization method to scale the data to a specified range (such as [0, 1]), considering the maximum and minimum values of each feature, to obtain the second feature hidden layer data.
[0220] Fuse the first feature hidden layer data and the second feature hidden layer data, adopting weighted average, feature concatenation or other fusion strategies. Directly concatenate the two groups of feature vectors into a new vector. Assign weights according to the importance of each feature and perform weighted average on the two groups of features.
[0221] Among them, the filtered instance normalization process includes:
[0222] Calculate statistical features based on the feature serialized data to obtain the feature serialized statistical feature data;
[0223] Perform weighted calculation based on the feature serialized statistical feature data to obtain the filtering threshold data;
[0224] Perform filtered instance normalization on the feature serialized data according to the filtering threshold data to obtain the first feature hidden layer data;
[0225] Specifically, calculate the statistical features of the feature serialized data, such as mean, standard deviation, quartiles, etc. According to the statistical features, assign weights to each feature and calculate the filtering threshold. Input the feature serialized statistical feature data. Assign weights, determine the feature importance according to the standard deviation or other statistical features of the feature. Calculate the filtering threshold data, including: setting a fixed multiple of the standard deviation (such as 3 times the standard deviation), or other weighted methods based on statistics, such as weighted based on the interquartile range (IQR).
[0226] Apply the filtering threshold to perform normalization on the feature serialized data, remove outliers and standardize the data. Input the feature serialized data and the filtering threshold data.
[0227] For each data instance, determine whether it is within the filtering threshold range: if the data instance is within the range, retain it. If it exceeds the range, it is regarded as an outlier and processed (such as removed or corrected). Normalize the retained data, such as zero-mean unit-variance standardization, to obtain the data of the first feature hidden layer.
[0228] Among them, the extreme value instance normalization processing includes:
[0229] Calculate the feature importance weights for the feature serialized data to obtain the feature importance weight data;
[0230] Perform weighted extreme value normalization on the feature serialized data according to the feature importance weight data to obtain the data of the second feature hidden layer.
[0231] Specifically, use a trained model (such as Random Forest, XGBoost) to calculate the feature importance scores, or use statistical methods (such as analysis of variance, information gain) to evaluate the importance of features. Assign a weight value to each feature, and the weight value can be normalized according to the feature importance scores so that the sum of all weights is 1. Obtain the feature importance weight data.
[0232] According to the calculated feature importance weight data, perform extreme value normalization on the feature serialized data to adjust the data range of each feature. For each data point x i Perform normalization: x′ i is the data of the second feature hidden layer, min(x i ) is the minimum value of the i-th feature serialized data, max(x i ) is the maximum value of the i-th feature serialized data, and w i is the feature importance weight data corresponding to the i-th feature serialized data.
[0233] In the present invention, multi-scale convolution can capture different local features in the text, such as phrases, sentence structures, etc. Convolution kernels of different scales can identify multi-level information in the text, enabling the model to more comprehensively understand the text content and emotional expression. The activation function introduces non-linearity, enabling the model to learn more complex feature relationships and patterns. This is very important for processing complex emotional expressions and identifying emotional nuances. Global pooling can capture the overall features of the entire sentence, while local pooling can retain more fine-grained local information, providing a richer and more refined feature representation, which helps improve the model's ability to recognize different emotions. Multi-head self-attention can identify long-range dependencies in the text, enabling the model to focus on different parts of the text, enhancing the model's sensitivity to emotional cues, and helping to identify implicit emotional information and complex emotional patterns. Dense Connection can promote the transmission and reuse of features, enhancing the diversity of feature representations. This structure helps the model capture more detailed information and improve the comprehensiveness of feature expression. Serialization helps manage features in a structured manner, enabling subsequent processing to better utilize these features, helping the model retain the order information of input features, and enhancing the understanding of text structure. Instance normalization can reduce the heterogeneity of data, balance the feature scales of different instances, help improve the training stability and convergence speed of the model, and enhance the generalization ability of the model on different input data.
[0234] Optionally, the model integration includes:
[0235] Performing weighted average integration on the preliminary emotion classification model and the deep emotion classification model to obtain integrated model output data;
[0236] Specifically, perform weighted average calculation on the output probabilities of the two models and set weight parameters. (For example, the weights of the preliminary model and the deep model are w1 and w2 respectively). Calculate the weighted average y = w1×y1 + w2×y2, where y is the final weighted output.
[0237] Adding an output probability screening layer based on the integrated model output data, the preliminary emotion classification model, and the deep emotion classification model to obtain an emotion determination model.
[0238] Specifically, add a screening layer to perform screening processing on the probabilities output by the model. The screening layer can determine the final emotion classification label based on a set threshold or other conditions. For example, screen out the most credible emotion label according to preset conditions (such as the highest probability, fixed threshold, etc.).
[0239] In the present invention, weighted average integration can utilize the advantages of different models to make up for the deficiencies of a single model. For example, the preliminary sentiment classification model may be better at quickly capturing simple sentiment features, while the deep sentiment classification model can deeply extract complex sentiment features. Through weighted average, a more comprehensive classification result can be obtained. By combining the outputs of multiple models, the integrated model can generally improve the overall classification accuracy. The weighted average can assign different weights according to the performance of each model to optimize the final result. The output probability screening layer can set a threshold to filter out prediction results with low confidence and improve the final prediction quality. For example, if the prediction probabilities of all categories are lower than a certain threshold, the sample can be marked as "uncertain" to avoid misjudgment. Through the processing of the screening layer, more fine-grained sentiment classification information is provided, such as the confidence of the classification result, the most likely category and its alternative categories, etc.
[0240] Optionally, S4 includes:
[0241] S41. Obtain real-time user text data, and use the sentiment determination model to perform sentiment determination on the real-time user text data to obtain sentiment probability distribution data, where the sentiment probability distribution data includes preliminary sentiment classification probability data, deep sentiment classification probability data, and sentiment determination data;
[0242] Specifically, real-time obtain the text data input by the user, use the trained sentiment determination model to perform sentiment classification on the text, and output the classification probability. Among them, the preliminary sentiment classification probability data is the output data of the preliminary sentiment classification model, the deep sentiment classification probability data is the output data of the deep sentiment classification model, and the sentiment determination data is the output data of the sentiment determination model.
[0243] S42. Calculate the sentiment probability similarity based on the preliminary sentiment classification probability data, the deep sentiment classification probability data, and the sentiment determination data to obtain sentiment probability similarity data;
[0244] Specifically, calculate the similarity between the preliminary sentiment classification probability data, the deep sentiment classification probability data, and the sentiment determination data. Similarity metrics such as Euclidean distance and cosine similarity can be used. Calculate the similarity between each data to obtain the sentiment probability similarity data.
[0245] S43. When it is determined that the sentiment probability similarity data is less than or equal to the preset sentiment probability similarity threshold data, then integrate the preliminary sentiment classification probability data, the deep sentiment classification probability data, and the sentiment determination data to obtain sentiment classification label data;
[0246] Specifically, when the similarity data is less than or equal to the preset threshold, integrate the preliminary sentiment classification probability data, the deep sentiment classification probability data, and the sentiment determination data to form a consistent sentiment classification label.
[0247] When it is determined that the emotional probability similarity data is greater than the preset emotional probability similarity threshold data, voting is performed based on the preliminary emotional classification probability data, the in-depth emotional classification probability data, and the emotional determination data to obtain the emotional classification label data.
[0248] Specifically, when the similarity data is greater than the preset threshold, a voting mechanism is used to determine the final emotional classification label based on the output probabilities of each model. According to the probabilities output by each model, a voting mechanism is used to determine the final emotional label.
[0249] In the present invention, through the output and integration of multiple models, the credibility and stability of the emotional classification results are ensured. The similarity calculation and voting mechanism help effectively handle the differences between different models and provide reasonable solutions. User text data is obtained and analyzed in real time to respond to emotional changes in a timely manner, and the decision-making mechanism can be adjusted according to actual needs. By combining multiple decision-making strategies, the robustness and adaptability of the model in dealing with complex emotional expressions and ambiguous emotional states are improved.
[0250] Optionally, S5 includes:
[0251] S51. Extract negative data according to the negative emotional label data in the emotional classification label data to obtain user negative text data;
[0252] Specifically, the text corresponding to the negative emotion in the emotional classification label data is screened out, and the relevant data of the negative emotion is extracted.
[0253] S52. Extract features from the user negative text data to obtain user negative text feature data;
[0254] Specifically, text feature extraction methods (such as TF-IDF, word vectors, topic modeling, etc.) are used to extract the features of the negative text.
[0255] S54. Perform clustering processing on the user negative text feature data to obtain negative text feature data;
[0256] Specifically, clustering algorithms (such as K-means, DBSCAN, hierarchical clustering, etc.) are used to cluster the negative text feature data to identify different negative themes or patterns.
[0257] S55. Perform cluster area screening on the negative text feature data to obtain negative text feature screening data;
[0258] Specifically, the size of each clustering cluster is calculated, and effective clusters are screened according to the preset area or sample quantity threshold.
[0259] S55. Perform cluster analysis on the negative text feature screening data to obtain negative text pattern data;
[0260] Specifically, further analyze the filtered clusters to determine the characteristics and patterns of each cluster. Analyze the high-frequency words within the cluster to determine the theme of the cluster. For example, if the high-frequency words in a certain cluster are "poor", "terrible", "complaint", it can be inferred that the theme of this cluster is the dissatisfaction of users with the product or service. Use topic modeling methods (such as LDA) to extract the topic words of each cluster to help understand the theme of each cluster.
[0261] Based on the characteristic words and themes of each cluster, determine the negative sentiment pattern of the cluster. For example: Pattern 1: Product quality problems - characteristic words include "poor quality", "broken", "not durable", etc. Pattern 2: Poor service attitude - characteristic words include "bad attitude", "unfriendly", "impatient", etc. Pattern 3: Logistics and distribution problems - characteristic words include "delay", "missing delivery", "slow express delivery", etc. The negative text pattern data includes the characteristic descriptions of each cluster and the corresponding theme patterns.
[0262] S56. Perform data expansion on the negative text pattern data to obtain negative text expanded data;
[0263] Specifically, expand the negative text pattern data through data augmentation methods (such as synonym replacement, text generation, etc.) to generate more negative samples.
[0264] Use existing synonym dictionaries (such as WordNet, CNKI Thesaurus, etc.), or synonym lists obtained through corpus learning. Selectively replace some words in the sentence to keep the overall meaning of the sentence unchanged. For each word in the negative text sample, find its synonyms. Randomly select a synonym for replacement to generate a new sentence. Original sentence: "The customer service attitude is very poor.", Synonym replacement: "The customer service attitude is extremely poor."
[0265] S57. Merge the negative text expanded data and the user negative text data and perform feature extraction to obtain negative text feature enhanced data for the optimization operation of the sentiment determination model.
[0266] Specifically, merge the expanded data with the original user negative text data and perform feature extraction again.
[0267] The multi-level clustering and pattern analysis in the present invention help to identify and understand the diversity and complexity of negative sentiment. Cluster area screening and data merging ensure the representativeness of the analysis and the quality of the data, reducing noise. Data expansion increases the diversity of training data, enhancing the robustness and generalization ability of the model. By constructing more comprehensive negative sentiment feature data, it provides richer inputs for the training and optimization of the model, improving the accuracy and effectiveness of sentiment determination.
[0268] Optionally, a high-accuracy sentiment determination and negative data recall system is used to execute the high-accuracy sentiment determination and negative data recall method as described above. The high-accuracy sentiment determination and negative data recall system includes:
[0269] A user text tokenization module, which is used to obtain user text data and perform text tokenization on the user text data to obtain user text tokenization data;
[0270] A text tokenization feature extraction module, which is used to extract features from the user text tokenization data to obtain text tokenization feature data;
[0271] A sentiment determination model construction module, which is used to construct a preliminary sentiment classification model for the text tokenization data to obtain a preliminary sentiment classification model, and construct a deep sentiment classification model for the text tokenization feature data to obtain a deep sentiment classification model; integrate the preliminary sentiment classification model and the deep sentiment classification model to obtain a sentiment determination model;
[0272] A real-time user text sentiment determination module, which is used to obtain real-time user text data and use the sentiment determination model to perform sentiment determination on the real-time user text data to obtain sentiment classification label data, where the sentiment classification label data includes positive sentiment label data, negative sentiment label data, and neutral sentiment label data;
[0273] A negative data recall optimization module, which is used to extract negative data according to the negative sentiment label data in the sentiment classification label data to obtain user negative text data; perform clustering processing on the user negative text data to obtain negative text feature data; perform negative data enhancement according to the negative text feature data to obtain negative text feature enhancement data for optimizing the sentiment determination model.
[0274] The objectives of the present invention are:
[0275] 1. Through multi-level feature extraction, it is possible to capture subtle sentiment changes and deep semantic information in the text, providing a more accurate basis for sentiment analysis. The efficient execution of the tokenization and feature extraction processes ensures the performance and efficiency of the system when processing large-scale data.
[0276] 2. For the shallow judgment model, a preliminary integration of fasttext and textcnn or one of them is adopted. For the deep judgment model, multi-head attention is used, which can be cnn + mutilhead or encoder-decoder, realizing a multi-level understanding of text sentiment. The preliminary model is good at capturing simple sentiment features, while the deep model can identify more complex sentiment patterns. The outputs of different models are weighted and averaged, and at the same time, the final classification result is optimized through the output probability screening layer, combining the advantages of multiple models and improving the accuracy and robustness of sentiment judgment.
[0277] 3. Real-time processing and judgment of user sentiment enable the system to quickly respond to changes in the user's emotional state and adapt to a dynamic user interaction environment. It supports real-time data stream processing and can update the sentiment analysis results in a timely manner when the data source changes. Through data augmentation and feature merging, the model can learn more diverse negative sentiment expressions, enhancing the adaptability and generalization ability of the model in different sentiment scenarios. The model can continuously adjust and optimize according to new data and sentiment patterns, improving the long-term stability and accuracy of the system. By accurately identifying and responding to the user's negative sentiment, it helps enterprises or platforms quickly handle user dissatisfaction and improve user experience and satisfaction.
[0278] Therefore, from any perspective, the embodiments should be regarded as exemplary and non-restrictive. The scope of the present invention is defined by the appended application documents rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the application documents are intended to be encompassed within the present invention.
[0279] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features invented herein.
Claims
1. A method for high-accuracy sentiment determination and negative data recall, characterized in that, The method includes: S1. Obtain user text data, perform text tokenization on the user text data to obtain user text tokenization data; S2. Extract features from the user text tokenization data to obtain text tokenization feature data; S3. Construct a preliminary sentiment classification model for the text tokenization data to obtain a preliminary sentiment classification model, and construct a deep sentiment classification model for the text tokenization feature data to obtain a deep sentiment classification model; Integrate the preliminary sentiment classification model and the deep sentiment classification model to obtain a sentiment determination model; S4. Obtain real-time user text data, and use the sentiment determination model to determine the sentiment of the real-time user text data to obtain sentiment classification label data, where the sentiment classification label data includes positive sentiment label data, negative sentiment label data, and neutral sentiment label data; S5. Extract negative data according to the negative sentiment label data in the sentiment classification label data to obtain user negative text data; Perform clustering processing on the user negative text data to obtain negative text feature data; Perform negative data enhancement according to the negative text feature data to obtain negative text feature enhanced data for sentiment determination model optimization operations; The construction of the deep sentiment classification model includes: Perform word sequence input layer processing on the text tokenization feature data to obtain feature word sequence input layer data; Perform word vector embedding on the feature word sequence input layer data to obtain feature word embedding data; Perform hidden layer processing on the feature word embedding data to obtain feature hidden layer data; Perform linear output layer processing on the feature hidden layer data to obtain feature linear output layer data; Optimize and iterate the feature linear output layer data according to the text tokenization feature data to obtain the construction of the deep sentiment classification model; Among them, the hidden layer processing includes: Perform multi-scale convolution processing on the feature word embedding data to obtain feature word multi-scale convolution data; Perform multi-dimensional activation calculation on the feature word multi-scale convolution data to obtain feature multi-dimensional activation data; Perform global-local pooling processing on the feature multi-dimensional activation data to obtain feature global-local pooling data; Perform multi-head self-attention processing on the feature global-local pooling data to obtain feature multi-head attention data; Perform dense connection on the feature multi-head attention data to obtain feature dense connection data; Serialize the feature dense connection data to obtain feature serialized data; Perform instance normalization processing on the feature serialized data to obtain feature hidden layer data; Among them, the instance normalization processing includes: Perform filtering instance normalization on the feature serialized data to obtain the first feature hidden layer data; perform extreme value instance normalization on the feature serialized data to obtain the second feature hidden layer data; fuse the first feature hidden layer data and the second feature hidden layer data to obtain the feature hidden layer data; wherein the filtering instance normalization process includes: calculating statistical features based on the feature serialized data to obtain feature serialized statistical feature data; performing weighted calculation based on the feature serialized statistical feature data to obtain filtering threshold data; performing filtering instance normalization on the feature serialized data according to the filtering threshold data to obtain the first feature hidden layer data; wherein the extreme value instance normalization process includes: calculating feature importance weight data for the feature serialized data; performing weighted extreme value normalization on the feature serialized data according to the feature importance weight data to obtain the second feature hidden layer data.
2. The method according to claim 1, characterized in that, S1 includes: Obtain user text data; Perform word boundary detection on the user text data to obtain text word boundary data; Perform disambiguation on the text word boundary data to obtain text disambiguation data; Perform out-of-vocabulary word processing on the text disambiguation data and the preset word segmentation dictionary data to obtain text new word data; Perform word segmentation on the text new word data to obtain user text word segmentation data.
3. The method according to claim 1, wherein S2 Includes: Perform word vector conversion on the user text word segmentation data to obtain word vector data; Perform inverse document frequency calculation on the word vector data to obtain inverse document frequency data; Construct a syntax tree based on the word vector data to obtain syntax tree data; Perform topic modeling on the inverse document frequency data to obtain topic distribution data; Perform sentiment dictionary matching based on the user text word segmentation data to obtain word segmentation sentiment feature data; Perform dependency relationship analysis based on the word vector data to obtain word segmentation dependency relationship feature data; Calculate the sentiment intensity based on the word segmentation sentiment feature data to obtain user text sentiment feature data; Integrate the inverse document frequency data, the syntax tree data, the topic distribution data, the word segmentation dependency relationship feature data, and the user text sentiment feature data to obtain text word segmentation feature data.
4. The method according to claim 1, wherein The construction of the preliminary sentiment classification model includes: Perform data balancing based on the text word segmentation feature data to obtain feature balanced data; Perform batch processing input layer processing based on the feature balanced data to obtain feature input layer data; Perform word vector embedding layer processing on the feature input layer data to obtain feature word vector embedding layer data; Perform convolutional layer processing on the feature word vector embedding layer data to obtain feature convolutional layer data; Perform activation layer calculation on the feature convolutional layer data to obtain feature activation layer data; Perform pooling layer processing on the feature activation layer data to obtain feature pooling layer data; Perform feature splicing on the feature pooling layer data to obtain feature splicing data; Perform fully connected layer processing based on the feature splicing data to obtain feature fully connected layer data; Perform output layer processing on the feature fully connected layer data to obtain feature category probability data; Perform loss optimization and iteration on the feature category probability data based on the text word segmentation feature data to obtain the preliminary sentiment classification model.
5. The method according to claim 1, wherein Model integration includes: The preliminary sentiment classification model and the deep sentiment classification model are integrated by weighted averaging to obtain the integrated model output data; Based on the integrated model output data, the preliminary sentiment classification model, and the deep sentiment classification model, an output probability screening layer is added to obtain the sentiment determination model.
6. The method according to claim 1, characterized in that, S4 includes: Obtain real-time user text data, and use the sentiment determination model to determine the sentiment of the real-time user text data to obtain sentiment probability distribution data, where the sentiment probability distribution data includes preliminary sentiment classification probability data, deep sentiment classification probability data, and sentiment determination data; Calculate the sentiment probability similarity based on the preliminary sentiment classification probability data, the deep sentiment classification probability data, and the sentiment determination data to obtain the sentiment probability similarity data; When it is determined that the sentiment probability similarity data is less than or equal to the preset sentiment probability similarity threshold data, the preliminary sentiment classification probability data, the deep sentiment classification probability data, and the sentiment determination data are integrated to obtain the sentiment classification label data; When it is determined that the sentiment probability similarity data is greater than the preset sentiment probability similarity threshold data, a vote is conducted based on the preliminary sentiment classification probability data, the deep sentiment classification probability data, and the sentiment determination data to obtain the sentiment classification label data.
7. The method according to claim 1, wherein S5 Includes: Extract negative data according to the negative sentiment label data in the sentiment classification label data to obtain user negative text data; Extract features from the user negative text data to obtain user negative text feature data; Perform clustering processing on the user negative text feature data to obtain negative text feature data; Perform cluster area screening on the negative text feature data to obtain negative text feature screening data; Perform cluster analysis on the negative text feature screening data to obtain negative text pattern data; Perform data expansion on the negative text pattern data to obtain negative text expansion data; Merge the negative text expansion data and the user negative text data and perform feature extraction to obtain negative text feature enhancement data for optimizing the sentiment determination model.
8. A high-accuracy sentiment determination and negative data recall system, characterized in that, For executing the high-accuracy sentiment determination and negative data recall method as described in claim 1, the high-accuracy sentiment determination and negative data recall system includes: A user text tokenization module for obtaining user text data and tokenizing the user text data to obtain user text tokenization data; A text tokenization feature extraction module for extracting features from the user text tokenization data to obtain text tokenization feature data; A sentiment determination model construction module for constructing a preliminary sentiment classification model for the text tokenization data to obtain a preliminary sentiment classification model, and constructing a deep sentiment classification model for the text tokenization feature data to obtain a deep sentiment classification model; integrating the preliminary sentiment classification model and the deep sentiment classification model to obtain a sentiment determination model; A real-time user text sentiment determination module for obtaining real-time user text data and using the sentiment determination model to determine the sentiment of the real-time user text data to obtain sentiment classification label data, where the sentiment classification label data includes positive sentiment label data, negative sentiment label data, and neutral sentiment label data; Negative data recall optimization module, which is used to extract negative data according to the negative sentiment label data in the sentiment classification label data to obtain user negative text data; perform clustering processing on the user negative text data to obtain negative text feature data; perform negative data enhancement according to the negative text feature data to obtain negative text feature enhanced data for sentiment determination model optimization operations.
Citation Information
Patent Citations
Emotion classifying method fusing intrinsic feature and shallow feature
CN105824922A
Social public opinion monitoring system based on microblogs and monitoring method thereof
CN111444404A
Big data analysis method and system based on community governance data
CN113569008A