Sentiment analysis processing method, device, computer equipment and readable storage medium

By vectorizing financial text data and analyzing it with attention modules, we generate global and local hidden vectors and identify user sentiment information, thus solving the problem of low accuracy in sentiment analysis of financial text data and enabling batch analysis of massive data.

CN115964485BActive Publication Date: 2025-09-23AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211447485.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-18
Publication Date
2025-09-23
Estimated Expiration
2042-11-18

AI Technical Summary

Technical Problem

In existing technologies, sentiment analysis of financial text data has low accuracy and is unable to process massive amounts of data, making it impossible for companies to conduct accurate sentiment analysis in batches.

Method used

By obtaining the context information and given aspects of text data, vectorization processing is performed to generate context vectors and given vectors, and global and local attention modules are used to identify emotion types, generate global latent vectors and local latent vectors, and combine these vectors to identify the user's emotional information.

Benefits of technology

It improves the accuracy of sentiment analysis, enables batch analysis of massive financial reviews, and solves the difficulty of sentiment analysis that companies face in accurately analyzing public opinion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115964485B_ABST
    Figure CN115964485B_ABST
Patent Text Reader

Abstract

The present application provides a sentiment analysis processing method, apparatus, computer device, and readable storage medium, comprising: obtaining context information of text data and identifying a given aspect in the context information; vectorizing the context information to obtain a context vector, and vectorizing the given aspect to obtain a given vector; based on the context vector and the given vector, identifying the sentiment type conveyed by the given aspect in the context information to obtain a global hidden vector; based on the context vector and the given vector, identifying context words within the context information that express the sentiment type of a given word in the given aspect, and generating local hidden vectors reflecting the sentiment type of each given word; based on the global hidden vector and the local hidden vector, identifying the sentiment information of the user who generated the context information regarding the given aspect. This application not only improves the accuracy of sentiment analysis, but also achieves the technical effect of batch analysis of massive data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data analysis technology, and in particular to a sentiment analysis processing method, apparatus, computer equipment, and readable storage medium. Background Art

[0002] In the era of artificial intelligence, natural language processing (NLP) technology has attracted widespread attention from both academia and industry. Sentiment analysis of text data is a key area of ​​research, possessing high research and application value. Chinese text data on stocks, funds, and futures in the financial sector is increasing rapidly, generating data at a rapid rate and containing a vast amount of information. Therefore, how to quickly and accurately mine the hidden information within financial texts is a pressing challenge.

[0003] Currently, sentiment analysis of public opinion is mostly performed using manual reading and recognition. However, the inventors have found that this method is not only inaccurate, but also unable to process massive amounts of text data from financial reviews, resulting in companies being unable to conduct accurate sentiment analysis on related public opinion in batches. Summary of the Invention

[0004] The present application provides a sentiment analysis processing method, apparatus, computer equipment and readable storage medium to solve the problem that the current public opinion sentiment analysis has low accuracy and is unable to process massive text data of financial reviews, resulting in the inability of enterprises to conduct batch and accurate sentiment analysis of public opinion related to them.

[0005] In a first aspect, the present application provides a sentiment analysis method, comprising:

[0006] Acquire context information of text data and identify a given aspect in the context information; wherein the context information is content recording user emotions, and the given aspect is a subject for analyzing emotions;

[0007] Vectorizing the context information to obtain a context vector, and vectorizing the given aspect to obtain a given vector; wherein the given vector represents the subject of the analyzed emotion in the text data, and the context vector represents the content in the text data that records the user's emotion;

[0008] According to the context vector and the given vector, identifying the emotion type conveyed by the given aspect in the context information to obtain a global latent vector; wherein the global latent vector represents the overall emotion of the text data on the given aspect;

[0009] Based on the context vector and the given vector, identifying context words in the context information that express the sentiment type of the given words in the given aspect, and generating local hidden vectors reflecting the sentiment type of each of the given words; wherein the local hidden vectors represent the local sentiment of the text data for each subject in the given aspect; one subject corresponds to one given word in the given aspect;

[0010] Emotional information of a user generating the context information on the given aspect is identified based on the global latent vector and the local latent vector.

[0011] In the above solution, the vectorizing the context information to obtain a context vector, and the vectorizing the given aspect to obtain a given vector, include:

[0012] The context information is encoded to obtain a context matrix, and a context vector is generated based on the context matrix; wherein the context matrix has at least one context feature; and the context vector records any context feature in the context matrix and a hidden feature of the association between any context feature and other context features in the context matrix;

[0013] The given information is encoded to obtain a given matrix, and a given vector is generated based on the given matrix; wherein the given matrix has at least one given feature; the given vector records any given feature in the given matrix, as well as hidden features of the association relationship between any given sign and other given features in the given matrix.

[0014] In the above solution, identifying the emotion type conveyed by the given aspect in the context information to obtain a global latent vector based on the context vector and the given vector includes:

[0015] Performing pooling processing on the context vector to obtain a context pooling vector, and performing pooling processing on the given vector to obtain a given pooling vector; wherein the context pooling vector represents the key content and emotion type conveyed by the text data through the context information, and the given pooling vector represents the key content conveyed by the text data through the given aspect;

[0016] Generate a first hidden vector based on the given vector and the context pooling vector; wherein the first hidden vector is a feature vector that matches the given vector with the context pooling vector, and the first hidden vector represents the given word in the given aspect that matches the key content and emotion type conveyed by the context information, and the emotion type conveyed by the context information;

[0017] Generate a second hidden vector based on the given pooled vector and the context vector; wherein the second hidden vector is a feature vector that matches the given pooled vector in the context vector; the second hidden vector represents the context words and their sentiment types that match the key content conveyed by the given aspect in the context information;

[0018] The global latent vector is obtained according to the first latent vector and the second latent vector; wherein the global latent vector represents the overall sentiment of the text data on the given aspect by representing the sentiment type conveyed by the context information and matching the given aspect.

[0019] In the above solution, the pooling process of the context vector to obtain the context pooling vector and the pooling process of the given vector to obtain the given pooling vector include:

[0020] Performing mean pooling on the context vector to obtain a context mean pooling vector, performing maximum pooling on the context vector to obtain a context maximum pooling vector, and concatenating the context mean pooling vector and the context maximum pooling vector to obtain the context pooling vector;

