Emotion knowledge enhanced aspect-level sentiment analysis method, system, device and medium

By constructing a dependency graph structure and incorporating sentiment knowledge into aspect-level sentiment analysis, the problem of unstored and unshared sentiment knowledge is solved, enabling dynamic updating and global sharing of sentiment knowledge, thereby improving the model's predictive performance.

CN116383377BActive Publication Date: 2026-05-01GUANGDONG UNIVERSITY OF FOREIGN STUDIES
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG UNIVERSITY OF FOREIGN STUDIES
Filing Date
2023-02-08
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing aspect-level sentiment analysis methods fail to store and update sentiment knowledge and neglect global sharing of sentiment knowledge, leading to biases in the model's perception of opinion words with the same sentiment.

Method used

By constructing a dependency graph structure, incorporating sentiment knowledge and location information, and using graph convolutional networks for the storage, updating, and global sharing of sentiment knowledge, the integration of sentiment knowledge is improved.

Benefits of technology

It improved the model's integration of sentiment knowledge, reduced cognitive bias in the model, and enhanced the accuracy of sentiment analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116383377B_ABST
    Figure CN116383377B_ABST
Patent Text Reader

Abstract

The application discloses an aspect-level sentiment analysis method, system and device based on emotional knowledge and a medium, and can be widely applied in the technical field of sentiment analysis. The application obtains the dependency syntax tree of an input sentence, constructs the dependency graph structure of the sentence according to the dependency syntax tree, and then fuses the emotional knowledge and the position information into the dependency graph structure to obtain the adjacency matrix expressing the correlation between the nodes in the sentence. The global sharing of the emotional knowledge node parameters realizes the storage, updating and sharing of the emotional knowledge, thereby improving the fusion degree of the emotional knowledge. Then, the aspect-level sentiment analysis model is trained according to the sentences in the review corpus and the adjacency matrix, thereby reducing the cognitive bias of the model and improving the prediction performance of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Aspect-level sentiment analysis methods, systems, devices, and media for enhancing sentiment knowledge Technical Field

[0001] This invention relates to the field of sentiment analysis technology, and in particular to an aspect-level sentiment analysis method, system, device, and medium that enhances sentiment knowledge. Background Technology

[0002] In related technologies, aspect-level sentiment analysis refers to predicting the sentiment of different aspects of a given sentence, belonging to fine-grained sentiment analysis tasks. While existing aspect-level sentiment analysis methods based on sentiment knowledge have achieved certain results, the sentiment knowledge is not stored and updated during processing, leading to inefficient fusion of sentiment knowledge and neural networks. Furthermore, they neglect the global sharing of sentiment knowledge, only using information from opinion words in the sentence when fusing sentiment knowledge, failing to fully utilize previously learned sentiment knowledge of similar opinion words, which may cause the model to have biases in its perception of opinion words with the same sentiment. Summary of the Invention

[0003] This invention aims to address at least one of the technical problems existing in the prior art. To this end, this invention proposes an aspect-level sentiment analysis method, system, apparatus, and medium for enhancing sentiment knowledge, which can improve the integration of sentiment knowledge and reduce model cognitive bias.

[0004] On one hand, embodiments of the present invention provide an aspect-level sentiment analysis method with enhanced sentiment knowledge, comprising the following steps:

[0005] Use sentences from the comment corpus as input information;

[0006] Obtain the dependency syntax tree of the input information;

[0007] Construct the dependency graph structure of the sentence based on the dependency syntax tree;

[0008] By incorporating emotional knowledge and location information into the dependency graph structure, an adjacency matrix expressing the relationships between nodes in a sentence is obtained.

[0009] An aspect-level sentiment analysis model is trained based on sentences in the comment corpus and the adjacency matrix.

[0010] Aspect-level sentiment analysis is performed on real-time statements based on the trained aspect-level sentiment analysis model.

[0011] In some embodiments, obtaining the dependency syntax tree of the input information includes:

[0012] Dependency parsing is performed on each sentence of the input information using an open-source natural language processing library to obtain a dependency parsing tree.

[0013] In some embodiments, constructing the dependency graph structure of the sentence based on the dependency syntax tree includes:

[0014] Remove the direction of dependency relations in the dependency syntax tree and construct an undirected dependency graph structure for the sentence. The nodes in the undirected dependency graph structure are used to represent words in the sentence, and the connecting edges in the undirected dependency graph structure are used to represent dependency relations between words.

