Aspect-level sentiment analysis method and device, electronic equipment and storage medium
By employing bidirectional prediction and weighted calculation methods in aspect-level sentiment analysis, the problem of error propagation in existing technologies is solved, achieving more accurate aspect-level sentiment analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-17
- Publication Date
- 2026-04-14
AI Technical Summary
Existing aspect-level sentiment analysis methods suffer from low accuracy due to the neglect of the close relationship between aspect word extraction, opinion word extraction, and sentiment polarity prediction, which leads to error propagation.
By performing aspect-opinion pair prediction on the text to be analyzed in two directions—first predicting aspect words and then predicting opinion words based on aspect words, or first predicting opinion words and then predicting aspect words based on opinion words—and by combining shared and independent classifiers to calculate probabilities in a weighted manner, target aspect-opinion pairs are selected, and finally, sentiment polarity prediction is performed.
It improves the accuracy of aspect-level sentiment analysis, enabling more comprehensive identification of target aspect-opinion pairs and enhancing the accuracy of analysis results.
Smart Images

Figure CN116595176B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of analytical technology, and in particular to an aspect-level sentiment analysis method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] Aspect-based sentiment analysis (ABSA) is a fine-grained sentiment analysis task designed to identify the sentiment polarity of a specific aspect within a sentence. A sentence may contain multiple different aspects, each with potentially different sentiment polarities. Aspect-based sentiment analysis has many practical applications; for example, aspect-based sentiment analysis of product reviews can extract user evaluations of different parts / aspects of a product, providing manufacturers with more granular references for further product improvement.
[0003] Existing aspect-level sentiment analysis methods first extract aspect words and opinion words with sentiment through two different sequence labeling models. Then, a classifier is used to find valid aspect-opinion pairs from the predicted aspect words and opinion words, and finally, the sentiment polarity of the aspect-opinion pairs is predicted, resulting in an aspect-sentiment triple {aspect word, opinion word, sentiment polarity}. Although existing methods can achieve aspect-level sentiment analysis relatively simply, they suffer from error propagation problems because they ignore the close relationship between aspect word extraction, opinion word extraction, and sentiment polarity prediction, leading to low accuracy of aspect-level sentiment analysis results. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings and deficiencies of the prior art and provide an aspect-level sentiment analysis method that can obtain more accurate aspect-level sentiment analysis results.
[0005] This invention is achieved through the following technical solution: an aspect-level sentiment analysis method, characterized by comprising the following steps:
[0006] Obtain the text to be analyzed, and perform aspect word prediction on the text to be analyzed based on the first aspect word query statement to obtain several first aspect words;
[0007] Based on the first opinion word query statement, opinion words are predicted in the text to be analyzed to obtain several first opinion words;
[0008] Based on the query statements for each first aspect term and second opinion term, opinion term prediction is performed on the text to be analyzed to obtain the second opinion term corresponding to each first aspect term;
[0009] Based on the query statements for each first opinion word and second aspect word, aspect word prediction is performed on the text to be analyzed to obtain the second aspect word corresponding to each first opinion word;
[0010] Pair each first aspect word with its corresponding second opinion word to obtain a set of first aspect-opinion pairs;
[0011] Pair each first opinion word with its corresponding second aspect word to obtain a set of second aspect-opinion pairs;
[0012] The first aspect-opinion pair set and the second aspect-opinion pair set are filtered to obtain the target aspect-opinion pair;
[0013] For each of the aforementioned target aspect-opinion pairs, sentiment polarity prediction is performed to obtain the corresponding sentiment polarity.
[0014] Compared to existing technologies, the aspect-level sentiment analysis method of the present invention predicts aspect-opinion pairs of the text to be analyzed from two directions. In one direction, aspect words are predicted first and then opinion words are predicted based on aspect words. In the other direction, opinion words are predicted first and then aspect words are predicted based on opinion words. By combining the aspect-opinion pairs from both directions, the target aspect-opinion pairs can be identified more comprehensively, thereby improving the accuracy of aspect-level sentiment analysis.
[0015] Further, based on the first aspect term query statement, aspect term prediction is performed on the text to be analyzed to obtain several first aspect terms, including the following steps:
[0016] Based on the first aspect term query statement, the first shared aspect start probability and the first shared aspect end probability of each word in the text to be analyzed being the first aspect term start word are calculated by the shared classifier;
[0017] Based on the first aspect word query statement, the first aspect classifier calculates the first independent aspect start probability and the first independent aspect end probability of each word in the text to be analyzed as the first aspect word start word and the first aspect end probability of each word as the first aspect word end word in the text to be analyzed.
[0018] The first shared aspect starting probability and the first independent aspect starting probability of each word are weighted and summed to obtain the corresponding first aspect starting probability.
[0019] The first shared aspect termination probability and the first independent aspect termination probability of each word segment are weighted and summed to obtain the corresponding first aspect termination probability.
[0020] Calculate the product of the first aspect start probability and the first aspect end probability of each word segment, and determine the word segment corresponding to the first aspect start probability and the word segment corresponding to the first aspect end probability in each product greater than the first aspect threshold as a group of first aspect start words and first aspect end words.
[0021] The text to be analyzed is truncated based on the first and last words of each first aspect, resulting in several first aspect words.
[0022] Further, based on the first opinion word query statement, opinion word prediction is performed on the text to be analyzed to obtain several first opinion words, including the following steps:
[0023] Based on the first opinion word query statement, the shared classifier calculates the first shared opinion start probability and the first shared opinion end probability of each word in the text to be analyzed being the first opinion word start word and the first shared opinion end probability of each word being the first opinion word end word;
[0024] Based on the first opinion word query statement, the first opinion classifier calculates the first independent opinion initiation probability and the first independent opinion end probability of each word in the text to be analyzed as the first opinion word start word and the first opinion end word, respectively.
[0025] The first shared opinion starting probability and the first independent opinion starting probability of each word are weighted and summed to obtain the corresponding first opinion starting probability.
[0026] The first shared opinion termination probability and the first independent opinion termination probability of each word segment are weighted and summed to obtain the corresponding first opinion termination probability.
[0027] Calculate the product of the first opinion start probability and the first opinion end probability of each word segment, and determine the word segment corresponding to the first opinion start probability and the word segment corresponding to the first opinion end probability in each product greater than the first opinion threshold as a group of first opinion start words and first opinion end words;
[0028] The text to be analyzed is truncated based on the first and last words of each first opinion, resulting in several first opinion words.
[0029] Further, based on the query statements for each first aspect term and second opinion term, opinion term prediction is performed on the text to be analyzed to obtain the second opinion term corresponding to each first aspect term, including the following steps:
[0030] Based on each query statement of the first aspect word and the second opinion word, the shared classifier calculates the second shared opinion start probability and the second shared opinion end probability of each word in the text to be analyzed being the start word of the second opinion word and the second shared opinion end probability of each word being the end word of the second opinion word.
[0031] Based on each query statement of the first aspect word and the second opinion word, the second opinion classifier calculates the second independent opinion initiation probability and the second independent opinion termination probability of each word in the text to be analyzed as the start word of the second opinion word;
[0032] The weighted sum of the second shared opinion starting probability and the second independent opinion starting probability of each word segment is calculated to obtain the corresponding second opinion starting probability.
[0033] The second shared opinion termination probability and the second independent opinion termination probability of each word segment are weighted and summed to obtain the corresponding second opinion termination probability;
[0034] Calculate the product of the second opinion start probability and the second opinion end probability of each word segment, and determine the word segment corresponding to the second opinion start probability and the word segment corresponding to the second opinion end probability in each product greater than the second opinion threshold as a set of second opinion start words and second opinion end words;
[0035] The text to be analyzed is truncated based on the starting and ending words of each group of second opinions to obtain several second opinion words.
[0036] Further, based on the query statements for each first opinion word and second aspect word, aspect word prediction is performed on the text to be analyzed to obtain the second aspect word corresponding to each first opinion word, including the following steps:
[0037] Based on each query statement for the first and second aspect words, the shared classifier calculates the second shared aspect start probability and the second shared aspect end probability of each word in the text to be analyzed as the start word of the second aspect word and the second shared aspect end probability of each word as the end word of the second aspect word in the text to be analyzed.
[0038] Based on each query statement of the first opinion word and the second aspect word, the second aspect classifier calculates the second independent aspect start probability and the second independent aspect end probability of each word in the text to be analyzed as the start word of the second aspect word and the second independent aspect end probability of each word as the end word of the second aspect word.
[0039] The weighted sum of the second shared aspect starting probability and the second independent aspect starting probability of each word segment is calculated to obtain the corresponding second aspect starting probability.
[0040] The second shared aspect termination probability and the second independent aspect termination probability of each word segment are weighted and summed to obtain the corresponding second aspect termination probability.
[0041] Calculate the product of the second aspect start probability and the second aspect end probability of each word segment, and determine the word segment corresponding to the second aspect start probability and the word segment corresponding to the second aspect end probability in each product that is greater than the second aspect threshold as a set of second aspect start words and second aspect end words.
[0042] The text to be analyzed is truncated based on the starting word and ending word of each group of second aspects to obtain several second aspect words.
[0043] Further, the first aspect-opinion pair set and the second aspect-opinion pair set are filtered to obtain target aspect-opinion pairs, including the steps of: determining aspect-opinion pairs whose probability in the difference set of the first aspect-opinion pair set and the second aspect-opinion pair set is greater than a preset threshold, and aspect-opinion pairs in the intersection set of the first aspect-opinion pair set and the second aspect-opinion pair set as target aspect-opinion pairs.
[0044] Furthermore, the training parameters of the shared classifier, the first aspect classifier, the first opinion classifier, the second aspect classifier, the second aspect classifier, and the sentiment polarity prediction are optimized to minimize the joint loss function L. The expression for the joint loss function L(θ) is:
[0045] L(θ)=L N +L R +L S
[0046] Among them, L N The first cross-entropy loss is expressed as:
[0047]
[0048] Among them, |Q N | indicates the number of the first aspect term query statements or the first opinion term query statements; W indicates the number of words in the text to be analyzed; This indicates the true distribution of the j-th word as the starting word of the first aspect or the first opinion; This indicates the predicted distribution of the j-th word as the starting word of the first aspect word or the first opinion word; This indicates the true distribution of the j-th word as the end word of the first aspect word or the end word of the first opinion word; This indicates the predicted distribution of the j-th word as either the end word of the first aspect word or the end word of the first opinion word;
[0049] L R The second crossover loss is expressed as follows:
[0050]
[0051] Among them, |Q R | indicates the number of query statements for the second aspect term or the second opinion term; W indicates the number of words in the text to be analyzed; This indicates the true distribution of the j-th word as the starting word of the second aspect word or the second opinion word; This indicates the predicted distribution of the j-th word as the starting word of the second aspect word or the second opinion word; This indicates the true distribution of the j-th word as the end word of the second aspect word or the end word of the second opinion word; This indicates the predicted distribution of the j-th word as either the end word of the second aspect word or the end word of the second opinion word;
[0052] L S The emotional crossover loss is expressed as follows:
[0053]
[0054] in, The true distribution of the target aspect – opinion – on the emotional polarity; The target aspect – opinion – predicts the distribution of emotional polarity.
[0055] Based on the same inventive concept, the present invention also provides an aspect-level sentiment analysis device, comprising:
[0056] The first aspect prediction module is used to obtain the text to be analyzed, and perform aspect word prediction on the text to be analyzed according to the first aspect word query statement to obtain a number of first aspect words;
[0057] The first opinion prediction module is used to predict opinion words in the text to be analyzed based on the first opinion word query statement, and obtain a number of first opinion words.
[0058] The second opinion prediction module is used to predict opinion words in the text to be analyzed based on each first aspect word and second opinion word query statement to obtain the second opinion word corresponding to each first aspect word.
[0059] The second aspect prediction module is used to perform aspect word prediction on the text to be analyzed based on each first opinion word and second aspect word query statement to obtain the second aspect word corresponding to each first opinion word.
[0060] The first pairing module is used to pair each first aspect word with its corresponding second opinion word to obtain a first aspect-opinion pair set;
[0061] The second pairing module is used to pair each of the first opinion words with its corresponding second aspect words to obtain a set of second aspect-opinion pairs;
[0062] The filtering module is used to filter the first aspect-opinion pair set and the second aspect-opinion pair set to obtain the target aspect-opinion pair;
[0063] The sentiment polarity prediction module is used to predict the sentiment polarity for each of the target aspect-opinion pairs to obtain the corresponding sentiment polarity.
[0064] Based on the same inventive concept, the present invention also provides an electronic device, comprising:
[0065] processor;
[0066] Memory for storing computer programs executed by the processor;
[0067] The steps of the above method are implemented when the processor executes the computer program.
[0068] Based on the same inventive concept, the present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed, implements the steps of the above-described method.
[0069] To better understand and implement this invention, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description
[0070] Figure 1 This is a schematic diagram illustrating an application environment for an aspect-level sentiment analysis method according to an exemplary embodiment;
[0071] Figure 2 This is a flowchart illustrating the aspect-level sentiment analysis method used in this embodiment.
[0072] Figure 3 For execution Figure 2 The aspect-level sentiment analysis device of the method shown;
[0073] Figure 4 for Figure 2 A flowchart illustrating step S1a.
[0074] Figure 5 for Figure 2 A flowchart illustrating step S1b.
[0075] Figure 6 for Figure 2 A flowchart illustrating step S2a.
[0076] Figure 7 for Figure 2A flowchart illustrating step S2b. Detailed Implementation
[0077] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0078] Please see Figure 1 This is a schematic diagram illustrating an application environment for an aspect-level sentiment analysis method according to an exemplary embodiment. It includes a user terminal A and a server B. User terminal A can be any smart terminal with internet access, such as a computer, mobile phone, tablet computer, PDA (Personal Digital Assistant), e-book reader, multimedia player, etc. Server B can be a computer or a dedicated server. User terminal A can access a router via a wireless LAN and then access server B on the public internet through the router. Users can post comment text through user terminal A and transmit the comment text to server B. Server B treats this comment text as text to be analyzed and analyzes it using the aspect-level sentiment analysis method of this embodiment to obtain aspect-opinion pairs and their corresponding sentiment polarities.
[0079] Please see Figure 2 and Figure 3 ,in Figure 2 This is a flowchart illustrating the aspect-level sentiment analysis method in this embodiment. Figure 3 For execution Figure 2 The aspect-level sentiment analysis device of the method shown includes a first aspect prediction module 10a, a first opinion prediction module 10b, a second opinion prediction module 20a, a second aspect prediction module 20b, a first pairing module 30a, a second pairing module 30b, a screening module 40, and a sentiment polarity prediction module 50.
[0080] Specifically, the first aspect prediction module 10a is used to perform step S1a: obtain the text to be analyzed, perform aspect word prediction on the text to be analyzed according to the first aspect word query statement, and obtain a number of first aspect words.
[0081] The text to be analyzed is a text containing both opinion and viewpoint terms, such as "The movie was good, but the tickets were too expensive." A text to be analyzed containing N words can be denoted as W = {w1, w2, ... w...}. N}
[0082] The first aspect term query is a specific statement, such as "What aspects?". The first aspect term query and the text to be analyzed are input into the aspect term prediction model. Based on the characteristics of the first aspect term query, the aspect term prediction model can be guided to predict aspect terms in the text to be analyzed.
[0083] Please refer to the details again. Figure 3 See also Figure 4 , Figure 4 for Figure 2 The flowchart of step S1a is shown. The first aspect prediction module 10a includes a first shared classification submodule 10a1, a first aspect classification submodule 10a2, a first aspect initial probability calculation submodule 10a3a, a first aspect ending probability calculation submodule 10a3b, a first aspect probability calculation submodule 10a4, and a first aspect word extraction submodule 10a5.
[0084] The first shared classification submodule 10a1 is used to execute step S1a1: based on the first aspect word query statement, the shared classifier calculates the first shared aspect start probability of each word in the text to be analyzed as the first aspect word start word and the first shared aspect end probability of each word as the first aspect word end word.
[0085] The shared classifier is a binary classifier that can perform corresponding classification predictions based on various query statements. In step S1a1, the shared classifier performs classification predictions based on whether each word in the text to be analyzed is the start word and end word of the first aspect word according to the first aspect word query statement, and can obtain the first shared aspect initiation probability of each word being the start word of the first aspect word. The sum of the first shared aspect of the term ending with the first aspect term has a probability of ending. The calculation expressions are as follows:
[0086]
[0087]
[0088] Among them, the softmax function is selected as the logistic regression function; h |q|+2+i The first aspect term query statement and the text to be analyzed are concatenated and embedded, where |q| is the length of the first aspect term query statement; and For the trainable parameters of the shared classifier, d h The concatenated embedding representation of the first aspect term query statement and the text to be analyzed, h |q|+2+i Dimensions.
[0089] The embedding steps for concatenating and embedding the first-aspect term query statement and the text to be analyzed include: segmenting and concatenating the first-aspect term query statement and the text to be analyzed to obtain a sequence. Where [CLS] represents the start marker of the sequence, For the first aspect term query statement, |q i | Each word in sequence I is segmented, and [SEP] represents the delimiter; word embedding is performed on each word segment in sequence I to obtain the word embedding. Perform positional encoding on each word in sequence I to obtain the positional code. Perform segment embedding on each word in sequence I to obtain the segment embedding. Embed the words of each segment. Location coding and segment embedding Add them together to obtain the initial representation sequence. Encode the initial representation sequence to obtain the concatenated embedding representation H = h1, h2, ..., of the first aspect term query statement and the text to be analyzed. The embedding step of concatenating and embedding the first aspect query statement and the text to be analyzed can be performed by the BERT model.
[0090] The first aspect classification submodule 10a2 is used to execute step S1a2: based on the first aspect word query statement, the first aspect classifier calculates the first independent aspect start probability of each word in the text to be analyzed as the first aspect word start word and the first independent aspect end probability of each word as the first aspect word end word.
[0091] The first aspect classifier is a binary classifier, which can independently classify and predict whether each word in the text to be analyzed is the first aspect word start word and whether it is the first aspect word end word based on the first aspect word query statement, thus obtaining the first independent aspect initiation probability of each word being the first aspect word start word. The sum of the first independent aspects of the ending words of the first aspect term is the probability of the ending word. The calculation expressions are as follows:
[0092]
[0093]
[0094] in, and These are the trainable parameters for the first-aspect classifier.
[0095] The first aspect initial probability calculation submodule 10a3a is used to execute step S1a3a: calculate the weighted sum of the first shared aspect initial probability and the first independent aspect initial probability of each word segment to obtain the corresponding first aspect initial probability.
[0096] The initial probability expression for the first aspect of each word segment is:
[0097]
[0098] m+n=1
[0099] The first aspect termination probability calculation submodule 10a3b is used to execute step S1a3b: calculate the weighted sum of the first shared aspect termination probability and the first independent aspect termination probability of each word segment to obtain the corresponding first aspect termination probability.
[0100] The expression for the first aspect of the end probability of each word segment is as follows:
[0101]
[0102] m+n=1
[0103] The first aspect probability calculation submodule 10a4 is used to execute step S1a4: calculate the product of the first aspect start probability and the first aspect end probability of each word segment, and determine the word segment corresponding to the first aspect start probability and the word segment corresponding to the first aspect end probability in each product greater than the first aspect threshold as a set of first aspect start word and first aspect end word.
[0104] The product of the first aspect start probability of a word and the first aspect end probability of itself or another word represents the probability that the word or the pair of words is the start word and end word of the same first aspect word. The first aspect threshold is the critical probability that a pair of words can be the start word and end word of the same first aspect word respectively. Those skilled in the art can set the first aspect threshold according to the actual implementation situation, and this embodiment does not limit it.
[0105] The first aspect word extraction submodule 10a5 is used to execute step S1a5: extracting the text to be analyzed based on the first aspect start word and the first aspect end word of each group to obtain a number of first aspect words.
[0106] The text to be analyzed is truncated based on the starting and ending words of each set of first-aspect phrases. Specifically, the continuous text between the starting and ending words of the first aspect is extracted, and this extracted text is called the first-aspect phrase. If there are multiple sets of first-aspect phrases and ending words, there will be multiple first-aspect phrases. For example, for the text to be analyzed, "The movie was good, but the tickets were too expensive.", the first-aspect phrases would be "movie" and "tickets".
[0107] The first opinion prediction module 10b is used to perform step S1b: predicting opinion words in the text to be analyzed based on the first opinion word query statement, and obtaining several first opinion words.
[0108] The first opinion word query is a specific statement, such as "What opinions?". The first opinion word query and the text to be analyzed are input into the opinion word prediction model. Based on the characteristics of the first opinion word query, the opinion word prediction model can be guided to predict the opinion words in the text to be analyzed.
[0109] Please refer to the details again. Figure 3 See also Figure 5 , Figure 5 for Figure 2 The flowchart of step S1b is shown below. The first opinion prediction module 10b includes a second shared classification submodule 10b1, a first opinion classification submodule 10b2, a first opinion start probability calculation submodule 10b3a, a first opinion end probability calculation submodule 10b3b, a first opinion probability calculation submodule 10b4, and a first opinion word extraction submodule 10b5.
[0110] The second shared classification submodule 10b1 is used to execute step S1b1: based on the first opinion word query statement, the shared classifier calculates the first shared opinion start probability and the first shared opinion end probability of each word in the text to be analyzed being the first opinion word start word.
[0111] In step S1b1, the shared classifier classifies and predicts whether each word in the text to be analyzed is the first opinion word start word and whether it is the first opinion word end word based on the first opinion word query statement, thus obtaining the first shared opinion initiation probability of each word being the first opinion word start word. The sum of the first opinion term and the end term represents the probability of the first shared opinion term ending. The calculation expressions are as follows:
[0112]
[0113]
[0114] in, The embedding steps for the concatenated embedding representation of the first opinion term query statement and the text to be analyzed are the same as those for the concatenated embedding representation of the first opinion term query statement and the text to be analyzed, and will not be repeated here.
[0115] The first opinion classification submodule 10b2 is used to execute step S1b2: based on the first opinion word query statement, the first opinion classifier calculates the first independent opinion start probability and the first independent opinion end probability of each word in the text to be analyzed as the first opinion word start word.
[0116] The first opinion classifier is a binary classifier, which can independently classify and predict whether each word in the text to be analyzed is the first opinion word start word and whether it is the first opinion word end word based on the first opinion word query statement, thus obtaining the first independent opinion initiation probability of each word being the first opinion word start word. The sum of the first opinion term and the first independent opinion term's ending probability. The calculation expressions are as follows:
[0117]
[0118]
[0119] in, and These are the trainable parameters for the first-opinion classifier.
[0120] The first opinion starting probability calculation submodule 10b3a is used to execute step S1b3a: calculate the weighted sum of the first shared opinion starting probability and the first independent opinion starting probability for each word segment to obtain the corresponding first opinion starting probability.
[0121] The initial probability expression for the first opinion of each word segment is as follows:
[0122]
[0123] m+n=1
[0124] The first opinion termination probability calculation submodule 10b3b is used to execute step S1b3b: calculate the weighted sum of the first shared opinion termination probability and the first independent opinion termination probability for each word segment to obtain the corresponding first opinion termination probability.
[0125] The expression for the first opinion termination probability of each word segment is as follows:
[0126]
[0127] m+n=1
[0128] The first opinion probability calculation submodule 10b4 is used to execute step S1b4: calculate the product of the first opinion start probability and the first opinion end probability of each word segment, and determine the word segment corresponding to the first opinion start probability and the word segment corresponding to the first opinion end probability in each product greater than the first opinion threshold as a set of first opinion start words and first opinion end words.
[0129] The product of the first opinion start probability of a word and the first opinion end probability of itself or another word represents the probability that the word or the pair of words is the start word and end word of the same first opinion word. The first opinion threshold is the critical probability that a pair of words can be the start word and end word of the same first opinion word respectively. Those skilled in the art can set the first opinion threshold according to the actual implementation situation, and this embodiment does not limit it.
[0130] The first opinion word extraction submodule 10b5 is used to perform step S1b5: extracting the text to be analyzed based on the first opinion start word and the first opinion end word of each group to obtain several first opinion words.
[0131] The text to be analyzed is truncated based on the first and last words of each set of first opinions. This means extracting the continuous text from the first to the last word of the first opinion; the extracted text is called the first opinion word. If there are multiple sets of first and last words, there will be multiple first opinion words. For example, for the text to be analyzed, "The movie was good, but the tickets were too expensive.", the first opinion words would be "good" and "expensive".
[0132] The second opinion prediction module 20a is used to perform step S2a: predicting opinion words in the text to be analyzed based on the query statements for each first aspect word and second opinion word, and obtaining the second opinion word corresponding to each first aspect word.
[0133] The second opinion term query is a specific statement that can embed the first opinion term, such as "What opinions given the aspect {first opinion term}?". The second opinion term query and the text to be analyzed are input into the opinion term prediction model. Based on the characteristics of the second opinion term query, the opinion term prediction model can be guided to predict the opinion terms in the text to be analyzed.
[0134] Please refer to the details again. Figure 3 See also Figure 6 , Figure 6 for Figure 2The flowchart of step S2a is shown. The second opinion prediction module 20a includes the third shared classification submodule 20a1, the second opinion classification submodule 20a2, the second opinion start probability calculation submodule 20a3a, the second opinion end probability calculation submodule 20a3b, the second opinion probability calculation submodule 20a4, and the second opinion word extraction submodule 20a5.
[0135] The third shared classification submodule 20a1 is used to execute step S2a1: based on each first aspect word and second opinion word query statement, the shared classifier calculates the second shared opinion start probability and the second shared opinion end probability of each word in the text to be analyzed being the start word of the second opinion word.
[0136] In step S2a1, the shared classifier classifies and predicts whether each word in the text to be analyzed is the start word and end word of the second opinion word based on the query statement for each first opinion word and the second opinion word. This yields the second shared opinion initiation probability for each word to be the start word of the second opinion word. The sum of the second opinion term ending with the probability of the second shared opinion term ending. The calculation expressions are as follows:
[0137]
[0138]
[0139] in, The embedding steps for the concatenated embedding representation of the second opinion term query statement and the text to be analyzed are the same as those for the concatenated embedding representation of the first opinion term query statement and the text to be analyzed, and will not be repeated here.
[0140] The second opinion classification submodule 20a2 is used to perform step S2a2: based on each first opinion word and second opinion word query statement, the second opinion classifier calculates the second independent opinion start probability and the second independent opinion end probability of each word in the text to be analyzed being the start word of the second opinion word.
[0141] The second opinion classifier is a binary classifier that can independently classify and predict whether each word in the text to be analyzed is a second opinion word start word or a second opinion word end word based on the second opinion word query statement, thus obtaining the second independent opinion initiation probability of each word being a second opinion word start word. The sum of the probabilities of the second independent opinion ending with the second opinion term is a factor in determining the probability of the second opinion ending. The calculation expressions are as follows:
[0142]
[0143]
[0144] in, and These are the trainable parameters for the second-opinion classifier.
[0145] The second opinion initiation probability calculation submodule 20a3a is used to execute step S2a3a: the second shared opinion initiation probability and the second independent opinion initiation probability of each word are weighted and calculated to obtain the corresponding second opinion initiation probability.
[0146] The initial probability expression for the second opinion of each word segment is as follows:
[0147]
[0148] m+n=1
[0149] The second opinion termination probability calculation submodule 20a3b is used to execute step S2a3a: calculate the weighted sum of the second shared opinion termination probability and the second independent opinion termination probability for each word segment to obtain the corresponding second opinion termination probability.
[0150] The expression for the second opinion termination probability of each word segment is as follows:
[0151]
[0152] m+n=1
[0153] The second opinion probability calculation submodule 20a4 is used to execute step S2a4: calculate the product of the second opinion start probability and the second opinion end probability of each word segment, and determine the word segment corresponding to the second opinion start probability and the word segment corresponding to the second opinion end probability in each product greater than the second opinion threshold as a set of second opinion start words and second opinion end words.
[0154] The product of the second opinion start probability of a word and the second opinion end probability of itself or another word represents the probability that the word or the pair of words is the start word and end word of the same second opinion word. The second opinion threshold is the critical probability that a pair of words can be the start word and end word of the same second opinion word respectively. Those skilled in the art can set the second opinion threshold according to the actual implementation situation, and this embodiment does not limit it.
[0155] The second opinion word extraction submodule 20a5 is used to perform step S2a5: extracting the text to be analyzed based on the first word and the last word of each group of second opinions to obtain several second opinion words.
[0156] The text to be analyzed is truncated based on the starting and ending words of each set of second opinions. Specifically, the continuous text between the starting and ending words of the second opinion is extracted and termed the second opinion word. If there are multiple sets of starting and ending words, there will be multiple second opinion words. For example, for the first opinion word "movie," the second opinion word would be "good"; for the first opinion word "tickets," the second opinion word would be "expensive."
[0157] The second aspect prediction module 20b is used to perform step S2b: predict aspect terms in the text to be analyzed based on each first opinion term and second aspect term query statement to obtain the second aspect term corresponding to each first opinion term.
[0158] The second aspect term query is a specific statement that can embed the first opinion term, such as "What aspects given the opinion {first opinion term}?". The second aspect term query and the text to be analyzed are input into the aspect term prediction model. Based on the characteristics of the second aspect term query, the aspect term prediction model can be guided to predict aspect terms in the text to be analyzed.
[0159] Please refer to the details again. Figure 3 See also Figure 7 , Figure 7 for Figure 2 The flowchart of step S2b is shown. The second aspect prediction module 20b includes the fourth shared classification submodule 20b1, the second aspect classification submodule 20b2, the second aspect initial probability calculation submodule 20b3a, the second aspect ending probability calculation submodule 20b3b, the second aspect probability calculation submodule 20b4, and the second aspect word extraction submodule 20b5.
[0160] The third shared classification submodule 20b1 is used to execute step S2b1: based on each first aspect word and second aspect word query statement, the shared classifier calculates the second shared aspect start probability of each word in the text to be analyzed being the start word of the second aspect word and the second shared aspect end probability of each word being the end word of the second aspect word.
[0161] In step S2b1, the shared classifier classifies and predicts whether each word in the text to be analyzed is the start word and end word of the second aspect word based on the query statement for each first opinion word and the second aspect word. This yields the second shared aspect initiation probability for each word as the start word of the second aspect word. The probability of ending the second shared aspect of the term "and" is the same as the probability of ending the second shared aspect of the term "and". The calculation expressions are as follows:
[0162]
[0163]
[0164] in, The embedding steps for the concatenated embedding representation of the second-aspect term query statement and the text to be analyzed are the same as those for the concatenated embedding representation of the first-aspect term query statement and the text to be analyzed, and will not be repeated here.
[0165] The second opinion classification submodule 20b2 is used to execute step S2b2: based on each first opinion word and second aspect word query statement, the second aspect classifier calculates the second independent aspect start probability of each word in the text to be analyzed as the start word of the second aspect word and the second independent aspect end probability of each word as the end word of the second aspect word.
[0166] The second-aspect classifier is a binary classifier that can independently classify and predict whether each word in the text to be analyzed is the start word or end word of the second-aspect word based on the second-aspect word query, thus obtaining the second independent aspect initiation probability of each word being the start word of the second-aspect word. The sum of the probabilities of the second independent aspect of the term ending with the second aspect term. The calculation expressions are as follows:
[0167]
[0168]
[0169] in, and These are the trainable parameters for the second-aspect classifier.
[0170] The second opinion starting probability calculation submodule 20b3a is used to execute step S2b3a: the weighted sum of the second shared aspect starting probability and the second independent aspect starting probability of each word segment is calculated to obtain the corresponding second aspect starting probability.
[0171] The initial probability expression for the second aspect of each word segment is as follows:
[0172]
[0173] m+n=1
[0174] The second opinion termination probability calculation submodule 20b3b is used to execute step S2b3b: calculate the weighted sum of the second shared aspect termination probability and the second independent aspect termination probability of each word segment to obtain the corresponding second aspect termination probability.
[0175] The expression for the second aspect of the end probability of each word segment is as follows:
[0176]
[0177] m+n=1
[0178] The second opinion probability calculation submodule 20b4 is used to execute step S2b4: calculate the product of the second aspect start probability and the second aspect end probability of each word segment, and determine the word segment corresponding to the second aspect start probability and the word segment corresponding to the second aspect end probability in each product greater than the second aspect threshold as a set of second aspect start words and second aspect end words.
[0179] The product of the second-side starting probability of a word and the second-side ending probability of itself or another word represents the probability that the word or the pair of words is the starting word and ending word of the same second-side word. The second-side threshold is the critical probability that a pair of words can be the starting word and ending word of the same second-side word respectively. Those skilled in the art can set the second-side threshold according to the actual implementation situation, and this embodiment does not limit it.
[0180] The second opinion word extraction submodule 20b5 is used to perform step S2b5: extracting the text to be analyzed based on the starting word and ending word of each group of second aspects to obtain several second aspect words.
[0181] The text to be analyzed is truncated based on the starting and ending words of each set of second-side terms. Specifically, the continuous text between the starting and ending words of the second-side term is extracted and termed the second-side term. If there are multiple sets of second-side starting and ending words, there will be multiple second-side terms. For example, for the first opinion term "good," the second opinion term will be "movie"; for the first opinion term "expensive," the second opinion term will be "tickets."
[0182] The first pairing module 30a is used to perform step S3a: pairing each first aspect word with its corresponding second opinion word to obtain a set of first aspect-opinion pairs.
[0183] The second pairing module 30b is used to perform step S3b: pairing each first opinion word with its corresponding second aspect word to obtain a set of second aspect-opinion pairs.
[0184] The filtering module 40 is used to perform step S4: filtering the first aspect-opinion pair set and the second aspect-opinion pair set to obtain the target aspect-opinion pair.
[0185] Specifically, the first set of opinion pairs and the second set of opinion pairs are screened by identifying opinion pairs whose probability in the difference set of the first set of opinion pairs and the second set of opinion pairs is greater than a preset threshold, and the opinion pairs in the intersection set of the first set of opinion pairs and the second set of opinion pairs are the target opinion pairs. The target opinion pair set can be represented as:
[0186] V=V′∪{(a,o)|(a,o)∈V″,p(a,o)>δ}
[0187] Wherein, V′ is the intersection of the first aspect-opinion pair set and the second aspect-opinion pair set; V″ is the difference between the first aspect-opinion pair set and the second aspect-opinion pair set; δ is a preset threshold, which can be set to 0.8, and the specific value can be set according to the actual implementation situation.
[0188] The sentiment polarity prediction module 50 is used to perform step S5: predict the sentiment polarity for each target aspect-opinion pair to obtain the corresponding sentiment polarity.
[0189] The sentiment classifier can be used to predict the sentiment polarity of each target aspect-opinion pair. The sentiment classifier is a triadic classifier with three categories: positive, neutral, and negative. The sentiment classifier calculates the probability that each target aspect-opinion pair represents one of the three sentiment polarities, and the calculation expression is as follows:
[0190] p(y S |X,q)=softmax(h1W c )
[0191] Where h1 is the concatenated embedding representation of the sentiment query statement and the target aspect-opinion pair, W c These are the trainable parameters for the sentiment classifier.
[0192] The sentiment polarity category with the highest probability is the sentiment polarity of the goal aspect-opinion pair.
[0193] Based on the target aspect-opinion pair and its corresponding emotional polarity, an aspect-level emotional triplet can be obtained, denoted as... Where a i For the aspect terms in the target aspect-opinion pair, o i For the target aspect - opinion pair, opinion words, s i For the goal aspect - the emotional polarity of the opinion pair.
[0194] The shared classifier in steps S1a1, S1b1, S2a1, and S2b1 above can be the same classifier or multiple classifiers that share training parameters. Those skilled in the art can choose the implementation method as needed.
[0195] To ensure that the training of aspect word prediction, opinion word prediction, and sentiment polarity prediction can benefit each other, a joint loss function is used to train the training parameters of these three functions simultaneously. The expression for this joint loss function is as follows:
[0196] L(θ)=L N +L R +L S
[0197] Among them, L N The first cross-entropy loss is expressed as:
[0198]
[0199] Among them, |Q N | indicates the number of the first aspect term query statements or the first opinion term query statements; W indicates the number of words in the text to be analyzed; This indicates the true distribution of the j-th word as the starting word of the first aspect or the first opinion; This indicates the predicted distribution of the j-th word as the starting word of the first aspect word or the first opinion word; This indicates the true distribution of the j-th word as the end word of the first aspect word or the end word of the first opinion word; This indicates the predicted distribution of the j-th word as either the end word of the first aspect word or the end word of the first opinion word.
[0200] L R The second crossover loss is expressed as follows:
[0201]
[0202] Among them, |Q R | indicates the number of query statements for the second aspect term or the second opinion term; W indicates the number of words in the text to be analyzed; This indicates the true distribution of the j-th word as the starting word of the second aspect word or the second opinion word; This indicates the predicted distribution of the j-th word as the starting word of the second aspect word or the second opinion word; This indicates the true distribution of the j-th word as the end word of the second aspect word or the end word of the second opinion word; This indicates the predicted distribution of the j-th word as either the end word of the second aspect word or the end word of the second opinion word.
[0203] L S The emotional crossover loss is expressed as follows:
[0204]
[0205] in, For the objective aspect - the true distribution of opinion on emotional polarity; For the target aspect - the distribution of the prediction of emotional polarity.
[0206] Based on the joint loss function, either gradient descent or AdamW method is selected to optimize the training parameters in the shared classifier, first-aspect classifier, first-opinion classifier, second-aspect classifier, second-aspect classifier, and BERT model, so as to minimize the joint loss function, thus completing the training.
[0207] Compared to existing technologies, the aspect-level sentiment analysis method of the present invention predicts aspect-opinion pairs of the text to be analyzed from two directions. In one direction, aspect words are predicted first and then opinion words are predicted based on aspect words. In the other direction, opinion words are predicted first and then aspect words are predicted based on opinion words. By combining the aspect-opinion pairs from both directions, the target aspect-opinion pairs can be identified more comprehensively, thereby improving the accuracy of aspect-level sentiment analysis.
[0208] Furthermore, by using a shared classifier and separate independent classifiers to predict aspect-level words and opinion words, semantic information sharing is achieved while maintaining prediction independence, reducing prediction conflicts, and further improving the accuracy of aspect-level sentiment analysis.
[0209] Based on the same inventive concept, this application also provides an electronic device, which can be a server, desktop computing device, or mobile computing device (e.g., laptop computing device, handheld computing device, tablet computer, netbook, etc.). The device includes one or more processors and a memory, wherein the processor is used to execute an aspect-level sentiment analysis method implementing a method embodiment; the memory is used to store a computer program executable by the processor.
[0210] Based on the same inventive concept, this application also provides a computer-readable storage medium corresponding to the aforementioned embodiments of the aspect-level sentiment analysis method. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the aspect-level sentiment analysis method described in any of the above embodiments.
[0211] This application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to: phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0212] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and the present invention also intends to include these modifications and variations.
Claims
1. A method for aspect-level sentiment analysis, characterized in that, Includes the following steps: Obtain the text to be analyzed, and perform aspect word prediction on the text to be analyzed based on the first aspect word query statement to obtain several first aspect words; Based on the first opinion word query statement, opinion words are predicted in the text to be analyzed to obtain several first opinion words; Based on the query statements for each first aspect term and second opinion term, opinion term prediction is performed on the text to be analyzed to obtain the second opinion term corresponding to each first aspect term; Based on the query statements for each first opinion word and second aspect word, aspect word prediction is performed on the text to be analyzed to obtain the second aspect word corresponding to each first opinion word; Pair each first aspect word with its corresponding second opinion word to obtain a set of first aspect-opinion pairs; Pair each first opinion word with its corresponding second aspect word to obtain a set of second aspect-opinion pairs; The first aspect-opinion pair set and the second aspect-opinion pair set are filtered to obtain the target aspect-opinion pair; For each of the aforementioned target aspect-opinion pairs, sentiment polarity prediction is performed to obtain the corresponding sentiment polarity; The step of predicting aspect terms in the text to be analyzed based on the first aspect term query statement to obtain several first aspect terms includes the following steps: Based on the first aspect term query statement, the first shared aspect start probability and the first shared aspect end probability of each segment of the text to be analyzed being the first aspect term start word and the first shared aspect end probability of each segment being the first aspect term end word are calculated by the shared classifier; Based on the first aspect word query statement, the first aspect classifier calculates the first independent aspect start probability and the first independent aspect end probability of each word in the text to be analyzed as the first aspect word start word and the first aspect end probability of each word as the first aspect word end word in the text to be analyzed. The first shared aspect starting probability and the first independent aspect starting probability of each word are weighted and summed to obtain the corresponding first aspect starting probability. The first shared aspect termination probability and the first independent aspect termination probability of each word segment are weighted and summed to obtain the corresponding first aspect termination probability. Calculate the product of the first aspect start probability and the first aspect end probability of each word segment, and determine the word segment corresponding to the first aspect start probability and the word segment corresponding to the first aspect end probability in each product greater than the first aspect threshold as a group of first aspect start words and first aspect end words. The text to be analyzed is truncated based on the first and last words of each first aspect, resulting in several first aspect words.
2. The method of claim 1, wherein, Based on the first opinion term query statement, the text to be analyzed is subjected to opinion term prediction to obtain several first opinion terms, including the following steps: Based on the first opinion word query statement, the shared classifier calculates the first shared opinion start probability and the first shared opinion end probability of each word in the text to be analyzed being the first opinion word start word and the first shared opinion end probability of each word being the first opinion word end word. Based on the first opinion word query statement, the first opinion classifier calculates the first independent opinion initiation probability and the first independent opinion end probability of each word in the text to be analyzed as the first opinion word start word and the first independent opinion end word, respectively. The first shared opinion starting probability and the first independent opinion starting probability of each word are weighted and summed to obtain the corresponding first opinion starting probability. The first shared opinion termination probability and the first independent opinion termination probability of each word segment are weighted and summed to obtain the corresponding first opinion termination probability. Calculate the product of the first opinion start probability and the first opinion end probability of each word segment, and determine the word segment corresponding to the first opinion start probability and the word segment corresponding to the first opinion end probability in each product greater than the first opinion threshold as a group of first opinion start words and first opinion end words; The text to be analyzed is truncated based on the first and last words of each first opinion, resulting in several first opinion words.
3. The method of claim 2, wherein, Based on the query statements for each first aspect term and second opinion term, the text to be analyzed is used to predict opinion terms, thereby obtaining the second opinion term corresponding to each first aspect term, including the following steps: Based on each query statement of the first aspect word and the second opinion word, the shared classifier calculates the second shared opinion start probability and the second shared opinion end probability of each word in the text to be analyzed being the start word of the second opinion word and the second shared opinion end probability of each word being the end word of the second opinion word. Based on each query statement of the first aspect word and the second opinion word, the second opinion classifier calculates the second independent opinion initiation probability and the second independent opinion termination probability of each word in the text to be analyzed as the start word of the second opinion word; The weighted sum of the second shared opinion starting probability and the second independent opinion starting probability of each word segment is calculated to obtain the corresponding second opinion starting probability. The second shared opinion termination probability and the second independent opinion termination probability of each word segment are weighted and summed to obtain the corresponding second opinion termination probability; Calculate the product of the second opinion start probability and the second opinion end probability of each word segment, and determine the word segment corresponding to the second opinion start probability and the word segment corresponding to the second opinion end probability in each product greater than the second opinion threshold as a set of second opinion start words and second opinion end words; The text to be analyzed is truncated based on the starting and ending words of each group of second opinions to obtain several second opinion words.
4. The method of claim 3, wherein, Based on the query statements for each first opinion word and second aspect word, aspect word prediction is performed on the text to be analyzed to obtain the second aspect word corresponding to each first opinion word, including the following steps: Based on each query statement for the first aspect word and the second aspect word, the shared classifier calculates the second shared aspect start probability and the second shared aspect end probability of each word in the text to be analyzed as the start word of the second aspect word and the second shared aspect end probability of each word as the end word of the second aspect word in the text to be analyzed. Based on each query statement of the first opinion word and the second aspect word, the second aspect classifier calculates the second independent aspect start probability and the second independent aspect end probability of each word in the text to be analyzed as the start word of the second aspect word and the second independent aspect end probability of each word as the end word of the second aspect word. The weighted sum of the second shared aspect starting probability and the second independent aspect starting probability of each word segment is calculated to obtain the corresponding second aspect starting probability. The second shared aspect termination probability and the second independent aspect termination probability of each word segment are weighted and summed to obtain the corresponding second aspect termination probability. Calculate the product of the second aspect start probability and the second aspect end probability of each word segment, and determine the word segment corresponding to the second aspect start probability and the word segment corresponding to the second aspect end probability in each product greater than the second aspect threshold as a set of second aspect start words and second aspect end words. The text to be analyzed is truncated based on the starting word and ending word of each group of second aspects to obtain several second aspect words.
5. The method of claim 4, wherein, The process of filtering the first set of opinion pairs and the second set of opinion pairs to obtain target opinion pairs includes the following steps: determining the opinion pairs whose probability in the difference set of the first set of opinion pairs and the second set of opinion pairs is greater than a preset threshold, and the opinion pairs in the intersection set of the first set of opinion pairs and the second set of opinion pairs as target opinion pairs.
6. The method according to claim 5, characterized in that, optimizing the training parameters in the shared classifier, the first aspect classifier, the first opinion classifier, the second aspect classifier, the second aspect classifier, and the sentiment polarity prediction to minimize a joint loss function L, the joint loss function L is expressed as: wherein, is a first cross-entropy loss, which is expressed as: wherein, | represents the number of the first aspect term query statements or the first opinion term query statements; W represents the number of terms in the text to be analyzed; represents the true distribution of the jth term being the first aspect term start term or the first opinion term start term; represents the predicted distribution of the jth term being the first aspect term start term or the first opinion term start term; represents the true distribution of the jth term being the first aspect term end term or the first opinion term end term; represents the predicted distribution of the jth term being the first aspect term end term or the first opinion term end term; The second crossover loss is expressed as follows: Among them, | | indicates the number of query statements for the second aspect term or the second opinion term; W indicates the number of words in the text to be analyzed; This indicates the true distribution of the j-th word as the starting word of the second aspect word or the second opinion word; This represents the predicted distribution of the j-th word as the starting word of the second aspect word or the second opinion word; This indicates the true distribution of the j-th word as the end word of the second aspect word or the end word of the second opinion word; This indicates the predicted distribution of the j-th word as either the end word of the second aspect word or the end word of the second opinion word; The emotional crossover loss is expressed as follows: in, The true distribution of the target aspect – opinion – in terms of emotional polarity; The target aspect – opinion – predicts the distribution of emotional polarity.
7. An aspect-level sentiment analysis device, characterized in that, include: The first aspect prediction module is used to obtain the text to be analyzed, and perform aspect word prediction on the text to be analyzed according to the first aspect word query statement to obtain a number of first aspect words; The first opinion prediction module is used to predict opinion words in the text to be analyzed based on the first opinion word query statement, and obtain a number of first opinion words. The second opinion prediction module is used to predict opinion words in the text to be analyzed based on each first aspect word and second opinion word query statement to obtain the second opinion word corresponding to each first aspect word. The second aspect prediction module is used to perform aspect word prediction on the text to be analyzed based on each first opinion word and second aspect word query statement to obtain the second aspect word corresponding to each first opinion word. The first pairing module is used to pair each first aspect word with its corresponding second opinion word to obtain a first aspect-opinion pair set; The second pairing module is used to pair each of the first opinion words with its corresponding second aspect words to obtain a set of second aspect-opinion pairs; The filtering module is used to filter the first aspect-opinion pair set and the second aspect-opinion pair set to obtain the target aspect-opinion pair; The sentiment polarity prediction module is used to predict the sentiment polarity for each of the target aspect-opinion pairs to obtain the corresponding sentiment polarity. The method for the first aspect prediction module to predict aspect terms in the text to be analyzed based on the first aspect term query statement to obtain several first aspect terms includes the following steps: Based on the first aspect term query statement, the first shared aspect start probability and the first shared aspect end probability of each segment of the text to be analyzed being the first aspect term start word and the first shared aspect end probability of each segment being the first aspect term end word are calculated by the shared classifier; Based on the first aspect word query statement, the first aspect classifier calculates the first independent aspect start probability and the first independent aspect end probability of each word in the text to be analyzed as the first aspect word start word and the first aspect end probability of each word as the first aspect word end word in the text to be analyzed. The first shared aspect starting probability and the first independent aspect starting probability of each word are weighted and summed to obtain the corresponding first aspect starting probability. The first shared aspect termination probability and the first independent aspect termination probability of each word segment are weighted and summed to obtain the corresponding first aspect termination probability. Calculate the product of the first aspect start probability and the first aspect end probability of each word segment, and determine the word segment corresponding to the first aspect start probability and the word segment corresponding to the first aspect end probability in each product greater than the first aspect threshold as a group of first aspect start words and first aspect end words. The text to be analyzed is truncated based on the first and last words of each first aspect, resulting in several first aspect words.
8. An electronic device, characterized in that, include: processor; Memory for storing computer programs executed by the processor; Wherein, when the processor executes the computer program, it implements the steps of the method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it performs the steps of the method according to any one of claims 1-6.
Citation Information
Patent Citations
Aspect-level sentiment analysis method and system
CN114626377A