[0021] Performing mean pooling on the given vector to obtain a given mean pooling vector, performing maximum pooling on the given vector to obtain a given maximum pooling vector, and concatenating the given mean pooling vector and the given maximum pooling vector to obtain the given pooling vector.

[0022] In the above solution, generating the first hidden vector according to the given vector and the context pooling vector includes:

[0023] Identifying a first given vector in the given vectors that matches the context mean pooling vector, and identifying a second given vector in the given vectors that matches the context maximum pooling vector, and concatenating the first given vector and the second given vector to obtain a first hidden vector;

[0024] The generating a second hidden vector according to the given pooling vector and the context vector includes:

[0025] Identifying a first context vector in the context vector that matches the given mean pooling vector, and identifying a second context vector in the context vector that matches the given maximum mean pooling vector, and concatenating the first context vector and the second context vector to obtain a second hidden vector;

[0026] The obtaining the global latent vector according to the first latent vector and the second latent vector includes:

[0027] Set the given word in the given aspect represented in the first hidden vector that matches the key content and sentiment type conveyed by the context information as the first word vector, and set the sentiment type conveyed by the context information in the second hidden vector as the first sentiment vector;

[0028] Setting the context word in the second hidden vector that represents the context information and matches the key content conveyed by the given aspect as a second word vector, and setting the emotion type corresponding to the second word in the second hidden vector as a second emotion vector;

[0029] Concatenating the first word vector and the second word vector to obtain a given context vector, and summarizing the first emotion vector and the second emotion vector to obtain an emotion set, wherein the emotion set includes at least one emotion feature vector representing an emotion type;

[0030] The matching probability between each of the emotion feature vectors and the given context vector is calculated, the matching probability is concatenated with the emotion feature vector to form a target emotion vector, and at least one target emotion vector is aggregated to obtain a global hidden vector.

[0031] In the above solution, identifying context words expressing the sentiment type of the given words in the given aspect in the context information based on the context vector and the given vector, and generating a local hidden vector reflecting the sentiment type of each given word, includes:

[0032] Constructing at least one attention target based on at least one given feature in the given vector, and constructing source data and context data based on the context vector; wherein the source data is a context feature in the context vector corresponding to the attention target, and the context data is a context feature within a preset range around the source data;

[0033] Setting an attention target as a current target, identifying source data corresponding to the current target, obtaining at least one context data associated with the source data, and using the at least one context data as at least one associated feature of the current target;

[0034] The correlation between the associated features and the current target is calculated in sequence according to a preset weight vector, and at least one correlation vector is obtained; wherein the correlation vector represents the emotional weight of the emotional type conveyed by the context word corresponding to the associated feature to the given word corresponding to the current target; and the emotional weight represents the degree of emotional influence of the emotional type on the given word corresponding to the current target;

[0035] All given features and their related vectors in the given vector are concatenated to obtain a local hidden vector reflecting the local sentiment type of each given word in the given aspect.

[0036] In the above solution, identifying the emotional information of the user who generated the context information about the given aspect based on the global latent vector and the local latent vector includes:

[0037] Calculate the user-generated context information for the given aspect based on the global hidden vector, and a first emotion type and a first emotion probability; wherein the first emotion type represents the overall emotion conveyed by the text data on the given aspect through the context information; and the first emotion probability represents the probability of each emotion type in the overall emotion conveyed by the text data;

[0038] Calculating the user-generated context information based on the local hidden vector, a second emotion type and a second emotion probability for each given word in the given aspect; wherein the second emotion type represents the local emotion conveyed by the text data to each subject in the given aspect through the context information; and the second emotion probability represents the probability of each emotion type in the local emotion conveyed by the text data;

[0039] Emotional information of the user on the given aspect is obtained according to the first emotion type and its first emotion probability, and the second emotion type and its second emotion probability.

[0040] In a second aspect, the present application provides a sentiment analysis and processing device, comprising:

[0041] an identification module, configured to obtain context information of text data and identify a given aspect in the context information; wherein the context information is content recording user emotions, and the given aspect is the subject of the emotion to be analyzed;

[0042] An input layer module, configured to vectorize the context information to obtain a context vector, and vectorize the given aspect to obtain a given vector; wherein the given vector represents the subject of the analyzed emotion in the text data, and the context vector represents the content in the text data that records the user's emotion;

[0043] A global attention module is configured to identify the type of emotion conveyed by the given aspect in the context information based on the context vector and the given vector to obtain a global latent vector; wherein the global latent vector represents the overall emotion of the text data for the given aspect;

[0044] a local attention module, configured to identify, based on the context vector and the given vector, context words in the context information that express the sentiment type of the given words in the given aspect, and generate a local hidden vector reflecting the sentiment type of each of the given words; wherein the local hidden vector represents the local sentiment of the text data for each subject in the given aspect; and one subject corresponds to one given word in the given aspect;

[0045] A global attention module is used to identify the emotional information of the user who generates the context information about the given aspect based on the global latent vector and the local latent vector.

[0046] In a third aspect, the present application provides a computer device, comprising: a processor and a memory communicatively connected to the processor;

[0047] The memory stores computer-executable instructions;

[0048] The processor executes the computer-executable instructions stored in the memory to implement the above-mentioned sentiment analysis processing method.

[0049] In a fourth aspect, the present application provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to implement the above-mentioned sentiment analysis processing method.

[0050] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the above-mentioned sentiment analysis and processing method when executed by a processor.

[0051] The present application provides a sentiment analysis processing method, apparatus, computer device, and readable storage medium, which vectorizes context information to obtain a context vector, and vectorizes a given aspect to obtain a given vector, so as to facilitate subsequent sentiment analysis of the context information and the given aspect.

[0052] The global latent vector is obtained by identifying the emotion type conveyed by the given aspect in the context information according to the context vector and the given vector, so as to obtain the emotion type conveyed by the given aspect in the context information as a whole;

[0053] By identifying context words expressing the sentiment type of the given words in the given aspect in the context information according to the context vector and the given vector, and generating a local hidden vector reflecting the sentiment type of each given word, so as to obtain the sentiment type specifically conveyed by each given word in the given aspect in the context information;

[0054] By identifying the emotional information of the user who generates the context information on a given aspect based on the global latent vector and the local latent vector, the emotional attitude of the user who generates the context information on the given aspect is identified from two given aspects: the emotional type expressed by the context information for the given aspect as a whole and the emotional type specifically expressed by each given word in the context information of the given aspect, so as to improve the accuracy of user emotional analysis.