[0015] In some embodiments, incorporating sentiment knowledge and location information into the dependency graph structure to obtain an adjacency matrix expressing the associations between nodes in a sentence includes:

[0016] Calculate the distance from each word to the aspect to obtain different position weights, which are used to refine the edges of different neighboring nodes;

[0017] Add sentiment knowledge nodes to the dependency graph structure, including positive sentiment nodes and negative sentiment nodes;

[0018] Obtain the viewpoint words of sentences in the dependency graph structure;

[0019] Determine the sentiment category of the opinion words, which includes positive sentiment and negative sentiment;

[0020] Connect the opinion words to the positive or negative sentiment nodes based on their sentiment category;

[0021] Calculate the position weights of the edges connecting the two nodes to obtain the corresponding adjacency matrix.

[0022] In some embodiments, obtaining the viewpoint words of sentences in the dependency graph structure includes:

[0023] The opinion words of sentences in the dependency graph structure are obtained by using an emotion dictionary.

[0024] In some embodiments, training an aspect-level sentiment analysis model based on sentences in the comment corpus and the adjacency matrix includes:

[0025] Sentences in the comment corpus are represented using word vector sequences, and positional encodings of the sentences are constructed.

[0026] The input sentence is obtained by concatenating the word vector sequence and the positional encoding.

[0027] The input sentence is encoded using an aspect-level sentiment analysis model encoder;

[0028] Obtain the representation of globally shared sentiment knowledge nodes;

[0029] The representations of the sentiment knowledge nodes, the encoded input sentence, and the adjacency matrix are input into a sentiment knowledge-enhanced graph convolutional neural network to obtain the representations of all nodes in the sentence.

[0030] The prediction result is obtained by inputting the representation of the aspect nodes in the sentence into a fully connected layer;

[0031] Calculate the difference between the predicted result and the correct result;

[0032] The aspect-level sentiment analysis model is optimized based on the differences, and the sentiment knowledge node parameters are updated. These sentiment knowledge node parameters are shared by all sentences in the corpus.

[0033] In some embodiments, calculating the difference between the predicted result and the correct result includes:

[0034] The difference between the predicted result and the correct result is calculated using the cross-entropy loss function.

[0035] On the other hand, embodiments of the present invention provide an aspect-level sentiment analysis system with enhanced sentiment knowledge, comprising:

[0036] The first module is used to take sentences from the comment corpus as input information;

[0037] The second module is used to obtain the dependency syntax tree of the input information;

[0038] The third module is used to construct the dependency graph structure of the sentence based on the dependency syntax tree;

[0039] The fourth module is used to integrate sentiment knowledge and location information into the dependency graph structure to obtain an adjacency matrix that expresses the associations between nodes in the sentence;

[0040] The fifth module is used to train an aspect-level sentiment analysis model based on sentences in the comment corpus and the adjacency matrix.

[0041] The sixth module is used to perform aspect-level sentiment analysis on real-time statements based on the trained aspect-level sentiment analysis model.

[0042] On the other hand, embodiments of the present invention provide an aspect-level sentiment analysis device with enhanced sentiment knowledge, comprising:

[0043] At least one memory for storing programs;

[0044] At least one processor is used to load the program to execute the aspect-level sentiment analysis method for enhancing sentiment knowledge.

[0045] On the other hand, embodiments of the present invention provide a storage medium storing a computer-executable program, which, when executed by a processor, is used to implement the aspect-level sentiment analysis method for enhancing sentiment knowledge.

[0046] The aspect-level sentiment analysis method with enhanced sentiment knowledge provided in this invention has the following beneficial effects:

[0047] This embodiment obtains the dependency syntax tree of the input sentence and constructs the dependency graph structure of the sentence based on the dependency syntax tree. Then, by integrating sentiment knowledge and positional information into the dependency graph structure, an adjacency matrix expressing the association between nodes in the sentence is obtained. Through the global sharing of sentiment knowledge node parameters, the storage, updating, and sharing of sentiment knowledge are realized, thereby improving the fusion degree of sentiment knowledge. Finally, an aspect-level sentiment analysis model is trained based on sentences and adjacency matrices in the comment corpus, thereby reducing model cognitive bias and improving model prediction performance.

[0048] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0049] The present invention will be further described below with reference to the accompanying drawings and embodiments, wherein:

[0050] Figure 1 is a schematic diagram of an example of an aspect-level sentiment analysis model for enhancing sentiment knowledge according to an embodiment of the present invention;

[0051] Figure 2 is a flowchart of an aspect-level sentiment analysis method for enhancing sentiment knowledge according to an embodiment of the present invention;

