Aspect-level sentiment analysis optimization method based on multivariate external knowledge fusion
By constructing diverse external knowledge sources and introducing a gating fusion mechanism, combined with segmented convolution and attention mechanisms, the problem of neglecting Chinese context in existing sentiment analysis is solved, achieving accurate modeling of aspect words and efficient identification of sentiment polarity.
Patent Information
- Application Number
- CN202511646232.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-11
- Publication Date
- 2026-02-10
AI Technical Summary
Existing sentiment analysis techniques neglect the emotional polarity of words in the Chinese context, the attributes of domain entities, and users' expression habits, leading to misjudgments of implicit emotions and domain terms. Furthermore, ordinary convolution or attention mechanisms are unable to accurately capture the local features of key evaluation segments before and after aspect words.
We construct a diverse set of external knowledge sources, including a Chinese sentiment dictionary, a domain knowledge graph, and a user comment prior pattern library. Combining semantic encoding and dependency parsing, we dynamically adjust the knowledge contribution weights through a gating fusion mechanism, prune grammatical paths, and introduce segmented convolution and gating attention mechanisms to perform semantic information aggregation and sentiment polarity classification.
It improves the accuracy and robustness of aspect-level sentiment analysis, accurately captures local features and long-distance dependencies, and enhances the ability to identify sentiment polarity in complex contexts.
Smart Images