[0055] Therefore, this application not only improves the accuracy of sentiment analysis, but also achieves the technical effect of batch analysis of massive data, solving the current difficulty that enterprises cannot conduct batch and accurate sentiment analysis of public opinions related to them. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0057] Figure 1 A flowchart of Example 1 of a sentiment analysis and processing method provided in an embodiment of the present application;

[0058] Figure 2 A schematic diagram of program modules of Example 2 of a sentiment analysis and processing device provided in an embodiment of the present application;

[0059] Figure 3 A block diagram of program modules and information interactions used by the sentiment analysis and processing device provided in Example 2 of the present application in the sentiment analysis and processing method provided in Example 1;

[0060] Figure 4 Schematic diagram of the hardware structure of the computer device in the computer device of the present invention.

[0061] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0062] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0063] See also Figure 1 , the specific application scenarios of this application are:

[0064] In the era of artificial intelligence, natural language processing (NLP) technology has garnered widespread attention from both academia and industry, with sentiment analysis of text data being a key area of ​​research and possessing high research and application value. Chinese text data on stocks, funds, and futures in the financial sector is growing rapidly, generating rapidly and containing vast amounts of information. Rapidly and accurately mining the hidden information within financial text is a pressing challenge. Faced with massive amounts of textual financial commentary, relying solely on investors to read and analyze it is unrealistic to extract valuable information. This is particularly time-consuming, as financial markets are extremely complex and volatile, with stock prices shifting rapidly. Manual analysis methods are subject to significant lags, rendering the data less relevant. Furthermore, due to the diverse backgrounds and perspectives of investors, each has a one-sided view of market fluctuations, making it difficult for individuals to comprehensively analyze massive amounts of financial text data. For example, when selecting stocks, investors, driven by psychological factors, may easily jump to conclusions based on just a few comments or posts, potentially missing out on valuable investment opportunities. Therefore, being able to train a public opinion analysis model that automatically processes large amounts of financial texts has rich reference value in assisting investors and financial investment institutions in making investment references, helping the government grasp the direction of public opinion in the financial market, and analyzing investors' emotional attitudes.

[0065] The sentiment analysis method provided in this application can be applied in the financial field. The encoder efficiently obtains the hidden state of words in long sentences to extract the text features of financial user comments, and vectorizes the context information to obtain a context vector, and vectorizes a given aspect to obtain a given vector.

[0066] Through the global attention module and the local attention module, the emotion type conveyed by the given aspect in the context information is identified according to the context vector and the given vector to obtain a global hidden vector; and according to the context vector and the given vector, the context words expressing the emotion type of the given words in the given aspect in the context information are identified, and local hidden vectors reflecting the emotion type of each given word are generated, thereby achieving the effect of using different attention modules to capture the interaction information of different granularities between aspects and contexts; among them, the global attention module adopts a dual pooling method to interact with the important features of the aspects and contexts, thereby reducing the loss of learning features.

[0067] According to the global latent vector and the local latent vector, the sentiment information of the user on the given aspect that generates the context information is identified.

[0068] By combining the global hidden vector that represents the information interaction of the global attention module on the entire aspect and context, and the local hidden vector that represents the information interaction that the local attention module mainly focuses on at the word level, the emotional information of the user's emotional attitude towards a given aspect is identified from both global and local perspectives, thereby improving the accuracy of emotion recognition.

[0069] Learning aspect-level sentiment analysis: Sentiment analysis primarily involves identifying the specific sentiment expressed by a target through the presented text. It can be categorized by the granularity of the analysis, namely, document-level, sentence-level, and aspect-level. Sentiment analysis at the first two granularities assumes that a text reflects only one sentiment, namely, whether the text expresses positive, negative, or neutral sentiment. However, judging the sentiment polarity of an entire document or sentence may miss some emotional details. Similarly, the sentiment of a document or sentence as a whole cannot reflect the fine-grained emotional expression of people toward the target. In different scenarios, focusing solely on overall sentiment may overlook understanding the emotional details. Therefore, to conduct a more comprehensive sentiment analysis, it is necessary to start from the different emotional aspects reflected in text comments, identify the objects of different emotional aspects of text comments, and conduct targeted sentiment analysis on each aspect object. This is aspect-level sentiment analysis.

[0070] Attention mechanism: The attention mechanism originates from the study of human vision. In cognitive science, due to information processing bottlenecks, humans selectively focus on a portion of all information while ignoring other visible information. This mechanism is often referred to as the attention mechanism. Different parts of the human retina have different levels of information processing capabilities, or acuity, with the fovea having the highest acuity. To effectively utilize limited visual information processing resources, humans need to select a specific part of the visual area and focus their attention on it. For example, when people read, they typically only focus on and process a small number of words to be read. In summary, the attention mechanism has two main aspects: determining which part of the input to focus on and allocating limited information processing resources to the important parts.

[0071] Financial public opinion refers to the public's comments, opinions, and views on specific financial events or financial operating conditions and trends. These opinions can, through specific mechanisms, have a tangible impact on actual financial markets, financial institutions, and even macro-financial operations. Public opinion is highly sensitive to specific events occurring within the financial system, such as the release of economic and financial data, adjustments to macroeconomic and regulatory policies, or emergencies at financial institutions. Any dynamic changes in these events can spark widespread discussion, leading to shifts in individual and corporate consumption and investment expectations and decisions, ultimately impacting the entire financial market and even the macroeconomy. With the widespread use of public opinion channels such as the internet and new media, academic research on public opinion has begun to increase. However, both theoretical and empirical research remains exploratory, with limited research on financial public opinion and related expectation guidance.

[0072] Domestic scholars' research on financial public opinion generally falls into two areas. The first is the management and guidance of financial public opinion. Financial public opinion originates from the public's judgment and understanding of specific financial events and financial trends, and through certain transmission mechanisms, it exerts a certain influence on financial markets, financial institutions, and even macro-financial operations. To maintain the orderly operation of all sectors of the financial sector, financial regulators are required to take appropriate measures to fully monitor, investigate, and manage financial public opinion. The second is the study of financial public opinion and its impact on financial markets. Public opinion can be divided into two categories: positive and negative, each with different impacts on financial markets. Positive public opinion can enhance the social reputation of relevant financial markets and financial institutions and stabilize financial operations to a certain extent. Negative public opinion, on the other hand, almost always causes losses to financial markets and financial institutions. If it is not promptly suppressed and allowed to spread, it can lead to irreversible consequences and easily trigger financial risks. For the public, public opinion reactions are one of the most intuitive ways to express their opinions. Over time, the public's willingness to understand and express opinions on economic and financial policies has become increasingly strong, and the channels for participation have become increasingly diverse, resulting in the emergence of financial public opinion of varying sizes. Once financial public opinion emerges, it quickly collided with each other and formed a strong social opinion field. If public opinion is not properly guided at this time, market expectations will deviate. Even the best policies will be less effective, or even have a negative impact. Therefore, fully understanding the public's reaction to the People's Bank of China's policies and measures and then taking effective measures to guide expectations are of great significance for improving the effectiveness of policy implementation, stabilizing market expectations, and maintaining stable and healthy economic development.