[0052] Figure 3 is a flowchart of step S240 in Figure 2 of the embodiment of the present invention;

[0053] Figure 4 is an example diagram of the fusion mechanism in an embodiment of the present invention;

[0054] Figure 5 is a flowchart of step S250 in Figure 2 of the embodiment of the present invention. Detailed Implementation

[0055] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0056] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.

[0057] In the description of this invention, unless otherwise explicitly defined, terms such as "setup" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this invention in conjunction with the specific content of the technical solution.

[0058] In the description of this invention, the terms "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0059] Before describing the specific implementation, the terms used in the embodiments of this application are explained:

[0060] Aspect-Based Sentiment Analysis (ABSA): ABSA predicts the sentiment of different aspects of a given sentence, such as whether it is positive, neutral, or negative. ABSA is a fine-grained sentiment analysis task.

[0061] Opinion words: The English term for opinion words is "opinion words." Opinion words refer to words in an aspect-level sentiment analysis task that indicate a clear subjective sentiment in a sentence.

[0062] Sentimental knowledge refers to the prior knowledge humans use to judge the sentiment of texts, sentences, or words. It can be obtained through external resources, such as human-built sentiment dictionaries. By consulting a sentiment dictionary, one can learn information such as the sentiment polarity label and sentiment intensity score of opinion words.

[0063] In aspect-level sentiment analysis tasks, which predict the sentiment of different aspects of a given sentence, it is an important task in the field of natural language processing and belongs to fine-grained sentiment analysis tasks. For example, given the sentence "Great food but the service was dreadful!", the two aspects of the sentence and their corresponding sentiments are:

[0064] Aspect 1: "food" - Emotion: positive

[0065] Aspect 2: "service" – Emotion: negative

[0066] Figure 1 illustrates an example of aspect-level sentiment analysis. Given the sentence "Great food but the service was dreadful!", taking the aspect "food" as an example, the model predicts its sentiment to be "positive".

[0067] With the widespread application of deep neural network methods in aspect-level sentiment analysis tasks, some studies have used graph convolutional networks to learn syntactic information in sentences and achieved good results. However, most of these models neglect the role of sentiment knowledge. Humans possess rich prior sentiment knowledge, which allows them to judge the sentiment of sentences. However, neural network models lack this sentiment knowledge and may overlook sentiment information in sentences, leading to misjudgments. If sentiment knowledge could be effectively integrated into neural networks, it could better help models predict sentiment correctly. Based on this idea, some studies have attempted to improve the performance of aspect-level sentiment analysis models by utilizing sentiment knowledge. The main approach of these methods is to first obtain the sentiment knowledge of each word from external resources, and then encode this knowledge into feature vectors to supplement the sentiment information represented by each word.

