Text sentiment classification method and system based on aspect semantic enhancement
By enhancing aspect semantic awareness within the meta-learning paradigm and optimizing the text sentiment classification model using large-scale language models and multi-head attention mechanisms, the accuracy and robustness issues of text sentiment classification in low-resource environments are addressed, achieving more efficient sentiment polarity determination.
Patent Information
- Application Number
- CN202311123144.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-01
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-09-01
AI Technical Summary
In fine-grained text sentiment classification, existing meta-learning methods struggle to effectively capture aspect semantic information in low-resource environments, leading to a mismatch between sentiment information and aspect information, which affects the accuracy and robustness of the model.
We adopt an aspect-based semantic enhancement-based text sentiment classification method. We construct the source and target domains through a meta-learning paradigm, extract aspect-based semantic perception feature vectors using a large-scale language model, and optimize the model by combining multi-head attention mechanism and cross-entropy loss function to improve the accuracy of sentiment polarity determination.
It enhances the model's aspect semantic perception ability under low resource conditions, improves the accuracy and robustness of fine-grained text sentiment classification, and ensures the accuracy and depth perception of sentiment polarity determination.
Smart Images

Figure CN117112790B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of information technology, specifically relating to a text sentiment classification method and system based on aspect semantic enhancement. Background Technology
[0002] With the rapid development of social media technology, social media platforms (such as Weibo, Twitter, Facebook, Xiaohongshu, Yelp, Tmall, and Taobao) have become a primary means of emotional communication. Text sentiment classification aims to analyze users' emotional tendencies through user-generated text content on these social media platforms. Because user-generated text content typically contains multiple emotional expressions, text sentiment classification is not limited to the overall sentiment of the text but can analyze users' emotional tendencies towards specific categories at a finer granular level. It has important applications in areas such as consumer decision-making, public opinion analysis, travel planning, and personalized recommendations, and possesses high commercial value.
[0003] However, training fine-grained text sentiment classification models requires large amounts of labeled datasets. When certain categories have only a small amount of labeled data, performance drops significantly, impacting training effectiveness. Furthermore, data labeling is labor-intensive, requiring substantial manual input. Fine-grained text sentiment classification demands highly precise labeling, making it even more difficult to obtain large-scale labeled datasets, thus compromising model performance and robustness. Therefore, few-shot learning is crucial for fine-grained text sentiment classification. Few-shot learning aims to rapidly generalize existing experiential knowledge using limited labeled data, enabling the model to learn quickly. Existing few-shot learning methods can be categorized into three types: meta-learning methods, cue-based learning methods, and data augmentation methods. Currently, meta-learning, due to its simplicity and effectiveness, has gained widespread acceptance in academia and industry, becoming the most popular few-shot learning method.
[0004] Despite significant progress in meta-learning, many challenges remain in fine-grained text sentiment classification. Specifically, user-generated text is typically short and irregular, potentially containing multiple aspect categories and sentiment words. Directly locating sentiment information using known target aspects may fail due to data sparsity, resulting in insufficient semantic information to extract from the text data. This can lead to associations between the target aspect and irrelevant sentiment words, causing a mismatch between aspect and sentiment information and hindering the effective determination of the target aspect's sentiment polarity. Summary of the Invention
[0005] The purpose of this invention is to propose a text sentiment classification method and system based on aspect semantic enhancement. In the case of insufficient aspect semantic learning in low-resource environments, the method enhances aspect semantic perception ability in the meta-learning paradigm, improves the accuracy of sentiment classification of small sample texts, and enhances the effect of judging the sentiment polarity of the target aspect.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0007] A text sentiment classification method based on aspect semantic enhancement includes the following steps:
[0008] Collect and preprocess user-generated text data from social media platforms;
[0009] To perform meta-learning N-way K-shot setup, a source domain and a target domain are constructed based on preprocessed text data. A meta-training task is constructed in the source domain, and a meta-test task is constructed in the target domain. A support set and a query set are constructed for each meta-training task and meta-test task, respectively.
[0010] We use a large-scale language model to extract aspect-semantic-aware support sample feature vectors from the support set, and extract specific query feature vectors for each aspect category from the query set.
[0011] In the meta-training task of the source domain, the auxiliary module for aspect category detection and the main module for aspect sentiment determination are trained.
[0012] For the auxiliary module, a prototype of each aspect category is constructed based on the feature vectors of all support samples for each aspect category in the support set; then, the cosine distance similarity between the prototype of each aspect category and its corresponding dedicated query feature vector is calculated, and a semantic enhancement contrastive loss function for the query samples is constructed based on the cosine distance similarity.
[0013] For the main module, based on the dedicated query feature vector of the target aspect category and the feature vector of the query sample, a multi-head attention mechanism is used to generate sentiment feature vectors; the sentiment feature vectors are then passed through two linear layers for aspect sentiment determination, and a cross-entropy loss function is constructed.
[0014] The total loss function is composed of semantic enhancement contrastive loss function and cross-entropy loss function; the meta-training task is sampled multiple times in the source domain to reduce the total loss, and the auxiliary module and main module are trained and optimized multiple times. The training results of the auxiliary module and main module are tested in the meta-testing task in the target domain.
[0015] Using pre-trained auxiliary and main modules, the system directly predicts the sentiment polarity of the target aspect category of the query sample and outputs the prediction results.
[0016] Furthermore, the text data is stored in the form of a database, XML file, JSON file, or TXT file.
[0017] Furthermore, the preprocessing includes removing noise and redundant information.
[0018] Furthermore, the steps of constructing support sets and query sets for each meta-training task and meta-test task respectively include:
[0019] Randomly collect N aspect categories from the source domain / target domain to form the set of current category labels, and randomly sample K samples under each category to form the support set of the current meta-training task / meta-test task;
[0020] After the support set is constructed, multiple samples are randomly sampled from the remaining data for each aspect category of the current category label set to form the query set for the current meta-training task / meta-test task.
[0021] Furthermore, the steps for extracting the feature vectors of the support samples include:
[0022] The support samples and their corresponding aspect category descriptions are extracted from the support set, concatenated, and then input into a large-scale language model for encoding, outputting the latent states of the support samples.
[0023] The hidden state mean of the support samples is calculated as the feature vector of the support samples.
[0024] Furthermore, the steps for extracting the specific query feature vector for each aspect class include:
[0025] In addition to outputting the latent states that support the samples, large-scale language models also output the latent states that describe aspect categories.
[0026] The mean of the hidden states described by aspect categories is used as the feature vector of aspect category description;
[0027] The feature vectors of the same aspect category description in the support set are averaged to obtain the aspect category feature vector.
[0028] Extract query samples from the query set, concatenate them, input them into a large-scale language model for encoding, and output the hidden state of the query samples.
[0029] Calculate the hidden state mean of the query sample as the feature vector of the query sample;
[0030] The feature vector of the query sample is concatenated with the feature vector of the aspect category, and a dedicated query feature vector for each aspect category is extracted through two linear layers.
[0031] Furthermore, the steps for constructing a prototype for each aspect category based on the feature vectors of all support samples for each aspect category in the support set include:
[0032] Construct a feature vector matrix based on the feature vectors of all support samples for each aspect category in the support set;
[0033] The feature vector matrix is processed using an attention mechanism to extract intra-class shared information and construct a prototype for each aspect category.
[0034] Furthermore, the steps for constructing a semantically enhanced contrastive loss function for the query samples based on this cosine distance similarity include:
[0035] Based on the query samples and aspect category labels, the cosine distance similarity is divided into a positive score set and a negative score set;
[0036] Based on the positive and negative score sets, a semantically enhanced contrastive loss function is constructed.
[0037] Furthermore, the steps for predicting the sentiment polarity of the target aspect category in the query sample include:
[0038] Generate sentiment feature vectors by utilizing dedicated query feature vectors for target categories;
[0039] Use this sentiment feature vector to predict sentiment polarity and output the predicted sentiment type.
[0040] A text sentiment classification system based on aspect semantic enhancement includes:
[0041] The corpus information storage module is used to collect and store user-generated text data from social media platforms;
[0042] The file preprocessing module is used to preprocess text data;
[0043] The text feature extraction module is used to construct source and target domains based on preprocessed text data, construct meta-training tasks in the source domain, construct meta-test tasks in the target domain, and construct support sets and query sets for each meta-training and meta-test tasks respectively; it uses a large-scale language model to extract aspect semantic awareness support sample feature vectors from the support set, and extracts dedicated query feature vectors for each aspect category from the query set.
[0044] The aspect category detection module includes an auxiliary module for aspect category detection. It is used to construct a prototype of each aspect category based on the feature vectors of all supporting samples for each aspect category in the support set, and then calculate the cosine distance similarity between the prototype of each aspect category and its corresponding dedicated query feature vector. Aspect category detection is then performed based on the cosine distance similarity.
[0045] The aspect sentiment determination module includes a main module for aspect sentiment determination, which is used to generate sentiment feature vectors based on the dedicated query feature vectors of the target aspect category and the feature vectors of the query samples, and to perform aspect sentiment determination based on the sentiment feature vectors.
[0046] The decision output module uses the auxiliary and main modules trained in the meta-training task of the source domain to predict the sentiment polarity of the target aspect category of the query sample in the meta-test task of the target domain, and outputs the prediction results.
[0047] The advantages of the technical solution of the present invention are as follows:
[0048] 1. Enhanced auxiliary task: By incorporating aspect category detection as an auxiliary task, this invention can gain a deeper understanding of the semantic content in the text. This not only ensures that the text is accurately classified into the correct aspect category, but also enhances the depth perception of specific aspects.
[0049] 2. Target-related feature extraction: This invention specifically extracts features that are related to the target but not to other aspects, thereby ensuring the focus and accuracy of the model when performing sentiment classification.
[0050] 3. Deeper semantic awareness: By combining large-scale language models, such as BERT, this invention can more effectively capture the contextual information of text and provide richer and deeper semantic analysis.
[0051] 4. Aspect-based emotional interaction: This invention emphasizes capturing the emotional interaction features between text and aspects, which ensures that the model not only identifies the emotions in the text, but also explicitly associates them with specific aspects.
[0052] 5. Iterative optimization of the model: This invention ensures the robustness and generalization ability of the model by sampling the meta-training task multiple times in the source domain and iteratively optimizing the auxiliary and main modules of the system.
[0053] 6. Real-time feedback and evaluation: This invention provides the ability to interact with users and calculate their average accuracy in aspect sentiment judgment, which helps to continuously evaluate and improve model performance.
[0054] In summary, this invention emphasizes the importance of aspect semantic awareness and uses advanced models and strategies to ensure accuracy and depth in sentiment classification. Attached Figure Description
[0055] Figure 1 This is a schematic diagram of the structure of a text sentiment classification system based on aspect semantic enhancement.
[0056] Figure 2 This is a flowchart of the steps involved in a text sentiment classification system based on aspect semantic enhancement. Detailed Implementation
[0057] To make the various technical features, advantages, or effects of the present invention more apparent and understandable, a detailed description is provided below in conjunction with the accompanying drawings.
[0058] Figure 1 This is a schematic diagram of the text sentiment classification system based on aspect semantic enhancement proposed in this invention. The functions of each module are explained below:
[0059] The corpus information storage module is responsible for collecting user-generated text data from social media platforms. To ensure data security and persistence, this module saves text data in the form of databases, XML files, JSON files, or TXT files, and uses non-volatile materials, such as solid-state drives, as storage media. This ensures that data integrity is maintained even in the event of power outages or system crashes.
[0060] The text preprocessing module is responsible for preprocessing the collected text data. Since this data is usually colloquial and non-standard, with a large degree of randomness, it contains a lot of noise and redundant information, such as stop words, punctuation marks, emoticons, interjections, and irregular symbols. Therefore, it is necessary to clean the data according to preset cleaning rules and patterns to remove noise and redundant information and ensure that the preprocessed data meets the expected format and content.
[0061] The text feature extraction module utilizes the context modeling capabilities of large-scale language models to encode text data into semantic feature vectors, which can effectively extract the semantic information of the text.
[0062] The aspect category detection module is an auxiliary module of the system. It employs a meta-learning paradigm to perform aspect category detection, enhancing the model's aspect semantic perception capability. This module captures aspect semantic information of the text and can extract semantic features that can predict the target aspect but not other aspects, thereby assisting in the sentiment determination of the target aspect.
[0063] The aspect sentiment determination module is the core module of the system. It uses the learned aspect semantic information to explore the sentiment information in the text that interacts with the target aspect, predicts the sentiment polarity of the target aspect, and thus enhances the model's sentiment determination ability.
[0064] The output module uses a pre-trained model to determine the sentiment polarity of the target aspect of the query sample and outputs it in a preset data format.
[0065] Figure 2 This is a flowchart illustrating the steps of the text sentiment classification method based on aspect semantic enhancement proposed in this invention. Each step of this method can be implemented through the various modules of the above system. The specific details of each step are as follows:
[0066] 1. Data Collection: Collect user-generated text data from social media platforms and process it according to database, XML file, etc.
[0067] Recorded in JSON or TXT text file format and stored on non-volatile hardware devices.
[0068] 2. Data preprocessing: Perform data cleaning operations on the collected text data, including removing noise and redundant information, to ensure that the data meets the expected format and content.
[0069] 3. Meta-learning Setup: A meta-learning N-way K-shot setup is implemented, meaning that in each meta-learning task, N categories are selected, and K samples are chosen from each category for learning. This meta-learning setup provides the foundational framework for aspect category detection and aspect sentiment determination, enhancing the model's aspect semantic awareness and improving aspect sentiment determination performance. Based on this setup, meta-training tasks are constructed in the source domain, and meta-testing tasks are constructed in the target domain. Each meta-training and meta-testing task consists of a support set and a query set. Specifically, the meta-training task samples N aspect categories in the source domain, and these N aspect categories form the set of current category labels. K samples are randomly selected from each category to form the support set for the current meta-training task. Each sample is associated with a target aspect and its corresponding sentiment polarity, defined as (x, y) a ,y s The form is ), where x represents the sample statement and y represents the sample statement. a y represents the aspect category of the sample. s This represents the sentiment polarity corresponding to the aspect category. Support set. Further, in the remaining dataset, targeting For each aspect category, randomly sample G samples to form the query set for the current meta-training task. The support set and query set in the target domain are constructed in the same way as those in the meta-training task for the meta-test task.
[0070] 4. Feature Extraction: Based on large-scale language models (such as BERT, RoBERTa, DistilBERT, etc., BERT is used as an example below) for the support sample extraction of semantic awareness in the meta-learning setting, and for the query sample extraction of the query sample in the meta-learning setting, specific aspect semantic awareness query feature vectors for each aspect class are extracted.
[0071] 4.1. Aspect category descriptions are used as prior knowledge to learn aspect semantically aware feature vector representations for support samples. Given a support sample x = {w1, w2, ... w...} consisting of n words... n} and an aspect category description consisting of m words, a = {v1, v2, ... v} m All of these are derived from the support set. The support sample x and the corresponding aspect category description a are concatenated using the special symbols [CLS] and [SEP] to form "[CLS],x,[SEP],a,[SEP]", and then fed into the encoder BERT (BERT: pre-training of deep bidirectional transformers for language understanding. Jacob Devlin et al. Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACLHLT), 2019, pages 4171–4186.), resulting in the hidden state H = [h CLS ,h x ,h SEP ,h a ,h SEP ],in This represents the hidden state vector matrix that supports the samples. The hidden state vector matrix represents the aspect category description, where d is the hidden state dimension. This step selects the mean of the word vectors of the supporting samples (i.e., h). x (mean) as the feature vector of support samples And select the average word vector of the aspect category description (i.e., h) a The mean (mean) serves as a feature vector describing aspect categories. For aspects and categories The final aspect category feature vector is obtained by averaging the feature vectors of K aspect categories that support the same set. in It is the aspect category description feature vector of the i-th supporting sample in aspect category c.
[0072] 4.2. Learn a dedicated query feature vector representation for each aspect class with semantic awareness for the query sample; given a query sample x = {w1, w2, ..., w...} consisting of l words. l The query sample comes from the query set. The query sample x is concatenated into "[CLS],x,[SEP]" and input into the encoder BERT to obtain the hidden state H = [h]. CLS ,h x ,h SEP ],in This represents the hidden state vector matrix of the query sample. This step selects the mean of the word vectors of the query sample (i.e., h). x (mean) as feature vector Because query samples may contain multiple aspect categories, this step requires learning a dedicated query feature vector representation for each aspect category with specific aspect semantic awareness. Specifically, this step will combine the feature vector u of the query sample with the feature vector of the aspect category. The data is concatenated and then processed through two linear layers to extract feature vectors with aspect semantic awareness. This serves as the query feature vector for aspect category c. The specific process is as follows:
[0073] q c =W2(W1[g c ;u]+b1)+B2
[0074] Where [*;*] is the concatenation operation of two feature vectors, and W1, W2, b1 and b2 are learnable parameters.
[0075] 5. Train the auxiliary module for aspect category detection in the meta-training task of the source domain:
[0076] 5.1. Aspect Type Prototype Calculation: This step aims to calculate a prototype for each aspect category. The prototype is a vector representing the central or average feature of that category. The prototype for each aspect category is calculated by leveraging shared aspect information within the support set; all samples within the same aspect category in the support set represent common aspect information. This step utilizes shared information within the class to extract the corresponding class prototype. For aspect categories... This step uses the feature vectors of support samples belonging to the support set of this class to construct a feature vector matrix. The class prototype is constructed by extracting shared information within the class through an attention mechanism. The prototype calculation formula is as follows:
[0077] A1 = softmax(W4tanh(W3O)) c +B3)+B4)
[0078]
[0079] in Let w3, w4, b3, and b4 be the prototype vectors of aspect class c, and w3, w4, b3, and b4 be learnable parameters. This represents the transpose of A1, with softmax and tanh as activation functions.
[0080] 5.2. Cosine Similarity Calculation and Contrast Loss Optimization: The cosine similarity between the prototype of each aspect category and the corresponding query feature vector is calculated. A high similarity means the query sample is closer to that aspect category. By optimizing the contrast loss, it is ensured that similar samples have higher similarity to their corresponding prototypes and lower similarity to other prototypes. The distance between the prototype of each aspect category and the corresponding query feature vector is calculated, and the training objective is optimized using semantic enhancement contrast loss. This step uses cosine similarity to measure the distance between the prototype of the aspect category and the corresponding query feature vector. The cosine distance similarity is defined as follows:
[0081]
[0082] Given a query sample x i and aspect category tags in 1 indicates that the query sample belongs to the t-th aspect category. The cosine distance similarity between the query sample and prototypes of different classes is defined as:
[0083]
[0084]
[0085] in Is it a query sample x? i A dedicated query feature vector for aspect category t.
[0086] A query sample may contain multiple aspect categories. This step uses loss optimization to ensure that the target score is greater than 0 and the non-target score is less than 0, thereby enhancing the aspect semantic awareness capability. For query sample x... i This step constructs the set of positive fractions. and negative fraction set The optimization objective of the semantic enhancement contrast loss is as follows:
[0087]
[0088] Where N is the number of aspect categories, G is the number of query samples in each aspect category, and the base of the log is e.
[0089] 6. Train the aspect sentiment judgment of the main module in the meta-training task of the source domain:
[0090] 6.1. Sentiment Feature Vector Generation: The dedicated query feature vector for each aspect category contains semantic awareness information for that aspect category. This step generates the dedicated query feature vector for the target aspect category. With the feature vector of the query sample By using an attention mechanism to interact and explore relevant emotional information, emotional feature vectors are generated. Multi-head attention is used, with each head acquiring a feature vector. as follows:
[0091]
[0092] This step concatenates the feature vectors obtained from multiple heads. The corresponding sentiment feature vector s c The generation is as follows:
[0093] s c =W5[m1;m2;…;m R ]+b5
[0094] W5 and b5 are learnable parameters.
[0095] 6.2. Transfer the sentiment feature vector s c Sentiment assessment is performed using two linear layers, and a cross-entropy loss function is constructed to optimize the training objective for sentiment assessment.
[0096]
[0097]
[0098] Where W6, W7, b6, and b7 are learnable parameters, and softmax and ReLU are activation functions. Indicates emotional tags, This represents a single aspect category, with the base of the logarithm being e.
[0099] 7. Model Optimization: The final loss function in this step is... The method performs multiple sampling training tasks in the source domain, iteratively optimizes the auxiliary and main modules, and saves the model parameters after meeting the preset conditions for use in the inference stage.
[0100] 8. In the meta-test task of the target domain, aspect sentiment prediction is performed based on the trained auxiliary module and main module:
[0101] 8.1. Generate sentiment feature vectors using dedicated query feature vectors for target categories, perform sentiment determination, and output the predicted sentiment label. That is, the emotional type, such as positive, negative, or neutral.
[0102] 8.2. The data is fed back to the application interface in a preset format to interact with the user.
[0103] 8.3. Statistical model: Determine whether the model should be deployed online based on the average accuracy of sentiment assessment.
[0104] Although the present invention has been disclosed above with reference to embodiments, it is not intended to limit the present invention. Appropriate modifications or equivalent substitutions made by those skilled in the art to the technical solutions of the present invention should be covered within the protection scope of the present invention, which is defined by the claims.
Claims
1. A text sentiment classification method based on aspect semantic enhancement, comprising the following steps: Collect and preprocess user-generated text data from social media platforms; To perform meta-learning N-way K-shot setup, a source domain and a target domain are constructed based on preprocessed text data. A meta-training task is constructed in the source domain, and a meta-test task is constructed in the target domain. A support set and a query set are constructed for each meta-training task and meta-test task, respectively. We use a large-scale language model to extract aspect-semantic-aware support sample feature vectors from the support set, and extract specific query feature vectors for each aspect category from the query set. In the meta-training task of the source domain, the auxiliary module for aspect category detection and the main module for aspect sentiment determination are trained. For the auxiliary module, a prototype of each aspect category is constructed based on the feature vectors of all support samples for each aspect category in the support set; then, the cosine distance similarity between the prototype of each aspect category and its corresponding dedicated query feature vector is calculated, and a semantic enhancement contrastive loss function for the query samples is constructed based on the cosine distance similarity. For the main module, based on the dedicated query feature vector of the target aspect category and the feature vector of the query sample, a multi-head attention mechanism is used to generate a sentiment feature vector; the sentiment feature vector is then passed through two linear layers for aspect sentiment determination, and a cross-entropy loss function is constructed. The total loss function is composed of semantic enhancement contrastive loss function and cross-entropy loss function; the meta-training task is sampled multiple times in the source domain to reduce the total loss, and the auxiliary module and main module are trained and optimized multiple times. The training results of the auxiliary module and main module are tested in the meta-test task in the target domain. Using pre-trained auxiliary and main modules, the system directly predicts the sentiment polarity of the target aspect category of the query sample and outputs the prediction results.
2. The method as described in claim 1, characterized in that, The text data is stored in the form of a database, XML file, JSON file, or TXT file.
3. The method as described in claim 1, characterized in that, The preprocessing includes removing noise and redundant information.
4. The method as described in claim 1, characterized in that, The steps for constructing support sets and query sets for each meta-training task and meta-test task include: Randomly collect N aspect categories from the source domain / target domain to form the set of current category labels, and randomly sample K samples under each category to form the support set of the current meta-training task / meta-test task; After the support set is constructed, multiple samples are randomly sampled from the remaining data for each aspect category of the current category label set to form the query set for the current meta-training task / meta-test task.
5. The method as described in claim 1, characterized in that, The steps for extracting support sample feature vectors include: The support samples and their corresponding aspect category descriptions are extracted from the support set, concatenated, and then input into a large-scale language model for encoding, outputting the latent states of the support samples. The hidden state mean of the support samples is calculated as the feature vector of the support samples.
6. The method as described in claim 5, characterized in that, The steps to extract the specific query feature vector for each aspect class include: In addition to outputting the latent state supporting the sample, the large-scale language model also outputs the latent state describing the aspect class; The mean of the hidden states described by aspect categories is used as the feature vector of aspect category description; The feature vectors of the same aspect category description in the support set are averaged to obtain the aspect category feature vector. Extract query samples from the query set, concatenate them, input them into a large-scale language model for encoding, and output the hidden state of the query samples. Calculate the hidden state mean of the query sample as the feature vector of the query sample; The feature vector of the query sample is concatenated with the feature vector of the aspect category, and a dedicated query feature vector for each aspect category is extracted through two linear layers.
7. The method as described in claim 1, characterized in that, The steps for constructing a prototype for each aspect category based on the feature vectors of all support samples for each aspect category in the support set include: Construct a feature vector matrix based on the feature vectors of all support samples for each aspect category in the support set; The feature vector matrix is processed using an attention mechanism to extract intra-class shared information and construct a prototype for each aspect category.
8. The method as described in claim 1, characterized in that, The steps for constructing a semantically enhanced contrastive loss function for query samples based on the cosine distance similarity include: Based on the query samples and aspect category labels, the cosine distance similarity is divided into a positive score set and a negative score set; Based on the positive and negative score sets, a semantically enhanced contrastive loss function is constructed.
9. The method as described in claim 1, characterized in that, The steps for predicting the sentiment polarity of a target aspect category in a query sample include: Generate sentiment feature vectors by utilizing dedicated query feature vectors for target categories; Use this sentiment feature vector to predict sentiment polarity and output the predicted sentiment type.
10. A text sentiment classification system based on aspect semantic enhancement, characterized in that, include: The corpus information storage module is used to collect and store user-generated text data from social media platforms; The file preprocessing module is used to preprocess text data; The text feature extraction module is used to construct source and target domains based on preprocessed text data, construct meta-training tasks in the source domain, construct meta-test tasks in the target domain, and construct support sets and query sets for each meta-training and meta-test tasks respectively; it uses a large-scale language model to extract aspect semantic awareness support sample feature vectors from the support set, and extracts dedicated query feature vectors for each aspect category from the query set. The aspect category detection module includes an auxiliary module for aspect category detection. It is used to construct a prototype of each aspect category based on the feature vectors of all supporting samples for each aspect category in the support set, and then calculate the cosine distance similarity between the prototype of each aspect category and its corresponding dedicated query feature vector. Aspect category detection is then performed based on the cosine distance similarity. The aspect sentiment determination module includes a main module for aspect sentiment determination, which is used to generate sentiment feature vectors based on the dedicated query feature vectors of the target aspect category and the feature vectors of the query samples, and to perform aspect sentiment determination based on the sentiment feature vectors. The decision output module uses the auxiliary and main modules that have been trained in the meta-training task in the source domain to predict the sentiment polarity of the target aspect category of the query sample in the meta-test task of the target domain, and outputs the prediction results.
Citation Information
Patent Citations
User intention recognition method and system oriented to intelligent home dialogue understanding
CN116151271A
Multi-granularity sentiment analysis method based on joint modeling
CN116303897A