[0073] The following detailed description of the technical solution of the present application and how the technical solution of the present application solves the problems of the prior art is provided with specific embodiments. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0074] Example 1:

[0075] See also Figure 2 , this application provides a sentiment analysis processing method, including:

[0076] S101: Acquire context information of text data and identify given aspects in the context information; wherein the context information is content recording user emotions, and the given aspects are subjects for analyzing emotions.

[0077] In this step, context information is text information in which users express their emotional attitudes towards a specific subject (i.e., a given aspect). In this embodiment, the present application can be applied to the sentiment analysis of online public opinion. Therefore, the present application obtains context information by connecting to a social media platform. For example, Sina Weibo (hereinafter referred to as "Weibo") is selected as a social media platform based on user relationships, which carries a large amount of public opinion information. In particular, the amount of financial policy news released by Weibo has increased year by year in recent years, and its share of mobile client information releases has become increasingly larger. When a public opinion event occurs, the public's participation on Weibo is high, and the number of Weibo posts released is growing rapidly and in large volume. Therefore, Weibo is selected as a platform for public opinion information analysis, and the results are fully representative.

[0078] S102: vectorizing the context information to obtain a context vector, and vectorizing the given aspect to obtain a given vector; wherein the given vector represents the subject of the analyzed emotion in the text data, and the context vector represents the content in the text data that records the user's emotion.

[0079] In a preferred embodiment, vectorizing the context information to obtain a context vector, and vectorizing the given aspect to obtain a given vector, include:

[0080] The context information is encoded to obtain a context matrix, and a context vector is generated based on the context matrix; wherein the context matrix has at least one context feature; the context vector records any context feature in the context matrix, as well as hidden features of the association between any context feature and other context features in the context matrix;

[0081] The given information is encoded to obtain a given matrix, and a given vector is generated based on the given matrix; wherein the given matrix has at least one given feature; the given vector records any given feature in the given matrix, as well as the hidden features of the association between any given sign and other given features in the given matrix.