[0068] A sentiment lexicon is an important source of sentiment knowledge and a crucial resource for sentiment analysis. Sentiment lexicons (e.g., Bing Liu's opinion lexicon) record words representing positive and negative sentiments, and some (e.g., SenticNet 6) also include sentiment scores or related conceptual knowledge for each word. Existing sentiment knowledge fusion methods can be categorized into three types: (1) fusion methods based on Long Short-Term Memory (LSTM) networks; (2) fusion methods based on attention; and (3) fusion methods based on Graph Convolutional Networks (GCN).

[0069] Fusion methods based on Long Short-Term Memory (LSTM) networks utilize the gating mechanism of LSTM networks to transfer the sentiment knowledge of words within the sequence. Standard LSTM networks calculate the current time-series encoding representation based on the current word representation and the previous time-series encoding; however, these representations do not learn the sentiment knowledge of the words. To enable the model to generate word representations with sentiment information, existing approaches obtain sentiment-related conceptual knowledge from a sentiment lexicon and add feature vectors of this conceptual knowledge when encoding words, thereby better understanding the sentiment contained in each word. Furthermore, because the gating mechanism of LSTM networks controls the flow of information, the conceptual knowledge of words is also transferred during the encoding process, passing the sentiment knowledge contained in one word to other words.

[0070] By embedding sentiment knowledge into an LSTM network, the word vectors computed by the model simultaneously contain semantic and sentiment information. When calculating attention for each word in a sentence, words with rich sentiment information receive more attention, thereby improving the model's predictive performance. The advantage of this type of method is that it can effectively transfer sentiment information by combining gating mechanisms and external knowledge. For words with rich sentiment information, their sentiment knowledge can be preserved as much as possible and provided to the next word; while for words with less sentiment information, their sentiment knowledge is likely to be filtered out. The disadvantage is that LSTM networks are temporally dependent, and the transfer of sentiment knowledge can only proceed in a certain direction.

[0071] Attention-based fusion methods use the sentiment polarity or sentiment score of words as their sentiment features and refine the attention weight allocation for each word based on these features, enabling the model to maintain a higher level of attention to opinion words. In previous work, attention mechanisms have been widely used to calculate the relevance between aspects and context in sentences, allowing the model to focus on important contexts related to aspects. However, due to a lack of prior sentiment knowledge, the model may fail to fully learn the relevance between some opinion words and aspects, causing the attention mechanism to ignore these words that contribute significantly. To improve the model's sensitivity to opinion words, existing approaches first query the sentiment scores of the same word in multiple sentiment dictionaries, using these scores as the word's sentiment features. The relevance between each word and aspect is then calculated by combining the word's encoded representation and sentiment features. Since the sentiment score of non-opinion words is zero, the model will pay more attention to opinion words with sentiment scores when calculating attention, learning the important information of opinion words in the sentence. The advantage of this approach is that the attention mechanism not only considers semantic relevance but also enhances the role of sentiment knowledge. The disadvantage is that it may increase the model's attention to opinion words from other aspects, leading to prediction errors.

[0072] The fusion method based on graph convolutional networks utilizes the node update method in graph convolutional networks to embed the sentiment knowledge of words into the nodes or edges of the graph, and realizes the flow of sentiment knowledge in the graph structure based on the dependency relationship between words.

[0073] For node-based sentiment knowledge fusion, existing methods first use dependency parsing to establish connections between words, then extract conceptual knowledge for each word from a sentiment lexicon, treating each concept as a new node and connecting it to the word itself. In addition to words in the sentence, the graph structure introduces many conceptual knowledge nodes. The aim of this approach is to model sentiment knowledge as nodes and then pass them to words using a graph convolutional network. After computation through the graph convolutional network layers, the model can learn contextual information and external sentiment knowledge, thereby improving model performance. The advantage of this approach is that it fully leverages the node aggregation characteristics of graph convolutional networks, learning both contextual and word-specific sentiment information. However, the disadvantage is that the number of conceptual knowledge nodes may exceed the number of word nodes, affecting the aggregation of information from word nodes.

[0074] Existing methods for incorporating sentiment knowledge using edges take into account the varying contributions of neighboring nodes. They use the sentiment score of words to increase the weight of edges, allowing words with high sentiment scores to convey more information to other nodes. Since opinion words have relatively high sentiment scores, the important sentiment information they contain can be better learned by other words. The specific approach is as follows: First, dependency parsing is used to establish connections between words, with each edge connecting words having a weight of 1. Then, for words connected to aspects, the weight of their edges is increased by an additional 1. Finally, the weight of each edge is increased by the sum of the sentiment scores of the two connected words. After this improvement, edges related to aspects or opinion words have higher weights, enabling the model to capture more aspect context information and the sentiment features of opinion words. The advantage of this approach is that it enhances the contribution of opinion words with sentiment knowledge without introducing additional nodes. However, the disadvantage is that for words with low sentiment scores, the weight increase of edges is not significant, which is detrimental to the model's learning of these opinion words.

[0075] Therefore, the existing methods have the following problems:

[0076] First, affective knowledge is not stored and updated. As a form of common-sense knowledge, affective knowledge is something humans develop and update during the learning process. Existing methods use the affective knowledge of words as an additional emotional feature without considering designing a mechanism to store and update affective knowledge. This leads to inefficient integration of affective knowledge and neural networks.

[0077] Second, it neglects the global sharing of sentiment knowledge. Although sentiment expressions within the same domain may differ, the sentiment knowledge between these expressions is shared. Existing methods ignore this global sharing of sentiment knowledge, only utilizing information from opinion words within sentences when fusing sentiment knowledge, failing to fully leverage previously learned sentiment knowledge of similar opinion words. Because the connections between opinion words with the same sentiment are not learned, the model may exhibit bias in its perception of opinion words with the same sentiment.

[0078] To address the aforementioned issues, this application provides an aspect-level sentiment analysis method, system, apparatus, and medium for enhancing sentiment knowledge. This embodiment fully considers the characteristics of sentiment knowledge storage, updating, and global sharing, and leverages the powerful feature aggregation capabilities of graph convolutional networks to propose a sentiment enhancement graph structure. This application embodiment can store learned sentiment knowledge, update the understanding of sentiment knowledge, and then share the sentiment knowledge with viewpoint words sharing the same sentiment to supplement sentiment information, thereby effectively improving the model's predictive performance.

[0079] The embodiments of this application are described below with reference to the accompanying drawings:

[0080] Referring to Figure 2, this embodiment of the invention provides an aspect-level sentiment analysis method with enhanced sentiment knowledge. The method of this embodiment can be applied to a cloud server, an edge server, or a background processor corresponding to a sentiment analysis platform.

[0081] In the application process, the embodiments of this application include, but are not limited to, the following steps:

[0082] Step S210: Use sentences from the comment corpus as input information;

[0083] Step S220: Obtain the dependency syntax tree of the input information;

[0084] Step S230: Construct the dependency graph structure of the sentence based on the dependency syntax tree;

[0085] Step S240: Integrate sentiment knowledge and location information into the dependency graph structure to obtain the adjacency matrix that expresses the association between nodes in the sentence;

[0086] Step S250: Train an aspect-level sentiment analysis model based on sentences and adjacency matrices in the comment corpus;

[0087] Step S260: Perform aspect-level sentiment analysis on real-time sentences based on the trained aspect-level sentiment analysis model.

[0088] In this embodiment, dependency parsing can be performed on each sentence of the input information using an open-source natural language processing library to obtain a dependency syntax tree. When constructing the dependency graph structure of the sentence based on the dependency syntax tree, the direction of the dependency relations in the dependency syntax tree can be removed to construct an undirected dependency graph structure. In this embodiment, nodes in the undirected dependency graph structure represent words in the sentence, and connecting edges in the undirected dependency graph structure represent dependency relations between words.

[0089] In this embodiment of the application, as shown in Figure 3, the process of integrating sentiment knowledge and location information into the dependency graph structure to obtain an adjacency matrix expressing the associations between nodes in a sentence can be achieved through the following steps:

[0090] Step S310: Calculate the distance from each word to the aspect to obtain different position weights, where the position weights are used to refine the edges of different neighboring nodes;

[0091] Step S320: Add sentiment knowledge nodes to the dependency graph structure, wherein the sentiment knowledge nodes include positive sentiment nodes and negative sentiment nodes;

[0092] Step S330: Obtain the opinion words of sentences in the dependency graph structure; specifically, opinion words in sentences in the dependency graph structure can be obtained through a sentiment dictionary.

[0093] Step S340: Determine the sentiment category of the opinion words, where the sentiment category of opinion words includes positive sentiment and negative sentiment;

[0094] Step S350: Connect opinion words with positive or negative sentiment nodes according to their sentiment category;

[0095] Step S360: Calculate the position weights of the connecting edges between two nodes to obtain the corresponding adjacency matrix.

[0096] In the embodiments of this application, the processing of the sentiment enhancement graph convolutional network includes three processes: construction of dependency graph structure, refinement of location information, and fusion of sentiment knowledge, in order to achieve the goals of storage, updating, sharing, and migration.

[0097] Understandably, in the process of constructing the dependency graph structure, this embodiment first uses the open-source natural language processing library spaCy to perform dependency parsing on each sentence, obtaining a sentence dependency tree. The directions of dependency relations in the dependency tree are removed, and an undirected dependency graph is constructed for each sentence to fully utilize the syntactic structure. In the dependency graph, each word in the sentence is a node, and edges are formed between words with dependency relations. The constructed dependency graph is defined as G = {V, E, A}, where V = {v...} word} is a set of nodes, E = {e wLet} be the set of edges, and A be the adjacency matrix. Where v word Represents a word node; e w This represents the dependency relationships between word nodes. The specific description of the adjacency matrix A is shown in formula (1):