Figure CN121503491A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of sentiment analysis optimization technology, and in particular to an aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge. Background Technology
[0002] Sentiment analysis optimization technology refers to a comprehensive technical system that, based on traditional sentiment analysis methods, introduces deeper language understanding mechanisms and external knowledge support to improve the accuracy, robustness, and interpretability of sentiment recognition. Therefore, how to utilize advanced technologies to improve the intelligence and security of sentiment analysis optimization has become one of the most pressing issues to be addressed.
[0003] In the field of sentiment analysis optimization, existing technologies mostly rely on the semantic information of the text itself, ignoring the guiding role of prior knowledge such as the emotional polarity of words in the Chinese context, domain entity attributes, and user expression habits. The coverage of a single knowledge source is incomplete, which can easily lead to misjudgment of implicit emotions, irony, or domain terms. Moreover, ordinary convolution or attention mechanisms are difficult to accurately capture the local features of key evaluation segments before and after aspect words. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides an aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge sources. This addresses the problems of existing technologies that rely heavily on the semantic information of the text itself, neglecting the guiding role of prior knowledge such as the emotional polarity of words in the Chinese context, domain entity attributes, and user expression habits. The coverage of a single knowledge source is incomplete, which can easily lead to misjudgment of implicit emotions, irony, or domain terms. Furthermore, ordinary convolution or attention mechanisms are unable to accurately capture the local features of key evaluation segments before and after aspect words.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] In a first aspect, the present invention provides an aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge sources, comprising:
[0008] Construct a diverse external knowledge source that includes a Chinese sentiment dictionary, a domain knowledge graph, and a user comment prior pattern library to provide lexical-level sentiment polarity, entity attribute relationships, and high-frequency evaluation semantic patterns;
[0009] Semantic encoding is performed on the input text and specified aspect words to generate contextual semantic representations, and global semantic features and local positional features are extracted by combining aspect word position information;
[0010] Based on the semantic encoding results, the various external knowledge sources are transformed into structured knowledge representations, and the contribution weights of various knowledge types are dynamically adjusted through a gating fusion mechanism to generate a fused knowledge representation.
[0011] Dependency parsing is performed on the input text to construct the original syntactic structure, and the relevance strength between each grammatical component and aspect words is calculated by combining the contextual semantic representation.
[0012] The original syntactic structure is pruned based on the relevance strength, retaining the grammatical paths that are closely related to the semantics of aspect words, thus forming a simplified local sentiment perception dependency structure.
[0013] Semantic information is aggregated on the local emotion perception dependency structure, and the contextual semantic representation is updated to obtain an enhanced semantic representation that incorporates syntactic constraints.
[0014] The enhanced semantic representation and the fused knowledge representation are jointly modeled to output the sentiment polarity classification result for the specified aspect words.
[0015] As a preferred embodiment of the aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion described in this invention, the specific steps for constructing a multi-source external knowledge source including a Chinese sentiment dictionary, a domain knowledge graph, and a user comment prior pattern library are as follows:
[0016] Acquire Chinese sentiment dictionary data, which contains words and their corresponding sentiment polarity values, and map each word to a sentiment score;
[0017] Acquire domain knowledge graph data, which consists of entity, attribute, and relation triples and is used to describe the semantic context of aspect terms;
[0018] We acquire user comment corpora and perform pattern mining to extract high-frequency evaluation expression structures, generating a set of semantic templates with sentiment tags to form a prior pattern library for user comments.
[0019] As a preferred embodiment of the aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion described in this invention, the steps of semantically encoding the input text and specified aspect words to generate contextual semantic representations, and extracting global semantic features and local positional features by combining aspect word position information, are as follows:
[0020] The input text is combined with specified aspect words to form a structured input sequence, which is then input into a pre-trained language model for encoding processing.
[0021] The vector representation corresponding to each text unit in the output sequence constitutes a sequence of contextual semantic representations.
[0022] The vector of the starting position of the sequence is extracted as a global semantic feature to represent the overall semantics of the entire sentence;
[0023] Based on the start and end positions of the terms in the input text;
[0024] Calculate the relative distance between each text unit and aspect word in the context semantic representation sequence to generate local position feature vectors.
[0025] As a preferred embodiment of the aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion described in this invention, the steps of converting multi-source external knowledge into structured knowledge representations based on semantic encoding results, and dynamically adjusting the contribution weights of various knowledge types through a gating fusion mechanism to generate a fused knowledge representation are as follows:
[0026] Based on the semantic features of each word in the context semantic representation, the corresponding sentiment scores are matched in the Chinese sentiment dictionary to generate a sentiment dictionary knowledge representation vector;
[0027] Based on the entity identifiers corresponding to the terms, retrieve their relevant attributes and relationship paths in the domain knowledge graph, and generate a structured embedding vector for the knowledge graph.
[0028] The input text is semantically similar to the semantic templates in the prior pattern library of user comments. The template with the highest matching degree is selected to generate a pattern matching knowledge representation vector.
[0029] The control vector is generated by concatenating the global semantic features with the corresponding vectors of aspect words and then performing a linear transformation.
[0030] The control vector is input into the activation function, which outputs three normalized weight coefficients, which are used to adjust the fusion ratio of sentiment dictionary knowledge representation, knowledge graph structured embedding, and pattern matching knowledge representation, respectively.
[0031] The three types of knowledge representation vectors are weighted and summed based on three weight coefficients to obtain the fused knowledge representation. Its expression is:
[0032] ;
[0033] in, To integrate knowledge representation, For the knowledge representation of the emotion dictionary, For structured embedding of knowledge graphs, This is a knowledge representation for pattern matching.
[0034] As a preferred embodiment of the aspect-level sentiment analysis optimization method based on multivariate external knowledge fusion described in this invention, the steps of performing dependency parsing on the input text, constructing the original syntactic structure, and calculating the relevance strength between each grammatical component and aspect words in conjunction with contextual semantic representation are as follows:
[0035] A dependency parser is used to parse the input text and generate the original syntactic structure graph with words as nodes and dependency relations as edges;
[0036] In the original syntactic structure graph, the corresponding vector of each word node in the context semantic representation sequence is determined;
[0037] Based on the vectors corresponding to the aspect words, calculate the semantic similarity between the vectors of other word nodes and them;
[0038] Obtain the dependency path length from each word node to the aspect word, and use it as a grammatical distance metric;
[0039] Identify the dependency role type of each word node in the syntactic structure and assign a corresponding role weight value;
[0040] By combining semantic similarity, syntactic distance, and dependency role weights, the relevance strength between each word node and aspect words is calculated. Its expression is:
[0041] ;
[0042] in, For the first The relevance strength of each word node Its context semantic representation vector, The vector corresponding to the aspect words, The cosine similarity between two vectors is represented by the following expression: This represents the length of the dependency path from the node to the aspect term. To depend on role weight, , , These are the preset adjustment parameters.
[0043] As a preferred embodiment of the aspect-level sentiment analysis optimization method based on multivariate external knowledge fusion described in this invention, the step of pruning the original syntactic structure according to the relevance strength, retaining the grammatical paths closely related to the semantics of aspect words, and forming a simplified local sentiment perception dependency structure, specifically includes the following steps:
[0044] Set a correlation strength threshold Filter out correlation strength Greater than Word nodes;
[0045] The selected nodes and their dependency connections are preserved in the original syntactic structure graph;
[0046] Remove all edges associated with nodes that were not retained to form a pruned subgraph.
[0047] 7. The aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as described in claim 6, characterized in that: the specific steps of performing semantic information aggregation on the local sentiment perception dependency structure, updating the contextual semantic representation, and obtaining an enhanced semantic representation incorporating syntactic constraints are as follows:
[0048] The input text is divided into three parts: the pre-head entity sequence, the middle sequence, and the post-tail entity sequence, and local feature extraction is performed on each part.
[0049] For each part, a convolutional layer is applied, and a sliding window method is used to extract local features and output a feature map.
[0050] Max pooling is performed on each feature map to retain the main features, resulting in three feature vectors. ;
[0051] Extract the maximum value from each feature map to form a piecewise pooling vector. Its expression is:
[0052] ;
[0053] in, Indicates the first The position in the The eigenvalues of the segment The length of the feature map;
[0054] The three piecewise pooling vectors are concatenated to obtain the feature vector. Its expression is:
[0055] ;
[0056] in, The results are for the three pooling segments respectively;
[0057] Introducing a gated attention mechanism to process input features This process enhances the ability to model the relative positions of characters.
[0058] Will Enter the four branches respectively:
[0059] Generate query matrix through linear transformation Generate a key matrix through a fully connected layer. The value matrix is generated through linear transformation. And gating signals generated via the fully connected layer ;
[0060] Calculate the attention score matrix ,in For bias terms;
[0061] Squaring the attention score matrix yields the weighted attention weights. ;
[0062] Value matrix Multiply by the weighted attention weights to obtain the attention output. Its expression is:
[0063] ;
[0064] in, This is the output of the gating attention mechanism, used to capture the relative importance and dependencies between words in a sentence;
[0065] Will With original features The features are fused to generate an enhanced feature representation. Its expression is:
[0066] ;
[0067] in, This is an enhanced semantic representation that integrates local features, global context, and relative positional information.
[0068] As a preferred embodiment of the aspect-level sentiment analysis optimization method based on multivariate external knowledge fusion described in this invention, the specific steps of jointly modeling the enhanced semantic representation and the fused knowledge representation to output the sentiment polarity classification result for the specified aspect word are as follows:
[0069] From enhancing semantic representation Extract the vector corresponding to the position of the aspect word. ;
[0070] This vector With fusion knowledge representation By concatenating the vectors, a joint semantic vector is obtained. Its expression is:
[0071] ;
[0072] in, This represents a vector concatenation operation;
[0073] Joint semantic vector The input classification layer is processed by linear transformation and activation function and then mapped to the sentiment category space.
[0074] Output the corresponding sentiment polarity classification results, which include three sentiment labels: positive, negative, or neutral.
[0075] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, it implements any step of the aspect-level sentiment analysis optimization method based on multivariate external knowledge fusion as described in the first aspect of the present invention.
[0076] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the aspect-level sentiment analysis optimization method based on multivariate external knowledge fusion as described in the first aspect of the present invention.
[0077] The beneficial effects of this invention are as follows: By constructing diverse external knowledge sources such as a Chinese sentiment dictionary, a domain knowledge graph, and a user comment prior pattern library, and combining semantic encoding, gating fusion mechanism, and dependency syntax pruning, accurate modeling of aspect-level word context semantics is achieved. The introduction of segmented convolution and gating attention mechanism can effectively capture local features and long-distance dependencies, enhancing the ability to identify sentiment polarity in complex contexts. By integrating knowledge-guided dynamic weight adjustment and local sentiment perception dependency structure modeling, the accuracy and robustness of aspect-level sentiment analysis are improved. Attached Figure Description
[0078] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0079] Figure 1 This is a flowchart of the aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge in Example 1.
[0080] Figure 2 This is a schematic diagram of the SPO-GCN model structure in Example 1.
[0081] Figure 3 This is a schematic diagram of the segmented convolutional neural network in Example 1.
[0082] Figure 4 This is a schematic diagram of the gating attention structure in Example 1.
[0083] Figure 5This is a schematic diagram of the original dependency tree and the local dependency tree in Example 1. Detailed Implementation
[0084] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0085] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0086] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0087] Example 1, referring to Figure 1 - Figure 5 This is the first embodiment of the present invention, which provides an aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge sources, including the following steps:
[0088] S1. Construct a diverse external knowledge source that includes a Chinese sentiment dictionary, a domain knowledge graph, and a user comment prior pattern library to provide lexical-level sentiment polarity, entity attribute relationships, and high-frequency evaluation semantic patterns;
[0089] Furthermore, Chinese sentiment dictionary data is obtained, which contains words and their corresponding sentiment polarity intensity values, and each word is mapped to a sentiment score;
[0090] Acquire domain knowledge graph data, which consists of entity, attribute, and relation triples and is used to describe the semantic context of aspect terms;
[0091] We acquire user comment corpora and perform pattern mining to extract high-frequency evaluation expression structures, generate a set of semantic templates with sentiment tags, and construct a prior pattern library for user comments.
[0092] It should be noted that the construction of multiple external knowledge sources complement each other. The Chinese sentiment dictionary provides fine-grained priors on the sentiment polarity of words, the domain knowledge graph enhances the semantic generalization ability of terms, and the user comment prior pattern library captures high-frequency expression habits in real scenarios. The three together form the basis for the integration of structured and unstructured knowledge, effectively improving the model's ability to understand domain-specific sentiment expressions and avoiding misjudgments caused by insufficient coverage of a single knowledge source.
[0093] S2. Semantically encode the input text and specified aspect words to generate contextual semantic representations, and extract global semantic features and local positional features by combining aspect word position information;
[0094] Furthermore, the input text is combined with specified aspect words to form a structured input sequence, which is then input into a pre-trained language model for encoding processing;
[0095] The vector representation corresponding to each text unit in the output sequence constitutes a sequence of contextual semantic representations.
[0096] The vector of the starting position of the sequence is extracted as a global semantic feature to represent the overall semantics of the entire sentence;
[0097] Based on the start and end positions of the terms in the input text;
[0098] Calculate the relative distance between each text unit and aspect word in the context semantic representation sequence to generate local position feature vectors;
[0099] It should be noted that by jointly encoding the input text with aspect words, the model is ensured to fully perceive the existence of aspect words when generating contextual representations, avoiding the disconnect between the context and the target aspect. Global semantic features capture the overall intent of the sentence, while local positional features explicitly model the spatial relationship between words and aspect words. The combination of the two enhances the model's sensitivity to long-distance dependencies and local modification structures, providing a precise semantic foundation for subsequent knowledge fusion and syntactic pruning.
[0100] S3. Based on the semantic encoding results, the various external knowledge sources are transformed into structured knowledge representations, and the contribution weights of various knowledge types are dynamically adjusted through a gating fusion mechanism to generate a fused knowledge representation.
[0101] Furthermore, based on the semantic features of each word in the context semantic representation, the corresponding sentiment scores are matched in the Chinese sentiment dictionary to generate a sentiment dictionary knowledge representation vector;
[0102] Based on the entity identifiers corresponding to the terms, retrieve their relevant attributes and relationship paths in the domain knowledge graph, and generate a structured embedding vector for the knowledge graph.
[0103] The input text is semantically similar to the semantic templates in the prior pattern library of user comments. The template with the highest matching degree is selected to generate a pattern matching knowledge representation vector.
[0104] The control vector is generated by concatenating the global semantic features with the corresponding vectors of aspect words and then performing a linear transformation.
[0105] The control vector is input into the activation function, which outputs three normalized weight coefficients, which are used to adjust the fusion ratio of sentiment dictionary knowledge representation, knowledge graph structured embedding, and pattern matching knowledge representation, respectively.
[0106] The three types of knowledge representation vectors are weighted and summed based on three weight coefficients to obtain the fused knowledge representation. Its expression is:
[0107] ;
[0108] in, To integrate knowledge representation, For the knowledge representation of the emotion dictionary, For structured embedding of knowledge graphs, For pattern matching knowledge representation;
[0109] It should be noted that the gating fusion mechanism dynamically adjusts the contribution ratio of the three types of external knowledge according to the current input, avoiding knowledge conflicts or noise interference caused by fixed weights. For example, when the input contains obvious sentiment words, the weight of sentiment dictionary knowledge is automatically increased; when aspect words belong to specific domain entities, knowledge graph embedding plays a dominant role. The mechanism realizes adaptive selection of knowledge sources and improves the rationality and robustness of the fusion process.
[0110] S4. Perform dependency parsing on the input text, construct the original syntactic structure, and calculate the relevance strength between each grammatical component and aspect words by combining the contextual semantic representation.
[0111] Furthermore, a dependency parser is used to parse the input text, generating a raw syntactic structure graph with words as nodes and dependency relations as edges;
[0112] In the original syntactic structure graph, the corresponding vector of each word node in the context semantic representation sequence is determined;
[0113] Based on the vectors corresponding to the aspect words, calculate the semantic similarity between the vectors of other word nodes and them;
[0114] Obtain the dependency path length from each word node to the aspect word, and use it as a grammatical distance metric;
[0115] Identify the dependency role type of each word node in the syntactic structure and assign a corresponding role weight value;
[0116] By combining semantic similarity, syntactic distance, and dependency role weights, the relevance strength between each word node and aspect words is calculated. Its expression is:
[0117] ;
[0118] in, For the first The relevance strength of each word node Its context semantic representation vector, The vector corresponding to the aspect words, The cosine similarity between two vectors is represented by the following expression: This represents the length of the dependency path from the node to the aspect term. To depend on role weight, , , These are preset adjustment parameters;
[0119] It should be noted that the relevance strength calculation integrates semantic similarity, dependency path length, and syntactic role weight, and evaluates the sentimental impact of words on aspect words from three dimensions: semantic, structural, and grammatical. The multi-dimensional scoring mechanism is superior to traditional methods that rely solely on syntactic paths. It can effectively identify contextual components that are not directly dependent but are semantically closely related, and improve the accuracy of syntactic structure pruning.
[0120] S5. Prune the original syntactic structure according to the relevance strength, retain the grammatical path that is closely related to the semantics of aspect words, and form a simplified local sentiment perception dependency structure.
[0121] Furthermore, a correlation strength threshold is set. Filter out correlation strength Greater than Word nodes;
[0122] The selected nodes and their dependency connections are preserved in the original syntactic structure graph;
[0123] Remove all edges associated with nodes that were not retained to form a pruned subgraph;
[0124] It should be noted that by setting a relevance strength threshold for pruning, redundant grammatical components with weak association with aspect words are removed, while the core sentiment expression path is preserved. This reduces noise interference and computational complexity. The resulting local sentiment perception dependency structure focuses on key contexts, providing a high signal-to-noise ratio graph structure foundation for subsequent semantic aggregation and improving the model's ability to discriminate sentiment in complex sentences.
[0125] S6. Perform semantic information aggregation on the local emotion perception dependency structure, update the context semantic representation, and obtain an enhanced semantic representation that incorporates syntactic constraints;
[0126] Furthermore, the input text is divided into three parts: the pre-head entity sequence, the middle sequence, and the post-tail entity sequence, and local feature extraction is performed on each part.
[0127] For each part, a convolutional layer is applied, and a sliding window method is used to extract local features and output a feature map.
[0128] Max pooling is performed on each feature map to retain the main features, resulting in three feature vectors. ;
[0129] Extract the maximum value from each feature map to form a piecewise pooling vector. Its expression is:
[0130] ;
[0131] in, Indicates the first The position in the The eigenvalues of the segment The length of the feature map;
[0132] The three piecewise pooling vectors are concatenated to obtain the feature vector. Its expression is:
[0133] ;
[0134] in, The results are for the three pooling segments respectively;
[0135] Introducing a gated attention mechanism to process input features This process enhances the ability to model the relative positions of characters.
[0136] Will Enter the four branches respectively:
[0137] Generate query matrix through linear transformation Generate a key matrix through a fully connected layer. The value matrix is generated through linear transformation. And gating signals generated via the fully connected layer ;
[0138] Calculate the attention score matrix ,in For bias terms;
[0139] Squaring the attention score matrix yields the weighted attention weights. ;
[0140] Value matrix Multiply by the weighted attention weights to obtain the attention output. Its expression is:
[0141] ;
[0142] in, This is the output of the gating attention mechanism, used to capture the relative importance and dependencies between words in a sentence;
[0143] Will With original features The features are fused to generate an enhanced feature representation. Its expression is:
[0144] ;
[0145] in, This is an enhanced semantic representation that integrates local features, global context, and relative positional information;
[0146] It should be noted that the segmented convolution and gating attention mechanism work together. The PCNN structure extracts local key segment features, and the GAU module enhances the attention focusing ability through square nonlinearity. It also combines rotational position encoding to model relative positional relationships. The design effectively captures long-distance dependencies while retaining local sensitivity, and the generated enhanced semantic representation has both local accuracy and global consistency.
[0147] S7. Jointly model the enhanced semantic representation and the fused knowledge representation to output the sentiment polarity classification results for words of a specified aspect;
[0148] Furthermore, from the perspective of enhancing semantic representation Extract the vector corresponding to the position of the aspect word. ;
[0149] This vector With fusion knowledge representation By concatenating the vectors, a joint semantic vector is obtained. Its expression is:
[0150] ;
[0151] in, This represents a vector concatenation operation;
[0152] Joint semantic vector The input classification layer is processed by linear transformation and activation function and then mapped to the sentiment category space.
[0153] Output the corresponding sentiment polarity classification results, which include three sentiment labels: positive, negative, or neutral.
[0154] It should be noted that the joint semantic vector integrates the context-enhanced representation from syntactic structure optimization and the prior information from the dynamic fusion of multi-source knowledge, achieving the dual advantages of data-driven and knowledge-guided approaches. The classification layer makes decisions based on this joint representation, effectively improving the accuracy of judging ambiguous, implicit, or contradictory emotional expressions, and the output results have stronger interpretability and stability.
[0155] This embodiment also provides a computer device applicable to the aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge as proposed in the above embodiment.
[0156] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0157] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0158] In summary, this invention constructs diverse external knowledge sources, including a Chinese sentiment dictionary, a domain knowledge graph, and a user comment prior pattern library. By combining semantic encoding, gating fusion mechanisms, and dependency syntactic structure pruning, it achieves accurate modeling of the semantic context of aspect words. The introduction of segmented convolution and gating attention mechanisms effectively captures local features and long-distance dependencies, enhancing the ability to identify sentiment polarity in complex contexts. By integrating knowledge-guided dynamic weight adjustment and local sentiment perception dependency structure modeling, it improves the accuracy and robustness of aspect-level sentiment analysis.
[0159] Example 2, referring to Table 1, is the second embodiment of the present invention. This embodiment provides an aspect-level sentiment analysis optimization model based on multi-source external knowledge fusion, including:
[0160] The module includes a sequence encoding module, a segmented convolution module, a semantic graph convolution module, a syntax graph convolution module, an interaction attention and fusion module, and a relation classification module.
[0161] In the sequence encoding module, the widely recognized and high-performance BERT pre-trained model is used to generate word vectors;
[0162] Convert the input text into a character sequence and determine the length parameter of the character sequence;
[0163] Leveraging the powerful encoding capabilities of the BERT pre-trained model, the input sentence is encoded to obtain the vector representation corresponding to each character. The word embeddings of the BERT-encoded sentence are denoted in a specific form, and the dimensions of the character vectors are clearly defined. Subsequently, based on the entity's position index information in the text, the word embeddings of the head entity and the tail entity can be accurately obtained. To obtain richer and more comprehensive information representations, the distance between characters and entities in the sentence is studied and analyzed in depth. Through extensive experiments and observations, it was found that the closer the distance between a character and an entity, the greater its impact on the final relation extraction result.
[0164] Positional features are represented by the relative distance between characters and entities. Taking Table 1 as an example, if the head entity in a sentence is the sky and the tail entity is the moon, then the positional features of other characters in the sentence are represented by the relative distance from the current character to the head entity and the tail entity. During operation, the relative position between the head entity and each character is calculated.
[0165] The details are shown in Table 1 below:
[0166] example Night superior sky null of bright moon grid outside bright clean Distance relative to the head entity -2 -1 0 0 1 2 3 4 5 6 7 Distance relative to the tail entity -5 -4 -3 -2 -1 0 0 1 2 3 4
[0167] Table 1. Distances between relative head and tail entities
[0168] In relation extraction tasks, the relative positions of characters and entities significantly impact the model's extraction performance; therefore, positional information is introduced into the encoding layer. Traditional convolutional neural networks (CNNs) have limitations in handling such tasks, outputting only a single value and failing to effectively capture the structural information features between two entities. PCNN, however, introduces a piecewise max-pooling mechanism. This mechanism allows PCNN to process complex long sentences in a piecewise manner, while fully considering global positional information and entity type information.
[0169] Example 3, referring to Table 2, is the third embodiment of the present invention. This embodiment provides a Chinese relation extraction method based on the SPO-GCN (Subject-Predicate-Object Graph Convolution Network) model, including:
[0170] The input text is preprocessed, including word segmentation, entity tagging and dependency parsing. For each sample, the subject, predicate and object triple structure is identified and the corresponding syntactic dependency graph is constructed. The original text sequence is input into a pre-trained language model (such as BERT) for encoding to generate a sequence of word vector representations containing context information.
[0171] The core structure of the SPO-GCN model is as follows: word vector sequences are used as node features, dependency syntax edges are used as the adjacency relationship basis of graph convolutional networks, multi-layer graph convolutional operations are designed, entity position masking mechanism is introduced in the aggregation process to enhance the semantic expression ability of subject and object entities, and information flow of different grammatical paths is controlled through gating mechanism to effectively preserve key semantic components in long-distance dependencies and alleviate the problem of key information loss caused by the increase of text length.
[0172] Based on the semantic representation after graph convolution, an attention mechanism is used to weight and fuse the vectors corresponding to the subject and object to generate the joint representation required for relation classification. This joint representation is then input into a fully connected classification layer to output the corresponding relation category probability distribution, thus achieving end-to-end relation prediction.
[0173] To evaluate the effectiveness of this method, four classic models—PRM-CNN, MultiView, SSRIE, and BERT-PAGG—were selected as benchmarks for comparison, and comparative experiments were conducted on the SanWen, FinRE, and COAE2016 datasets.
[0174] The experimental results are shown in Table 2:
[0175] Model SanWen (F1) FinRE (F1) COAE2016 (F1) PRM-CNN 67.72 52.97 - MultiView 72.98 53.89 91.15 SSRIE 70.68 - - BERT-PAGG 73.83 53.01 92.50 SPO-GCN 76.81 54.47 94.24
[0176] The experimental results show that the SPO-GCN model achieves the best F1 score on all three datasets: 76.81% on the SanWen dataset, which is 2.98 percentage points better than the second-best model; 54.47% on the FinRE dataset, which is better than all the comparison models; and 94.24% on the COAE2016 dataset, which is 1.74 percentage points better than the second-best model.
[0177] Further analysis shows that the SPO-GCN model achieves significant improvements on datasets with less overlap in subject-object relationships (such as COAE2016 and SanWen), indicating its stronger discriminative ability in semantically clear and structurally well-defined texts. While its performance improvement is relatively limited on complex financial datasets like FinRE, which have many relationship categories, long text lengths, and significant relationship overlap, it still maintains a leading position, demonstrating the model's robustness in handling highly complex tasks.
[0178] In summary, this embodiment effectively improves the accuracy and generalization ability of Chinese relation extraction by jointly modeling syntactic structure and semantic information, and is especially suitable for text scenarios with clear subject-object relationships and obvious domain characteristics.
[0179] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. An aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge sources, characterized in that: include: Construct a diverse external knowledge source that includes a Chinese sentiment dictionary, a domain knowledge graph, and a user comment prior pattern library to provide lexical-level sentiment polarity, entity attribute relationships, and high-frequency evaluation semantic patterns; Semantic encoding is performed on the input text and specified aspect words to generate contextual semantic representations, and global semantic features and local positional features are extracted by combining aspect word position information; Based on the semantic encoding results, multiple external knowledge sources are transformed into structured knowledge representations, and the contribution weights of various knowledge types are dynamically adjusted through a gating fusion mechanism to generate a fused knowledge representation. Dependency parsing is performed on the input text to construct the original syntactic structure, and the relevance strength between each grammatical component and aspect words is calculated by combining the contextual semantic representation. The original syntactic structure is pruned based on the relevance strength, retaining the grammatical paths that are closely related to the semantics of aspect words, thus forming a simplified local sentiment perception dependency structure. Semantic information is aggregated on the local emotion perception dependency structure, and the contextual semantic representation is updated to obtain an enhanced semantic representation that incorporates syntactic constraints. We will jointly model the semantic representation and the knowledge representation to output the sentiment polarity classification results for words of a specified aspect.
2. The aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as described in claim 1, characterized in that: The specific steps for constructing a diverse external knowledge source, including a Chinese sentiment dictionary, a domain knowledge graph, and a user comment prior pattern library, are as follows: Acquire Chinese sentiment dictionary data, which contains words and their corresponding sentiment polarity values, and map each word to a sentiment score; Acquire domain knowledge graph data, which consists of entity, attribute, and relation triples and is used to describe the semantic context of aspect terms; We acquire user comment corpora and perform pattern mining to extract high-frequency evaluation expression structures, generating a set of semantic templates with sentiment tags to form a prior pattern library for user comments.
3. The aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as described in claim 2, characterized in that: The steps for semantically encoding the input text and specified aspect words to generate contextual semantic representations, and extracting global semantic features and local positional features by combining aspect word position information, are as follows: The input text is combined with specified aspect words to form a structured input sequence, which is then input into a pre-trained language model for encoding processing. The vector representation corresponding to each text unit in the output sequence constitutes a sequence of contextual semantic representations. The vector of the starting position of the sequence is extracted as a global semantic feature to represent the overall semantics of the entire sentence; Based on the start and end positions of the terms in the input text; Calculate the relative distance between each text unit and aspect word in the context semantic representation sequence to generate local position feature vectors.
4. The aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as described in claim 3, characterized in that: Based on semantic encoding results, multiple external knowledge sources are transformed into structured knowledge representations, and the contribution weights of various knowledge types are dynamically adjusted through a gating fusion mechanism to generate a fused knowledge representation. The specific steps are as follows: Based on the semantic features of each word in the context semantic representation, the corresponding sentiment scores are matched in the Chinese sentiment dictionary to generate a sentiment dictionary knowledge representation vector; Based on the entity identifiers corresponding to the terms, retrieve their relevant attributes and relationship paths in the domain knowledge graph, and generate a structured embedding vector for the knowledge graph. The input text is semantically similar to the semantic templates in the prior pattern library of user comments. The template with the highest matching degree is selected to generate a pattern matching knowledge representation vector. The control vector is generated by concatenating the global semantic features with the corresponding vectors of aspect words and then performing a linear transformation. The control vector is input into the activation function, which outputs three normalized weight coefficients, which are used to adjust the fusion ratio of sentiment dictionary knowledge representation, knowledge graph structured embedding, and pattern matching knowledge representation, respectively. The three types of knowledge representation vectors are weighted and summed based on three weight coefficients to obtain the fused knowledge representation. Its expression is: ; in, To integrate knowledge representation, For the knowledge representation of the emotion dictionary, For structured embedding of knowledge graphs, This is a knowledge representation for pattern matching.
5. The aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as described in claim 4, characterized in that: The specific steps for performing dependency parsing on the input text, constructing the original syntactic structure, and calculating the relevance strength between each grammatical component and aspect words in conjunction with contextual semantic representation are as follows: A dependency parser is used to parse the input text and generate the original syntactic structure graph with words as nodes and dependency relations as edges; In the original syntactic structure graph, the corresponding vector of each word node in the context semantic representation sequence is determined; Based on the vectors corresponding to the aspect words, calculate the semantic similarity between the vectors of other word nodes and them; Obtain the dependency path length from each word node to the aspect word, and use it as a grammatical distance metric; Identify the dependency role type of each word node in the syntactic structure and assign a corresponding role weight value; By combining semantic similarity, syntactic distance, and dependency role weights, the relevance strength between each word node and aspect words is calculated. Its expression is: ; in, For the first The relevance strength of each word node Its context semantic representation vector, The vector corresponding to the aspect words, The cosine similarity between two vectors is represented by the following expression: This represents the length of the dependency path from the node to the aspect term. To depend on role weight, , , These are the preset adjustment parameters.
6. The aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as described in claim 5, characterized in that: The process of pruning the original syntactic structure based on relevance strength, retaining grammatical paths closely related to the semantics of aspect words, and forming a simplified local sentiment perception dependency structure involves the following steps: Set a correlation strength threshold Filter out correlation strength Greater than Word nodes; The selected nodes and their dependency connections are preserved in the original syntactic structure graph; Remove all edges associated with nodes that were not retained to form a pruned subgraph.
7. The aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as described in claim 6, characterized in that: The steps for aggregating semantic information on the local emotion perception dependency structure, updating the contextual semantic representation, and obtaining an enhanced semantic representation incorporating syntactic constraints are as follows: The input text is divided into three parts: the pre-head entity sequence, the middle sequence, and the post-tail entity sequence, and local feature extraction is performed on each part. For each part, a convolutional layer is applied, and a sliding window method is used to extract local features and output a feature map. Max pooling is performed on each feature map to retain the main features, resulting in three feature vectors. ; Extract the maximum value from each feature map to form a piecewise pooling vector. Its expression is: ; in, Indicates the first The position in the The eigenvalues of the segment The length of the feature map; The three piecewise pooling vectors are concatenated to obtain the feature vector. Its expression is: ; in, The results are for the three pooling segments respectively; Introducing a gated attention mechanism to process input features This process enhances the ability to model the relative positions of characters. Will Enter the four branches respectively: Generate query matrix through linear transformation Generate a key matrix through a fully connected layer. The value matrix is generated through linear transformation. And gating signals generated via the fully connected layer ; Calculate the attention score matrix ,in For bias terms; Squaring the attention score matrix yields the weighted attention weights. ; Value matrix Multiply by the weighted attention weights to obtain the attention output. Its expression is: ; in, This is the output of the gating attention mechanism, used to capture the relative importance and dependencies between words in a sentence; Will With original features The features are fused to generate an enhanced feature representation. Its expression is: ; in, This is an enhanced semantic representation that integrates local features, global context, and relative positional information.
8. The aspect-level sentiment analysis optimization method based on multi-source external knowledge fusion as described in claim 7, characterized in that: The method involves jointly modeling enhanced semantic representation and fused knowledge representation to output sentiment polarity classification results for words of a specified aspect. The specific steps are as follows: From enhancing semantic representation Extract the vector corresponding to the position of the aspect word. ; This vector With fusion knowledge representation By concatenating the vectors, a joint semantic vector is obtained. Its expression is: ; in, This represents a vector concatenation operation; Joint semantic vector The input classification layer is processed by linear transformation and activation function and then mapped to the sentiment category space. Output the corresponding sentiment polarity classification results, which include three sentiment labels: positive, negative, or neutral.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the aspect-level sentiment analysis optimization method based on the fusion of multiple external knowledge as described in any one of claims 1 to 8.
Citation Information
Cited By
Unmanned underwater vehicle target-oriented generative active sonar receiving signal trueness evaluation method and system, and related device
CN120595273A
A method, system and related device for evaluating the realism of a received signal of a generative active sonar targeting an unmanned underwater vehicle
CN120595273B