[0082] Specifically, the traditional attention mechanism has poor data parallel processing capabilities. In order to enable the context to better interact with multiple words in a given aspect and improve operating efficiency, this embodiment extracts the features of the given aspect and context information through the encoder to obtain a given matrix and a context matrix. For example, a context information is input and the context words in the context information are mapped to word vectors. It can be seen that the input is a given aspect consisting of m words a={W i ,W i+1 ,...,W i+m-1} and a subsequence c of context information consisting of n words = {W1, W2, ..., W n The embedding layer obtains word vectors through the pre-trained word vector model, where the context matrix is Given a matrix where d w is the dimension of the word vector.

[0083] The encoder processes the embedding layer to obtain the word vector and capture the hidden representation. Specifically, the encoder is used to extract the context features in the context matrix, and the context features are used as the query value, key value and value input in the self-attention mechanism. The self-attention mechanism is used to obtain any context feature of the context matrix, as well as the hidden features of the relationship between any context feature and other context features in the context matrix, and obtain the context vector, which is represented as The calculation is as shown in the formula:

[0084] h c i =Encoder(V1,V2,...,V n )

[0085] Among them, Encoder is the self-attention mechanism algorithm, h c i is the hidden feature between the i-th context feature and other context features in the context matrix.

[0086] Use the same method to get the given vector Considering that a single attention layer cannot efficiently extract complex relationships in sentences, the model here chooses to stack multiple layers of attention to better learn the feature information of given aspects and contexts.

[0087] It's important to note that the self-attention mechanism, an attention mechanism in neural networks, is a resource allocation scheme that allocates computing resources to more important tasks when computing power is limited, while also addressing the problem of information overload. In neural network learning, generally speaking, the more parameters a model has, the stronger its expressive power and the greater the amount of information it stores. However, this can lead to information overload. By introducing an attention mechanism, the information critical to the current task can be focused on among the numerous inputs, while reducing attention to other information and even filtering out irrelevant information. This can address information overload and improve the efficiency and accuracy of task processing. For example, for each input vector a, the self-attention mechanism outputs a vector b. This vector b takes into account the influence of all input vectors on a. Here, if there are four word vectors a, four corresponding vectors b will be output.

[0088] S103: Based on the context vector and the given vector, identify the emotion type conveyed by the given aspect in the context information to obtain a global latent vector; wherein the global latent vector represents the overall emotion of the text data on the given aspect.

[0089] In a preferred embodiment, based on the context vector and the given vector, identifying the emotion type conveyed by the given aspect in the context information to obtain a global latent vector includes:

[0090] The context vector is pooled to obtain a context pooled vector, and the given vector is pooled to obtain a given pooled vector; wherein the context pooled vector represents the key content and sentiment type conveyed by the text data through the context information, and the given pooled vector represents the key content conveyed by the text data through the given aspect;

[0091] Generate a first hidden vector based on the given vector and the context pooling vector; wherein the first hidden vector is a feature vector that matches the given vector and the context pooling vector, and the first hidden vector represents the given word in the given aspect that matches the key content and emotion type conveyed by the context information, and the emotion type conveyed by the context information;

[0092] Generate a second hidden vector based on the given pooled vector and the context vector; wherein the second hidden vector is a feature vector that matches the given pooled vector in the context vector; the second hidden vector represents the context words and their sentiment types that match the key content conveyed by the given aspect in the context information;

[0093] A global latent vector is obtained based on the first latent vector and the second latent vector. The global latent vector represents the overall sentiment of the text data on the given aspect by representing the sentiment type matched with the given aspect conveyed by the context information.

[0094] In this example, by pooling the context vector, a context pooling vector describing the key information and emotional type of the context information is obtained. By pooling the given vector, a given pooling vector describing the key information of the given aspect is obtained, so as to facilitate the subsequent overall comparison of the context information and the given aspect and obtain the emotional attitude towards the given aspect that the context information as a whole wants to convey.

[0095] Generate a first hidden vector based on the given vector and the context pooling vector through the attention mechanism, and generate a second hidden vector based on the given pooling vector and the context vector;

[0096] The matching in this example is based on soft attention and / or hard attention, which sets two identical and / or similar objects (for example, vectors, words) as mutually matching objects. Among them, hard attention directly finds a specific word from the input sentence, and then aligns the target sentence word with this word, while the words in other input sentences are rigidly considered to have an alignment probability of 0. This is the idea of ​​the Hard Attention Model. Hard AM has proven useful in images, but it is not very useful in text because the one-to-one alignment of words is obviously too demanding. If the alignment is not correct, it will have a significant negative impact on subsequent processing. Soft attention is to give a probability for any word in the input sentence X when calculating the probability distribution of attention allocation. It is a probability distribution.

[0097] It's important to note that the attention mechanism is an algorithm that locates information of interest and suppresses useless information. It's a form of soft addressing: Source can be thought of as the content stored in memory, where an element consists of an address, Key, and a value, Value. There's a query with Key = Query, and the goal is to retrieve the corresponding Value from memory, i.e., the Attention value. Addressing is performed by comparing the similarity between the Query and the address of the Key element in memory. This is soft addressing because, unlike standard addressing, which simply retrieves a single piece of content from the stored content, content may be retrieved from each Key address. The importance of the retrieved content is determined by the similarity between the Query and Key. The Values ​​are then weighted and summed to obtain the final Value, i.e., the Attention value. Therefore, Query is a task-related variable, and Key needs to reflect the semantic information at the corresponding position of Value. Currently, in natural language processing, we typically consider the target as the Query value, and auxiliary information as the Key and Value values.

[0098] In a preferred embodiment, performing pooling processing on the context vector to obtain the context pooling vector, and performing pooling processing on the given vector to obtain the given pooling vector, include:

[0099] Perform mean pooling on the context vector to obtain a context mean pooling vector, perform maximum pooling on the context vector to obtain a context maximum pooling vector, and concatenate the context mean pooling vector and the context maximum pooling vector to obtain a context pooling vector;

[0100] Perform mean pooling on the given vector to obtain a given mean pooling vector, perform maximum pooling on the given vector to obtain a given maximum pooling vector, and concatenate the given mean pooling vector and the given maximum pooling vector to obtain a given pooling vector.

[0101] In order to avoid the context vector and the given vector from losing too much important information during the pooling process, resulting in the obtained context pooling vector and the given pooling vector being unable to fully describe the key information and / or emotional type of the context information and the given vector, resulting in low accuracy of the obtained first hidden vector and the second hidden vector, this example performs mean pooling and maximum pooling on the context vector to obtain a context mean pooling vector and a context maximum pooling vector respectively, and splices them to obtain a context pooling vector, and performs mean pooling and maximum pooling on the given vector to obtain a given mean pooling vector and a given maximum pooling vector respectively, and splices them to obtain a given pooling vector, so as to achieve pooling of the context vector and the given vector from two dimensions of mean and maximum value, ensuring that the obtained context pooling vector and the given pooling vector can respectively cover the key information and / or emotional type of the context information and the given information, and avoid the occurrence of important information loss. Among them, mean pooling is to average all values ​​in the local receptive field; maximum pooling is to take the point with the largest value in the local receptive field.

[0102] Specifically, the global impact of aspects on context is taken into account. This method incorporates a dual pooling approach for interactively embedding the hidden state vectors of given words in a given aspect. The maximum pooling and average pooling values ​​of the aspect vectors are obtained, respectively, and concatenated and passed to the next layer. The average pooling attention weights and maximum pooling attention weights of the words in the context are then calculated. Finally, the representations of the context and the given word in the given aspect are concatenated to form an interactive embedding. This avoids the loss of useful information caused by single pooling methods such as average pooling, and adopts a dual pooling approach to select important features of the given aspect and context, thereby reducing the loss of learned features.

[0103] Furthermore, generating a first hidden vector according to the given vector and the context pooling vector includes:

[0104] Identifying a first given vector in the given vectors that matches the context mean pooling vector, and identifying a second given vector in the given vectors that matches the context maximum pooling vector, and concatenating the first given vector and the second given vector to obtain a first hidden vector;

[0105] Generate a second hidden vector based on a given pooling vector and a context vector, including:

[0106] Identify a first context vector in the context vector that matches the given mean pooling vector, identify a second context vector in the context vector that matches the given maximum mean pooling vector, and concatenate the first context vector and the second context vector to obtain a second hidden vector;

[0107] Obtaining a global hidden vector according to the first hidden vector and the second hidden vector includes:

[0108] Set a given word that matches the key content and sentiment type conveyed by the context information in the given aspect represented in the first hidden vector as the first word vector, and set the sentiment type conveyed by the context information in the second hidden vector as the first sentiment vector;

[0109] Setting the context word representing the context information in the second hidden vector that matches the key content conveyed by the given aspect as the second word vector, and setting the sentiment type corresponding to the second word in the second hidden vector as the second sentiment vector;

[0110] Concatenating the first word vector and the second word vector to obtain a given context vector, and summarizing the first emotion vector and the second emotion vector to obtain an emotion set, wherein the emotion set has at least one emotion feature vector representing an emotion type;

[0111] The matching probability between each emotion feature vector and the given context vector is calculated, the matching probability and the emotion feature vector are concatenated to form a target emotion vector, and at least one target emotion vector is aggregated to obtain a global hidden vector.

[0112] In this example, by obtaining the first context vector and the second context vector, the given words in the given aspect that match the key content and emotion type conveyed by the context information under the premise of mean pooling processing, and the emotion type conveyed by the context information are obtained, as well as the given words in the given aspect that match the key content and emotion type conveyed by the context information under the premise of maximum pooling processing, and the emotion type conveyed by the context information are obtained, so as to achieve comparison between the given aspect and the context information that are respectively subjected to mean pooling and maximum pooling, thereby ensuring the comprehensiveness of the comparison between the given aspect and the context information, and avoiding the situation where the context information loses important information and causes low comparison accuracy.

[0113] By obtaining the first given vector and the second given vector, the context words in the context information that match the key content conveyed under the premise of mean pooling processing with the given aspect, and the emotion type conveyed by the context words, as well as the context words in the context information that match the key content conveyed under the premise of maximum pooling processing with the given aspect, and the emotion type conveyed by the context words are obtained, thereby achieving comparison between the context information and the given aspect that undergoes mean pooling and maximum pooling respectively, ensuring the comprehensiveness of the comparison between the given aspect and the context information, and avoiding the situation where the given aspect loses important information and causes low comparison accuracy.

[0114] The matching in this example is based on soft attention and / or hard attention, which sets two identical and / or similar objects (for example, vectors, words) as mutually matching objects. Among them, hard attention directly finds a specific word from the input sentence, and then aligns the target sentence word with this word, while the words in other input sentences are rigidly considered to have an alignment probability of 0. This is the idea of ​​the Hard Attention Model. Hard AM has proven useful in images, but it is not very useful in text because the one-to-one alignment of words is obviously too demanding. If the alignment is not correct, it will have a significant negative impact on subsequent processing. Soft attention is to give a probability for any word in the input sentence X when calculating the probability distribution of attention allocation. It is a probability distribution.

[0115] The matching probability in this example represents the degree of fit between the emotion type corresponding to each emotion feature vector and the given aspect and context information. In this embodiment, the matching probability is obtained by classifying and weighting each emotion type using a pre-set global fully connected layer.

[0116] S104: Based on the context vector and the given vector, identify the context words in the context information that express the emotion type of the given words in the given aspect, and generate local hidden vectors that reflect the emotion type of each given word; wherein the local hidden vectors represent the local emotion of the text data for each subject in the given aspect; one subject corresponds to one given word in the given aspect.

[0117] Considering here that the previous models are only coarse-grained interactions, when a given word in a given aspect contains multiple words as input, the effect of information interaction will become very poor. For example, given a given word "piece of cake" in a given aspect, we certainly hope that the contribution weight of the word "of" should be smaller than that of the other two words, so as not to affect the recognition of sentiment words in the interaction. Therefore, considering that the interaction between a given word and a context word will have different influences due to multiple words in the aspect. On the premise of proposing to compare the context information and the given aspect from a global perspective and obtain a global hidden vector, the present application also proposes to compare the given word in the given aspect with the context words in the context information from a local perspective, and obtain the local hidden vector of the context words and their weights that represent the sentiment type of the given word, so as to obtain information about the user's emotions on the given aspect at the aspect level or even the vocabulary level granularity.

[0118] In a preferred embodiment, based on the context vector and the given vector, identifying context words that express the sentiment type of a given word in a given aspect within the context information, and generating a local hidden vector reflecting the sentiment type of each given word, comprises:

[0119] Constructing at least one attention target based on at least one given feature in a given vector, and constructing source data and context data based on a context vector; wherein the source data is a context feature in the context vector corresponding to the attention target, and the context data is a context feature within a preset range around the source data;

[0120] Setting an attention target as a current target, identifying source data corresponding to the current target, obtaining at least one context data associated with the source data, and using the at least one context data as at least one associated feature of the current target;

[0121] The correlation between the associated features and the current target is calculated in sequence according to the preset weight vectors, and at least one correlation vector is obtained; wherein the correlation vector represents the emotional weight of the emotional type conveyed by the context word corresponding to the associated feature to the given word corresponding to the current target; and the emotional weight represents the degree of emotional influence of the emotional type on the given word corresponding to the current target;

[0122] All given features and their related vectors in a given vector are concatenated to obtain a local latent vector reflecting the local sentiment type of each given word in a given aspect.

[0123] In this example, an aspect-context encoder is used to implement word-level interaction between aspects and context, calculating their respective attention weights. Specifically, the aspect-context encoder and the attention weight vector pre-set in the encoder are used to identify context words within the context information that express the sentiment type of a given word in a given aspect based on the context vector and a given vector, and to generate a local hidden vector reflecting the sentiment type of each given word; the attention weight vector is obtained through training.

[0124] In addition, this example can also use the given vector as the query value (attention target) in the attention mechanism, regard the extracted context features as the Key value and Value value (context data) input, calculate the similarity between the query value and the key value to obtain the weight (related vector); normalize the weight to obtain a directly usable weight; and perform a weighted sum of the weight and the value to obtain the local hidden vector.

[0125] S105: Identify the emotion information of the user who generates the context information on the given aspect according to the global latent vector and the local latent vector.

[0126] This step comprehensively obtains the user's emotional type towards a given aspect from both global and local perspectives based on the global latent vector and the local latent vector, and obtains emotional information that can accurately represent the user's emotional attitude towards the given aspect based on the emotional types from the two perspectives, thereby improving the accuracy of public opinion sentiment analysis.

[0127] Considering that the model ignores the sequential information characteristics of the input sequence when using the attention mechanism to obtain interactive information, two positional attention mechanisms are introduced into the input vector. The first positional encoding is added to the input of the global attention mechanism, considering the relative position of words in the sentence. The local attention module needs to consider the weighted influence of the words surrounding a given word in a given aspect of the context. Therefore, the second positional encoding information is used, so that the context words around a given word in a given aspect should have a greater influence than the context words far away from the given aspect.

[0128] In a preferred embodiment, identifying the emotional information of the user generating the context information on a given aspect based on the global latent vector and the local latent vector includes:

[0129] Calculating the first emotion type and the first emotion probability of the given aspect of the context information generated by the user based on the global latent vector; wherein the first emotion type represents the overall emotion conveyed by the text data on the given aspect through the context information; and the first emotion probability represents the probability of each emotion type in the overall emotion conveyed by the text data;

[0130] Calculate the user-generated context information based on the local hidden vector, and the second emotion type and second emotion probability of each given word in the given aspect; wherein the second emotion type represents the local emotion conveyed by the text data to each subject in the given aspect through the context information; the second emotion probability represents the probability of each emotion type in the local emotion conveyed by the text data;

[0131] According to the first emotion type and its first emotion probability, and the second emotion type and its second emotion probability, the emotion information of the user on a given aspect is obtained.

[0132] In this example, a vector is obtained by using a preset fully connected layer to obtain the output of the last concatenated attention module and the local attention module, and is sequentially fed into a fully connected layer to obtain the final sentiment prediction for the words in the public opinion event. The fully connected layer is used to calculate the user-generated context information based on the global hidden vector, the first sentiment type and the first sentiment probability for a given aspect; and is used to calculate the user-generated context information based on the local hidden vector, the second sentiment type and the second sentiment probability for each given word in a given aspect; based on the first sentiment type and its first sentiment probability, and the second sentiment type and its second sentiment probability, the user's sentiment information for the given aspect is obtained. The loss function used by the fully connected layer consists of L2 regularization and cross-entropy loss function.

[0133] Fully connected layers (FC) act as classifiers within a convolutional neural network. Each node in a FC layer is connected to all nodes in the previous layer. They combine previously extracted features and predict the user's emotion based on the received global and local latent vectors.

[0134] The formula for L2 regularization is very simple. It directly adds the sum of squares of weight parameters to the original loss function: where Ein is the training sample error without the regularization term, and λ is the regularization parameter, which is adjustable.

[0135] Cross Entropy Loss is a loss function often used in classification problems. The formula is: Cross Entropy is an important concept in Shannon information theory, mainly used to measure the difference information between two probability distributions.

[0136] Example 2:

[0137] See also Figure 2 , the present application provides a sentiment analysis and processing device 1, comprising:

[0138] The recognition module 11 is used to obtain context information of the text data and identify a given aspect in the context information; wherein the context information is content that records the user's emotions, and the given aspect is the subject of the emotion to be analyzed;

[0139] The input layer module 12 is configured to vectorize the context information to obtain a context vector, and vectorize the given aspect to obtain a given vector; wherein the given vector represents the subject of the analyzed emotion in the text data, and the context vector represents the content in the text data that records the user's emotion;

[0140] A global attention module 13 is configured to identify the type of sentiment conveyed by a given aspect in context information based on the context vector and the given vector to obtain a global latent vector; wherein the global latent vector represents the overall sentiment of the text data towards the given aspect;

[0141] The local attention module 14 is configured to identify, based on the context vector and the given vector, context words that express the sentiment type of a given word in a given aspect within the context information, and generate a local latent vector reflecting the sentiment type of each given word; wherein the local latent vector represents the local sentiment of the text data for each subject in the given aspect; and one subject corresponds to one given word in the given aspect.

[0142] The global attention module 15 is used to identify the emotional information of the user who generates the context information on a given aspect based on the global latent vector and the local latent vector.

[0143] See also Figure 3 , Figure 3 Provided is an interaction module diagram between the input layer module, global attention module, local attention module, and fully connected module in the sentiment analysis and processing device in Example 2, and the vectors, attention mechanism, and encoder involved in Example 1.

[0144] Example 3:

[0145] To achieve the above-mentioned purpose, the present application further provides a computer device 2, comprising: a processor 22 and a memory 21 in communication with the processor 22; the memory 21 stores computer-executable instructions;

[0146] The processor executes the computer-executable instructions stored in the memory 21 to implement the above-mentioned sentiment analysis processing method. The components of the sentiment analysis processing device can be dispersed in different computer devices. The computer device 2 can be a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple application servers) that executes the program. The computer device of this embodiment includes at least but is not limited to: a memory 21 and a processor 22 that can be interconnected through a system bus, such as Figure 4 It should be pointed out that Figure 4 Only a computer device with component - is shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. In this embodiment, the memory 21 (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 21 can be an internal storage unit of the computer device, such as the hard disk or memory of the computer device. In other embodiments, the memory 21 can also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. Of course, the memory 21 can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 21 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the emotion analysis and processing device in Example 3. In addition, the memory 21 can also be used to temporarily store various types of data that have been output or will be output. In some embodiments, the processor 22 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 22 is generally used to control the overall operation of the computer device. In this embodiment, the processor 22 is used to run the program code stored in the memory 21 or process data, such as running the sentiment analysis processing device to implement the sentiment analysis processing method of the above embodiment.

[0147] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of each embodiment of the present application. It should be understood that the above-mentioned processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the application can be directly embodied as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor. The memory may include high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, or may be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.

[0148] To achieve the above objectives, the present application also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which computer executable instructions are stored, and when the program is executed by the processor 22, the corresponding function is realized. The computer-readable storage medium of this embodiment is used to store computer executable instructions for implementing the sentiment analysis processing method, and when executed by the processor 22, the sentiment analysis processing method of the above embodiment is realized.

[0149] The storage medium may be implemented by any type of volatile or non-volatile memory 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 read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0150] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.