[0098]

[0099] In formula (1), A∈R n×n w i and w j Representing the i-th and j-th words in the sentence, (w i ,w j () indicates the relationship between two nodes.

[0100] During the refinement of location information, the closer the context is to an aspect, the higher its importance. Context is more likely to describe the nearest aspect rather than other more distant aspects. To focus on contexts close to aspects, this embodiment designs a location weight to refine the adjacency matrix. Its purpose is to reduce noise from contexts unrelated to aspects and distinguish the contributions of words at different positions. The updated adjacency matrix is ​​shown in Equations (2) to (4):

[0101]

[0102]

[0103]

[0104] Where, d j This represents the relative distance from the j-th word in the sentence to the aspect. For the word to the left of the aspect, calculate its distance to the first word of the aspect, w. τ+1 The distance; for the word to the right of an aspect, calculate its distance to the last word of the aspect. τ+m The distance is zero for words in the same direction; for words in the same direction, the distance is zero. j Let A represent the position weight of the j-th word. Since the distances to the i-th and j-th words are different, A... ij and A ji They are not equal. Therefore, after the adjacency matrix is ​​refined with positional information, the resulting graph structure is a directed graph.

[0105] While existing research on affective knowledge fusion has achieved good results, the different fusion mechanisms between affective knowledge and neural networks still warrant further exploration. Therefore, a good knowledge-based model should store, update, and share affective knowledge. Based on this motivation, unlike previous work, this embodiment designs a corpus-level affective knowledge fusion mechanism with storage, updating, and sharing functions, enabling the model to better understand various viewpoint expressions of similar emotions in the corpus.

[0106] Since most sentiment dictionaries categorize words into positive and negative sentiments, similarly, the model can build positive and negative sentiment knowledge bases to store their respective sentiment knowledge, continuously updating the learned sentiment knowledge in the process. With the dynamic updating of sentiment knowledge, the model can share knowledge learned from the entire corpus. To this end, this embodiment introduces two sentiment knowledge nodes (called POS-node and NEG-node) into the graph structure described above. By consulting the sentiment dictionary to determine whether a word is an opinion word, opinion words are connected to their corresponding sentiment knowledge nodes. After the graph convolutional network updates the node representations, the sentiment knowledge nodes aggregate the features of opinion words in the sentence; this process is called knowledge storage.

[0107] To enable the model to remember learned sentiment knowledge, sentiment knowledge nodes need to be updated as the model trains. Therefore, we first set two knowledge nodes as randomly initialized sentiment embeddings. As training progresses, the sentiment embeddings continuously aggregate the vector representations of words with similar sentiments. During backpropagation, the trainable sentiment embeddings update their own vector representations, causing the initialization of sentiment knowledge nodes in the next training iteration to also change. This process is called knowledge update.

[0108] Since knowledge nodes are initialized with vector representations of sentiment embeddings, this embodiment sets two sentiment knowledge nodes to be globally shared so that the sentiment embeddings can learn the opinion words of the entire corpus during dynamic updates. In the graph structure of each sentence, the knowledge nodes provide the current sentence's opinion words with the sentiment information of the opinion words already learned in the entire corpus. Thanks to the globally shared nature of the knowledge nodes, the model in this embodiment is no longer limited to using only the sentiment knowledge of a few opinion words when training sentences. For opinion words that have never appeared in the training set, the sentiment knowledge nodes can help these words generate better sentiment perception representations, thereby promoting the model's accurate prediction of sentiment polarity; this process is called knowledge sharing.

[0109] After the above design, the final dependency graph is defined as G = {V, E, A}, where the node set V = {v...} word ,v pos ,v neg}, edge set E = (e w ,e w), where v pos and v neg Represents knowledge nodes indicating positive and negative emotions; e s This indicates whether a word represents a positive or negative viewpoint. The final adjacency matrix A∈R (n+2)×(n+2) The update is as shown in formula (5):