[0151] The present application provides a computer program product, including a computer program, which implements the above-mentioned sentiment analysis processing method when executed by a processor.

[0152] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0153] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0154] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A sentiment analysis processing method, characterized in that: include: Acquire context information of text data and identify a given aspect in the context information; wherein the context information is content recording user emotions, and the given aspect is a subject for analyzing emotions; Vectorizing the context information to obtain a context vector, and vectorizing the given aspect to obtain a given vector; wherein the given vector represents the subject of the analyzed emotion in the text data, and the context vector represents the content in the text data that records the user's emotion; According to the context vector and the given vector, identifying the emotion type conveyed by the given aspect in the context information to obtain a global latent vector; wherein the global latent vector represents the overall emotion of the text data on the given aspect; Based on the context vector and the given vector, identifying context words in the context information that express the sentiment type of the given words in the given aspect, and generating local hidden vectors reflecting the sentiment type of each of the given words; wherein the local hidden vectors represent the local sentiment of the text data for each subject in the given aspect; one subject corresponds to one given word in the given aspect; Emotional information of a user generating the context information on the given aspect is identified based on the global latent vector and the local latent vector.

2. The sentiment analysis method according to claim 1, wherein: The vectorizing the context information to obtain a context vector, and the vectorizing the given aspect to obtain a given vector, include: The context information is encoded to obtain a context matrix, and a context vector is generated based on the context matrix; wherein the context matrix has at least one context feature; and the context vector records any context feature in the context matrix and a hidden feature of the association between any context feature and other context features in the context matrix; A given matrix is ​​obtained by encoding given information, and a given vector is generated based on the given matrix; wherein the given matrix has at least one given feature; and the given vector records any given feature in the given matrix, as well as hidden features of the association between any given sign and other given features in the given matrix.