[0110]

[0111] To more clearly illustrate the fusion mechanism of this embodiment, an example is used to demonstrate the sentiment knowledge enhancement graph structure proposed in this embodiment, as shown in Figure 4. For the sentence "Great food but the service was dreadful!", a dependency graph is first obtained, and positional weights are used to refine the edges of the graph structure. Then, opinion words are connected to their corresponding sentiment knowledge nodes by looking up the sentiment lexicon. For example, when the word "great" is marked as positive, it is connected to the POS-node (positive sentiment node), and since the word "dreadful" is marked as negative, it is connected to the NEG-node (negative sentiment node).

[0112] After constructing the sentiment knowledge enhancement graph structure, a graph convolutional network is used to aggregate the feature information of neighboring nodes and then update its own representation, thus realizing the transfer of sentiment knowledge. The training process of the graph convolutional network is shown in formula (6):

[0113]

[0114] in, It is a normalized adjacency matrix. Vertex A i The degree.

[0115] In this embodiment of the application, as shown in Figure 5, training an aspect-level sentiment analysis model based on sentences and adjacency matrices in a comment corpus can be achieved in the following way:

[0116] Step S510: Use word vector sequences to represent sentences in the comment corpus and construct sentence position codes;

[0117] Step S520: Concatenate the word vector sequence and positional encoding to obtain the input sentence;