3. The sentiment analysis method according to claim 1, wherein: The step of identifying the emotion type conveyed by the given aspect in the context information to obtain a global latent vector according to the context vector and the given vector includes: Performing pooling processing on the context vector to obtain a context pooling vector, and performing pooling processing on the given vector to obtain a given pooling vector; wherein the context pooling vector represents the key content and emotion type conveyed by the text data through the context information, and the given pooling vector represents the key content conveyed by the text data through the given aspect; Generate a first hidden vector based on the given vector and the context pooling vector; wherein the first hidden vector is a feature vector that matches the given vector with the context pooling vector, and the first hidden vector represents the given word in the given aspect that matches the key content and emotion type conveyed by the context information, and the emotion type conveyed by the context information; Generate a second hidden vector based on the given pooled vector and the context vector; wherein the second hidden vector is a feature vector that matches the given pooled vector in the context vector; the second hidden vector represents the context words and their sentiment types that match the key content conveyed by the given aspect in the context information; The global latent vector is obtained according to the first latent vector and the second latent vector; wherein the global latent vector represents the overall sentiment of the text data on the given aspect by representing the sentiment type conveyed by the context information and matching the given aspect.

4. The sentiment analysis processing method according to claim 3, characterized in that: The performing pooling processing on the context vector to obtain a context pooling vector, and the performing pooling processing on the given vector to obtain a given pooling vector, include: Performing mean pooling on the context vector to obtain a context mean pooling vector, performing maximum pooling on the context vector to obtain a context maximum pooling vector, and concatenating the context mean pooling vector and the context maximum pooling vector to obtain the context pooling vector; Performing mean pooling on the given vector to obtain a given mean pooling vector, performing maximum pooling on the given vector to obtain a given maximum pooling vector, and concatenating the given mean pooling vector and the given maximum pooling vector to obtain the given pooling vector.

5. The sentiment analysis processing method according to claim 4, characterized in that: The generating a first hidden vector according to the given vector and the context pooling vector includes: Identifying a first given vector in the given vectors that matches the context mean pooling vector, and identifying a second given vector in the given vectors that matches the context maximum pooling vector, and concatenating the first given vector and the second given vector to obtain a first hidden vector; The generating a second hidden vector according to the given pooling vector and the context vector includes: Identifying a first context vector in the context vector that matches the given mean pooling vector, and identifying a second context vector in the context vector that matches the given maximum mean pooling vector, and concatenating the first context vector and the second context vector to obtain a second hidden vector; The obtaining the global latent vector according to the first latent vector and the second latent vector includes: Set the given word in the given aspect represented in the first hidden vector that matches the key content and sentiment type conveyed by the context information as the first word vector, and set the sentiment type conveyed by the context information in the second hidden vector as the first sentiment vector; Setting the context word in the second hidden vector that represents the context information and matches the key content conveyed by the given aspect as a second word vector, and setting the emotion type corresponding to the second word in the second hidden vector as a second emotion vector; Concatenating the first word vector and the second word vector to obtain a given context vector, and summarizing the first emotion vector and the second emotion vector to obtain an emotion set, wherein the emotion set includes at least one emotion feature vector representing an emotion type; The matching probability between each of the emotion feature vectors and the given context vector is calculated, the matching probability is concatenated with the emotion feature vector to form a target emotion vector, and at least one target emotion vector is aggregated to obtain a global hidden vector.

6. The sentiment analysis method according to claim 1, wherein: The step of identifying context words expressing the sentiment type of the given words in the given aspect in the context information based on the context vector and the given vector, and generating a local hidden vector reflecting the sentiment type of each given word, comprises: Constructing at least one attention target based on at least one given feature in the given vector, and constructing source data and context data based on the context vector; wherein the source data is a context feature in the context vector corresponding to the attention target, and the context data is a context feature within a preset range around the source data; Setting an attention target as a current target, identifying source data corresponding to the current target, obtaining at least one context data associated with the source data, and using the at least one context data as at least one associated feature of the current target; The correlation between the associated features and the current target is calculated in sequence according to a preset weight vector, and at least one correlation vector is obtained; wherein the correlation vector represents the emotional weight of the emotional type conveyed by the context word corresponding to the associated feature to the given word corresponding to the current target; and the emotional weight represents the degree of emotional influence of the emotional type on the given word corresponding to the current target; All given features and their related vectors in the given vector are concatenated to obtain a local hidden vector reflecting the local sentiment type of each given word in the given aspect.

7. The sentiment analysis method according to any one of claims 1 to 6, characterized in that: The identifying, based on the global latent vector and the local latent vector, the emotion information of the user who generated the context information regarding the given aspect, comprises: Calculate the user-generated context information for the given aspect based on the global hidden vector, and a first emotion type and a first emotion probability; wherein the first emotion type represents the overall emotion conveyed by the text data on the given aspect through the context information; and the first emotion probability represents the probability of each emotion type in the overall emotion conveyed by the text data; Calculating the user-generated context information based on the local hidden vector, a second emotion type and a second emotion probability for each given word in the given aspect; wherein the second emotion type represents the local emotion conveyed by the text data to each subject in the given aspect through the context information; and the second emotion probability represents the probability of each emotion type in the local emotion conveyed by the text data; Emotional information of the user on the given aspect is obtained according to the first emotion type and its first emotion probability, and the second emotion type and its second emotion probability.

8. A sentiment analysis and processing device, characterized in that: include: an identification module, configured to obtain context information of text data and identify a given aspect in the context information; wherein the context information is content recording user emotions, and the given aspect is the subject of the emotion to be analyzed; An input layer module, configured to vectorize the context information to obtain a context vector, and vectorize the given aspect to obtain a given vector; wherein the given vector represents the subject of the analyzed emotion in the text data, and the context vector represents the content in the text data that records the user's emotion; A global attention module is configured to identify the type of emotion conveyed by the given aspect in the context information based on the context vector and the given vector to obtain a global latent vector; wherein the global latent vector represents the overall emotion of the text data for the given aspect; a local attention module, configured to identify, based on the context vector and the given vector, context words in the context information that express the sentiment type of the given words in the given aspect, and generate a local hidden vector reflecting the sentiment type of each of the given words; wherein the local hidden vector represents the local sentiment of the text data for each subject in the given aspect; and one subject corresponds to one given word in the given aspect; A global attention module is used to identify the emotional information of the user who generates the context information about the given aspect based on the global latent vector and the local latent vector.

9. A computer device, characterized in that: include: a processor and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the sentiment analysis processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the sentiment analysis and processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Document-level sentiment classification method based on dynamic word vectors and hierarchical neural network

    CN110765269A

  • Aspect-level sentiment analysis method, system and model based on double attention mechanism

    CN112861522A