[0118] Step S530: Encode the input sentence using an aspect-level sentiment analysis model encoder;

[0119] Step S540: Obtain the representation of globally shared sentiment knowledge nodes;

[0120] Step S550: Input the representation of the sentiment knowledge nodes, the encoded input sentence, and the adjacency matrix into the sentiment knowledge-enhanced graph convolutional neural network to obtain the representation of all nodes in the sentence;

[0121] Step S560: Input the representation of aspect nodes in the sentence into the fully connected layer to obtain the prediction result;

[0122] Step S570: Calculate the difference between the predicted result and the correct result;

[0123] Step S580: Optimize the aspect-level sentiment analysis model based on the differences and update the sentiment knowledge node parameters, wherein the sentiment knowledge node parameters are shared by all sentences in the corpus.

[0124] In this embodiment, the difference between the predicted result and the correct result can be calculated using the cross-entropy loss function. A loss function or cost function maps the values ​​of a random event or its related random variables to non-negative real numbers to represent the "risk" or "loss" of that random event. In applications, the loss function is often used as a learning criterion in relation to optimization problems; that is, the model is solved and evaluated by minimizing the loss function.

[0125] After training the aspect-level sentiment analysis model, aspect-level sentiment analysis can be performed on real-time sentences using the trained model, thereby effectively improving the accuracy of sentiment analysis.

[0126] In summary, the aspect-level sentiment analysis method with enhanced sentiment knowledge provided by the embodiments of the present invention has the following beneficial effects:

[0127] First, the sentiment knowledge nodes are dynamically updated with the learned knowledge. Since the sentiment knowledge nodes are trainable word embeddings, they can update their own representations with various opinion words that express emotions learned from comments, helping the model to better distinguish and understand the sentiment of opinion words.

[0128] Second, the shared knowledge nodes fully utilize global sentiment knowledge. For all input sentences, the initial representations of the two sentiment knowledge nodes are globally shared, and knowledge learned from other sentences can be provided to the current sentence. With the help of global sentiment knowledge, the neural network model is able to better determine the sentiment of opinion words that appear less frequently or have low sentiment scores.

[0129] This invention provides an aspect-level sentiment analysis system with enhanced sentiment knowledge, comprising:

[0130] The first module is used to take sentences from the comment corpus as input information;

[0131] The second module is used to obtain the dependency syntax tree of the input information;

[0132] The third module is used to construct the dependency graph structure of sentences based on the dependency syntax tree;

[0133] The fourth module is used to integrate sentiment knowledge and location information into the dependency graph structure to obtain an adjacency matrix that expresses the relationships between nodes in a sentence;

[0134] The fifth module is used to train an aspect-level sentiment analysis model based on sentences and adjacency matrices from the comment corpus.

[0135] The sixth module is used to perform aspect-level sentiment analysis on real-time statements based on the trained aspect-level sentiment analysis model.

[0136] The content of the method embodiments of the present invention is applicable to the system embodiments. The specific functions implemented in the system embodiments are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.

[0137] This invention provides an aspect-level sentiment analysis device with enhanced sentiment knowledge, comprising:

[0138] At least one memory for storing programs;

[0139] At least one processor is used to load the program to execute the aspect-level sentiment analysis method with enhanced sentiment knowledge as shown in Figure 2.

[0140] The content of the method embodiments of the present invention is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.

[0141] This invention provides a storage medium storing a computer-executable program, which, when executed by a processor, is used to implement the aspect-level sentiment analysis method for enhancing sentiment knowledge as shown in Figure 2.

[0142] The content of the method embodiments of the present invention is applicable to the storage medium embodiments. The specific functions implemented by the storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.

[0143] This invention also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aspect-level sentiment analysis method with enhanced sentiment knowledge shown in FIG2.

[0144] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention. Furthermore, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other.

Claims

1. An aspect-level sentiment analysis method for enhancing emotional knowledge, characterized in that, Includes the following steps: Use sentences from the comment corpus as input information; Obtain the dependency syntax tree of the input information; Construct the dependency graph structure of the sentence based on the dependency syntax tree; By incorporating emotional knowledge and location information into the dependency graph structure, an adjacency matrix is ​​obtained that expresses the relationships between nodes in a sentence. An aspect-level sentiment analysis model is trained based on sentences in the comment corpus and the adjacency matrix; aspect-level sentiment analysis is performed on real-time sentences based on the trained aspect-level sentiment analysis model; wherein, the integration of sentiment knowledge and positional information into the dependency graph structure to obtain an adjacency matrix expressing the associations between nodes in the sentence includes: calculating the distance from each word to the aspect to obtain different positional weights, the positional weights being used to refine the edges of different neighboring nodes; adding sentiment knowledge nodes to the dependency graph structure, the sentiment knowledge nodes including positive sentiment nodes and negative sentiment nodes; obtaining the opinion words of the sentences in the dependency graph structure; determining the sentiment category of the opinion words, the sentiment categories of the opinion words including positive sentiment and negative sentiment; connecting the opinion words with the positive sentiment nodes or negative sentiment nodes according to the sentiment category of the opinion words; calculating the positional weights of the connecting edges between the two nodes to obtain the corresponding adjacency matrix; defining the dependency graph structure as... Node set edge set The adjacency matrix The formula is as follows: ;in, and Knowledge nodes representing positive and negative emotions; Indicates whether a word represents a positive or negative viewpoint. This represents the position weight of the j-th word. and Representing the i-th and j-th words in the sentence, This indicates the relationship between two nodes.

2. The aspect-level sentiment analysis method for enhancing sentiment knowledge according to claim 1, characterized in that, The process of obtaining the dependency syntax tree of the input information includes: performing dependency parsing on each sentence of the input information using an open-source natural language processing library to obtain the dependency syntax tree.

3. The aspect-level sentiment analysis method for enhancing sentiment knowledge according to claim 2, characterized in that, The step of constructing the dependency graph structure of the sentence based on the dependency syntax tree includes: removing the direction of the dependency relations in the dependency syntax tree, constructing an undirected dependency graph structure of the sentence, wherein the nodes in the undirected dependency graph structure are used to represent words in the sentence, and the connecting edges in the undirected dependency graph structure are used to represent the dependency relations between words.

4. The aspect-level sentiment analysis method for enhancing sentiment knowledge according to claim 1, characterized in that, The step of obtaining the opinion words of sentences in the dependency graph structure includes: obtaining the opinion words of sentences in the dependency graph structure through a sentiment dictionary.

5. The aspect-level sentiment analysis method for enhancing sentiment knowledge according to claim 1, characterized in that, The step of training an aspect-level sentiment analysis model based on sentences in the comment corpus and the adjacency matrix includes: representing sentences in the comment corpus using word vector sequences and constructing positional encodings for the sentences; concatenating the word vector sequences and the positional encodings to obtain an input sentence; encoding the input sentence using an aspect-level sentiment analysis model encoder; obtaining representations of globally shared sentiment knowledge nodes; inputting the representations of the sentiment knowledge nodes, the encoded input sentence, and the adjacency matrix into a sentiment knowledge-enhanced graph convolutional neural network to obtain representations of all nodes in the sentence; inputting the representations of the aspect nodes in the sentence into a fully connected layer to obtain a prediction result; calculating the difference between the prediction result and the correct result; optimizing the aspect-level sentiment analysis model based on the difference and updating the sentiment knowledge node parameters, wherein the sentiment knowledge node parameters are shared by all sentences in the corpus.

6. The aspect-level sentiment analysis method for enhancing sentiment knowledge according to claim 5, characterized in that, The calculation of the difference between the predicted result and the correct result includes: calculating the difference between the predicted result and the correct result using the cross-entropy loss function.

7. An aspect-level sentiment analysis system with enhanced sentiment knowledge, characterized in that, The system is applied to the method described in any one of claims 1-6, comprising: a first module for using sentences from a comment corpus as input information; a second module for obtaining a dependency syntax tree of the input information; a third module for constructing a dependency graph structure of the sentence based on the dependency syntax tree; a fourth module for integrating sentiment knowledge and location information into the dependency graph structure to obtain an adjacency matrix expressing the associations between nodes in the sentence; a fifth module for training an aspect-level sentiment analysis model based on sentences from the comment corpus and the adjacency matrix; and a sixth module for performing aspect-level sentiment analysis on real-time sentences based on the trained aspect-level sentiment analysis model.

8. An aspect-level sentiment analysis device for enhancing sentiment knowledge, characterized in that, include: At least one memory for storing programs; At least one processor is configured to load the program to execute the aspect-level sentiment analysis method for enhancing sentiment knowledge as described in any one of claims 1-6.

9. A storage medium, characterized in that, It contains a computer-executable program, which, when executed by a processor, is used to implement the aspect-level sentiment analysis method for enhancing sentiment knowledge as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Aspect-level sentiment classification method based on knowledge enhancement syntactic heterogeneous graph

    CN115269847A