Music review sentiment analysis method, device and medium
By using preset sentence pattern templates and sentiment dictionary to generate training data, and using the embedded vector method to integrate network vocabulary and comparative sentence patterns, the problem of poor model performance in music review sentiment analysis is solved, and higher analysis accuracy is achieved.
Patent Information
- Application Number
- CN202110571946.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-25
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2041-05-25
AI Technical Summary
The existing technology has poor model performance in the sentiment analysis of music reviews, making it difficult to accurately identify online vocabulary and comparative sentence patterns, resulting in inaccurate sentiment analysis.
The training data is generated using preset sentence templates and emotional dictionary, and the embedding vector method is integrated into network vocabulary and comparative sentence patterns to improve the performance of the sentiment analysis model.
It improves the accuracy of sentiment analysis of music reviews, enables the model to more effectively identify network vocabulary and process comparative sentence patterns, and improves the overall performance of the sentiment analysis model.
Smart Images

Figure CN113505582B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a method, device and medium for analyzing sentiment of music reviews. Background Art
[0002] Text sentiment analysis refers to the use of natural language processing and other methods to identify and extract subjective information from text. Generally speaking, the purpose of sentiment analysis is to find out the speaker's attitude on certain topics or the two extremes (positive or negative) of a text. Music reviews are an important window for users to express their opinions and emotions. Using sentiment analysis technology, we can obtain users' positive and negative evaluations of song singers and use them as an important indicator of the quality of the evaluation object. The comments on music platforms are characterized by the presence of a large number of Internet terms in the text, complex sentence structures, and a large number of comparative (comparative sentences with more than one evaluation object).
[0003] At present, the lexical, syntactic and semantic complexity of texts in the application scenarios of sentiment analysis technology is relatively low. Simple classification using basic classification models such as BERT (Bidirectional Encoder Representations from Transformers), GRU (Gated Recurrent Unit), TextCNN (convolutional neural network model for text classification tasks) can achieve usable results. However, since the comments on the music platform have many network words and complex sentences, it is difficult to obtain good results using basic classification models. In summary, in the process of implementing this application, the inventors found that there are at least problems in the prior art that the model performance for music reviews is poor and the sentiment analysis of music reviews is inaccurate. Summary of the invention
[0004] In view of this, the purpose of this application is to provide a music review sentiment analysis method, device and medium, which can improve the performance of the sentiment analysis model, thereby improving the accuracy of music review sentiment analysis. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a method for analyzing sentiment of music reviews, comprising:
[0006] Acquire a training data set; wherein the training data set at least includes sentiment classification training data generated by using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network words and sentiment polarity information of the preset network words;
[0007] Generate a first embedding vector corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary;
[0008] Generate a second embedding vector corresponding to each sentiment classification training data based on the specified evaluation object information corresponding to each sentiment classification training data in the training data set;
[0009] Training a sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model;
[0010] When the music review to be analyzed is obtained, the trained sentiment analysis model is used to determine the sentiment polarity corresponding to the music review to be analyzed.
[0011] Optionally, the step of generating a first embedding vector corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary; and generating a second embedding vector corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set comprises:
[0012] Generate a first padding feature corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary; wherein the first padding feature is a feature vector represented by a first eigenvalue and / or a second eigenvalue and / or a third eigenvalue; wherein the first eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is positive, the second eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is negative, and the third eigenvalue indicates that the character at the corresponding position in the sentiment classification training data has no sentiment polarity or has a neutral sentiment polarity;
[0013] Map each of the first padding features to a corresponding first embedding vector;
[0014] Generate a second padding feature corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set; wherein the second padding feature is a feature vector represented by a fourth eigenvalue and / or a fifth eigenvalue, and the fourth eigenvalue indicates that the word to which the character at the corresponding position in the sentiment classification training data belongs is a designated object determined based on the designated evaluation object information, and the fifth eigenvalue indicates that the character at the corresponding position in the sentiment classification training data does not belong to the designated object;
[0015] Map each of the second padding features to a corresponding second embedding vector.
[0016] Optionally, the using the preset sentiment dictionary to generate a first padding feature corresponding to each sentiment classification training data in the training data set includes:
[0017] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, then the corresponding position of each character of the word in the first padding feature is directly represented by the first feature value;
[0018] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is negative, then the corresponding position of each character of the word in the first padding feature is directly represented by the second feature value;
[0019] If a word in each sentiment classification training data in the training data set cannot be found in the preset sentiment dictionary, the corresponding position of each character of the word in the first padding feature is represented by the third feature value.
[0020] Optionally, the using the preset sentiment dictionary to generate a first padding feature corresponding to each sentiment classification training data in the training data set includes:
[0021] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, a preset probability value is used to determine that the corresponding position of each character of the word in the first padding feature is represented by the first feature value or the third feature value;
[0022] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is negative, the preset probability value is used to determine that the corresponding position of each character of the word in the first padding feature is represented by the second feature value or the third feature value;
[0023] If a word in each sentiment classification training data in the training data set cannot be found in the preset sentiment dictionary, the corresponding position of each character of the word in the first padding feature is represented by the third feature value.
[0024] Optionally, the training the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain the trained sentiment analysis model includes:
[0025] Input each sentiment classification training data into the token embedding layer, segment embedding layer, and position embedding layer of the sentiment analysis model to obtain the token embedding vector, segment embedding vector, and position embedding vector corresponding to each sentiment classification training data;
[0026] The token embedding vector, the segment embedding vector, and the position embedding vector corresponding to each sentiment classification training data are fused to obtain a first fused vector corresponding to each sentiment classification training data;
[0027] Normalizing the first fused vector to obtain a normalized vector;
[0028] Fusing the normalized vector, the first embedding vector, and the second embedding vector to obtain a second fused vector;
[0029] The sentiment analysis model is trained based on the second fusion vector to obtain a trained sentiment analysis model.
[0030] Optionally, the training the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain the trained sentiment analysis model includes:
[0031] Training a sentiment analysis model based on the first embedding vector and the second embedding vector, and determining a corresponding target loss parameter during the training process;
[0032] When the target loss parameter converges, the current sentiment analysis model is determined as the trained sentiment analysis model.
[0033] Optionally, the training of the sentiment analysis model based on the first embedding vector and the second embedding vector, and determining a corresponding target loss parameter during the training process, includes:
[0034] The sentiment analysis model is trained based on the first embedding vector and the second embedding vector, and a loss parameter for measuring sentiment polarity classification loss is determined during the training process, and the loss parameter is determined as a target loss parameter.
[0035] Optionally, the training of the sentiment analysis model based on the first embedding vector and the second embedding vector, and determining a corresponding target loss parameter during the training process, includes:
[0036] Generate a third embedding vector corresponding to each song singer evaluation training data in the training data set by using the preset sentiment dictionary;
[0037] Generate a fourth embedding vector corresponding to each song singer evaluation class training data based on the designated evaluation object information corresponding to each song singer evaluation class training data in the training data set;
[0038] The sentiment analysis model is trained based on the first embedding vector, the second embedding vector, the third embedding vector, and the fourth embedding vector, and during the training process, a first loss parameter for measuring sentiment polarity classification loss is determined based on the first embedding vector and the second embedding vector, and a second loss parameter for measuring singer song evaluation classification loss is determined based on the third embedding vector and the fourth embedding vector;
[0039] A corresponding target loss parameter is determined based on the first loss parameter and the second loss parameter.
[0040] Optionally, determining a corresponding target loss parameter based on the first loss parameter and the second loss parameter includes:
[0041] The first loss parameter and the first preset weight coefficient corresponding to the first loss parameter, the second loss parameter and the second preset weight coefficient corresponding to the second loss parameter are used to perform weighted calculation to obtain the corresponding target loss parameter.
[0042] Optionally, determining a corresponding target loss parameter based on the first loss parameter and the second loss parameter includes:
[0043] The first loss parameter and the first weight coefficient corresponding to the first loss parameter, the second loss parameter and the second weight coefficient corresponding to the second loss parameter are used for weighted calculation to obtain the corresponding target loss parameter; wherein the first weight coefficient and the second weight coefficient are both weight coefficients obtained through training.
[0044] Optionally, the determining the sentiment polarity corresponding to the music review to be analyzed by using the trained sentiment analysis model includes:
[0045] The trained sentiment analysis model is used to determine the song singer evaluation category classification result and the sentiment polarity classification result of the music review to be analyzed. If the song singer evaluation category classification result is that the music review to be analyzed is a song singer evaluation category, then the sentiment polarity classification result is determined as the sentiment polarity corresponding to the music review to be analyzed.
[0046] In a second aspect, the present application discloses a music review sentiment analysis device, comprising:
[0047] A training data acquisition module, used to acquire a training data set; wherein the training data set at least includes sentiment classification training data generated by using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network words and sentiment polarity information of the preset network words;
[0048] A first embedding vector determination module, used to generate a first embedding vector corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary;
[0049] A second embedding vector determination module, configured to generate a second embedding vector corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set;
[0050] A sentiment analysis model training module, used to train the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model;
[0051] The comment sentiment polarity determination module is used to determine the sentiment polarity corresponding to the music review to be analyzed by using the trained sentiment analysis model when the music review to be analyzed is obtained.
[0052] In a third aspect, the present application discloses an electronic device, including a processor and a memory; wherein:
[0053] The memory is used to store the computer program;
[0054] The processor is used to execute the computer program to implement the aforementioned music review sentiment analysis method.
[0055] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned music review sentiment analysis method when executed by a processor.
[0056] It can be seen that the present application first obtains a training data set; wherein, the training data set at least includes sentiment classification training data generated by using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary, and then uses the preset sentiment dictionary to generate a first embedding vector corresponding to each sentiment classification training data in the training data set, and generates a second embedding vector corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set, and then trains the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model, and when a music review to be analyzed is obtained, the trained sentiment analysis model is used to determine the sentiment polarity corresponding to the music review to be analyzed. That is, the present application utilizes comparative sentence templates to generate sentiment classification training data, utilizes a preset sentiment dictionary to generate a first embedding vector of the sentiment classification training data, and generates a second embedding vector of the sentiment classification training data based on specified evaluation object information. In this way, the word embedding method is utilized to integrate preset network vocabulary, comparative sentence templates are utilized to generate sentiment classification training data for comparative sentences, and corresponding embedding vectors are generated by specifying evaluation object information, so that the trained sentiment analysis model has the ability to recognize network vocabulary and process comparative sentences, which can improve the performance of the sentiment analysis model and thus improve the accuracy of sentiment analysis of music reviews. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0058] Figure 1 A schematic diagram of the system framework applicable to the music review sentiment analysis solution provided in this application;
[0059] Figure 2 A flow chart of a music review sentiment analysis method provided for this application;
[0060] Figure 3 A specific music review sentiment analysis method flow chart provided for this application;
[0061] Figure 4 A feature fusion schematic diagram provided for this application;
[0062] Figure 5 A specific music review sentiment analysis method flow chart provided for this application;
[0063] Figure 6 A specific sentiment analysis model training flow chart provided for this application;
[0064] Figure 7 A schematic diagram of a specific sentiment analysis model structure provided for this application;
[0065] Figure 8 A schematic diagram of the structure of a music review sentiment analysis device provided in this application;
[0066] Fig. 9 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0067] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0068] At present, the lexical, syntactic and semantic complexity of texts in the application scenarios of sentiment analysis technology is relatively low. Simple classification using basic classification models such as BERT, GRU, TextCNN, etc. can achieve usable results. However, since the comments under the music platform have many network words and complex sentences, it is difficult to obtain good results using basic classification models. In summary, in the process of realizing this application, the inventors found that there are at least problems in the prior art that the model performance for music reviews is poor and the sentiment analysis of music reviews is inaccurate. To this end, the present application provides a music review sentiment analysis solution that can improve the performance of the sentiment analysis model, thereby improving the accuracy of the sentiment analysis of music reviews.
[0069] The system framework diagram used in the music review sentiment analysis solution of this application can be found in Figure 1 As shown, it may specifically include: a backend server and a number of user terminals that establish communication connections with the backend server. The user terminals include but are not limited to tablet computers, laptop computers, smart phones, and personal computers (PCs), which are not limited here.
[0070] In the present application, the steps performed by the backend server include obtaining a training data set; wherein the training data set at least includes sentiment classification training data generated by using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary; using the preset sentiment dictionary to generate a first embedding vector corresponding to each sentiment classification training data in the training data set; based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set, generating a second embedding vector corresponding to each sentiment classification training data; training a sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model; when a music review to be analyzed is obtained, using the trained sentiment analysis model to determine the sentiment polarity corresponding to the music review to be analyzed.
[0071] Among them, the user end is used to obtain the music comments input by the user and transmit them to the background server as the music comments to be analyzed, so that when the background server obtains the music comments to be analyzed, it uses the trained sentiment analysis model to determine the sentiment polarity corresponding to the music comments to be analyzed.
[0072] See also Figure 2 As shown, the embodiment of the present application discloses a method for analyzing the sentiment of music reviews, including:
[0073] Step S101: Acquire a training data set; wherein the training data set at least includes sentiment classification training data generated using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary.
[0074] In a specific implementation, the training data set may include sentiment classification training data generated using a preset sentence template and a preset sentiment dictionary and manually annotated sentiment classification training data, wherein the manually annotated sentiment classification training data includes sentiment classification training data with a neutral sentiment polarity.
[0075] Furthermore, to enrich the sentence patterns, the sentence pattern templates include but are not limited to comparative sentence pattern templates. In addition, the preset sentiment dictionary includes but is not limited to pre-collected network words, and also includes some common words expressing sentiment polarity, such as "bad", etc.
[0076] Among them, the comparative sentence template can be composed of natural language text and custom labels, such as "[Target1] sings better than [Target2] [Positive] Label = {Target1: Positive, Target2: Negative}", [Target*] is the evaluation object, [Positive] is a positive sentiment word, and Label represents the classification result, that is, a custom label. For Target1, this comment is positive, while for Target2, it is a negative evaluation. [Target*] and [Positive] can be arranged and combined through the preset sentiment dictionary to obtain multiple sentiment classification training data. For example, sentiment classification training data: [Singer A] sings better than [Singer B] [Catchy].
[0077] In addition, since the data diversity generated by the template is not high enough, LAMBDADA (language-model-based data augmentation) technology can be used to generate training data to improve the grammatical diversity of the training data. LAMBDADA technology is a GPT (Generative Pre-Training) generation technology.
[0078] Step S102: Generate a first embedding vector corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary.
[0079] Step S103: generating a second embedding vector corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set.
[0080] In a specific implementation, the preset sentiment dictionary can be used to generate a first padding feature corresponding to each sentiment classification training data in the training data set; wherein the first padding feature is a feature vector represented by a first eigenvalue and / or a second eigenvalue and / or a third eigenvalue; wherein the first eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is positive, the second eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is negative, and the third eigenvalue indicates that the character at the corresponding position in the sentiment classification training data has no sentiment polarity or has a neutral sentiment polarity; each of the first padding features is generated by the preset sentiment dictionary; wherein the first padding feature is a eigenvalue represented by a first eigenvalue and / or a second eigenvalue and / or a third eigenvalue; wherein the first eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is positive, the second eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is negative, and the third eigenvalue indicates that the character at the corresponding position in the sentiment classification training data has no sentiment polarity or has a neutral sentiment polarity. The feature map is a corresponding first embedding vector; based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set, a second padding feature corresponding to each sentiment classification training data is generated; wherein the second padding feature is a feature vector represented by a fourth eigenvalue and / or a fifth eigenvalue, and the fourth eigenvalue indicates that the word to which the character at the corresponding position in the sentiment classification training data belongs is a designated object determined based on the designated evaluation object information, and the fifth eigenvalue indicates that the character at the corresponding position in the sentiment classification training data does not belong to the designated object; each of the second padding features is mapped to a corresponding second embedding vector.
[0081] In a specific implementation, the using the preset sentiment dictionary to generate the first padding feature corresponding to each sentiment classification training data in the training data set specifically includes:
[0082] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, then the first feature value is directly used to represent the corresponding position of each character of the word in the first padding feature; if a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is negative, then the second feature value is directly used to represent the corresponding position of each character of the word in the first padding feature; if the word in each sentiment classification training data in the training data set is not found in the preset sentiment dictionary, then the third feature value is used to represent the corresponding position of each character of the word in the first padding feature.
[0083] In another specific implementation, the using the preset sentiment dictionary to generate the first padding feature corresponding to each sentiment classification training data in the training data set specifically includes:
[0084] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, a preset probability value is used to determine that the corresponding position of each character of the word in the first padding feature is represented by the first feature value or the third feature value; if a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is negative, a preset probability value is used to determine that the corresponding position of each character of the word in the first padding feature is represented by the second feature value or the third feature value; if a word in each sentiment classification training data in the training data set is not found in the preset sentiment dictionary, the corresponding position of each character of the word in the first padding feature is represented by the third feature value.
[0085] For example, the preset probability value is 80%. If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, then the probability of each character of the word using the first feature value at the corresponding position in the first padding feature is 80%, and the probability of using the third feature value is 20%.
[0086] It should be pointed out that by adjusting the proportion of word embedding features corresponding to the dictionary through preset probability values, the model can make better use of user dictionary information while not being overly dependent on the dictionary, and has the ability to extract general sentiment word features.
[0087] For example, for a comment "Singer A sings very catchy, singer B sings badly", if the specified object is singer A, "catchy" and "bad" are both in the preset sentiment dictionary, the first padding feature of the comment is "000000110000022", and the second padding feature is "111000000000000". They are then mapped to the corresponding embeddings, namely the first embedding vector and the second embedding vector.
[0088] In addition, if the sentiment classification training data does not specify an object, the values in the corresponding second padding feature are all the fifth feature values, such as 0.
[0089] Step S104: training the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model.
[0090] In a specific implementation, the sentiment analysis model can be trained based on the first embedding vector and the second embedding vector, and a corresponding target loss parameter can be determined during the training process; when the target loss parameter converges, the current sentiment analysis model is determined as a trained sentiment analysis model.
[0091] Specifically, the sentiment analysis model can be trained based on the first embedding vector and the second embedding vector, and a loss parameter for measuring sentiment polarity classification loss is determined during the training process, and the loss parameter is determined as the target loss parameter.
[0092] Step S105: when the music review to be analyzed is obtained, the trained sentiment analysis model is used to determine the sentiment polarity corresponding to the music review to be analyzed.
[0093] It can be seen that the embodiment of the present application first obtains a training data set; wherein, the training data set at least includes sentiment classification training data generated by using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary, and then uses the preset sentiment dictionary to generate a first embedding vector corresponding to each sentiment classification training data in the training data set, and generates a second embedding vector corresponding to each sentiment classification training data based on the specified evaluation object information corresponding to each sentiment classification training data in the training data set, and then trains the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model, and when a music review to be analyzed is obtained, the trained sentiment analysis model is used to determine the sentiment polarity corresponding to the music review to be analyzed. That is, the present application utilizes comparative sentence templates to generate sentiment classification training data, utilizes a preset sentiment dictionary to generate a first embedding vector of the sentiment classification training data, and generates a second embedding vector of the sentiment classification training data based on specified evaluation object information. In this way, the word embedding method is utilized to integrate preset network vocabulary, comparative sentence templates are utilized to generate sentiment classification training data for comparative sentences, and corresponding embedding vectors are generated by specifying evaluation object information, so that the trained sentiment analysis model has the ability to recognize network vocabulary and process comparative sentences, which can improve the performance of the sentiment analysis model and thus improve the accuracy of sentiment analysis of music reviews.
[0094] See also Figure 3 As shown, the embodiment of the present application discloses a specific music review sentiment analysis method, including:
[0095] Step S201: Acquire a training data set; wherein the training data set at least includes sentiment classification training data generated using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary.
[0096] Step S202: using the preset sentiment dictionary to generate a first padding feature corresponding to each sentiment classification training data in the training data set.
[0097] Wherein, the first padding feature is a feature vector represented by the first eigenvalue and / or the second eigenvalue and / or the third eigenvalue; wherein, the first eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is positive, the second eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is negative, and the third eigenvalue indicates that the character at the corresponding position in the sentiment classification training data has no sentiment polarity or has a neutral sentiment polarity;
[0098] Step S203: Map each of the first padding features into a corresponding first embedding vector.
[0099] Step S204: generating a second padding feature corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set;
[0100] The second padding feature is a feature vector represented by the fourth feature value and / or the fifth feature value, and the fourth feature value indicates that the word to which the character at the corresponding position in the sentiment classification training data belongs is a designated object determined based on the designated evaluation object information, and the fifth feature value indicates that the character at the corresponding position in the sentiment classification training data does not belong to the designated object;
[0101] Step S205: Map each of the second padding features into a corresponding second embedding vector.
[0102] Step S206: input each sentiment classification training data into the token embedding layer, segment embedding layer, and position embedding layer of the sentiment analysis model to obtain a token embedding vector, a segment embedding vector, and a position embedding vector corresponding to each sentiment classification training data.
[0103] Among them, token in Chinese NLP (Natural Language Processing) is a word, segment is a sentence segment, and position is the position of a token in a sentence.
[0104] Step S207: Fusing the token embedding vector, the segment embedding vector, and the position embedding vector corresponding to each sentiment classification training data to obtain a first fused vector corresponding to each sentiment classification training data.
[0105] Step S208: Normalize the first fused vector to obtain a normalized vector.
[0106] Step S209: Fusing the normalized vector, the first embedding vector, and the second embedding vector to obtain a second fused vector.
[0107] Step S210: using the second fusion vector to train the sentiment analysis model to obtain a trained sentiment analysis model.
[0108] Step S211: when the music review to be analyzed is obtained, the trained sentiment analysis model is used to determine the sentiment polarity corresponding to the music review to be analyzed.
[0109] For example, see Figure 4 As shown, Figure 4 A feature fusion schematic diagram disclosed in an embodiment of the present application. Sentiment classification training data is input into the token embedding layer, segment embedding layer, and position embedding layer of the sentiment analysis model to obtain the token embedding vector, segment embedding vector, and position embedding vector of the sentiment classification training data, the token embedding vector, segment embedding vector, and position embedding vector are fused to obtain a first fused vector, the first fused vector is input into the normalization layer to obtain a normalized vector, the first padding feature is input into the dictionary embedding layer to obtain a first embedding vector, and the second padding feature is input into the object embedding layer to obtain a second embedding vector, wherein the dictionary embedding layer is a preset embedding layer for mapping each first padding feature to a corresponding first embedding vector, and the object embedding layer is a preset embedding layer for mapping each second padding feature to a corresponding second embedding vector, and then the normalized vector corresponding to each sentiment classification training data, the first embedding vector, and the second embedding vector are fused to obtain the second fused vector corresponding to each sentiment classification training data.
[0110] It should be pointed out that, through experiments, it is found that the fusion process between the first embedding vector, the second embedding vector and the embedding vector output by the token embedding layer, the segment embedding layer and the position embedding layer of BERT is best achieved after the embedding vector output by the token embedding layer, the segment embedding layer and the position embedding layer is normalized. Normalization can be used.
[0111] See also Figure 5 As shown, the embodiment of the present application discloses a specific music review sentiment analysis method, including:
[0112] Step S301: Acquire a training data set; wherein the training data set at least includes sentiment classification training data generated using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary.
[0113] Step S302: Generate a first embedding vector corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary.
[0114] Step S303: generating a second embedding vector corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set.
[0115] Step S304: using the preset sentiment dictionary to generate a third embedding vector corresponding to each song singer evaluation training data in the training data set.
[0116] Step S305: Generate a fourth embedding vector corresponding to each song singer evaluation type training data based on the designated evaluation object information corresponding to each song singer evaluation type training data in the training data set.
[0117] For the specific generation process of the third embedding vector and the fourth embedding vector, reference may be made to the generation process of the first embedding vector and the second embedding vector disclosed in the aforementioned embodiment.
[0118] Step S306: The sentiment analysis model is trained based on the first embedding vector, the second embedding vector, the third embedding vector, and the fourth embedding vector, and during the training process, a first loss parameter for measuring the sentiment polarity classification loss is determined based on the first embedding vector and the second embedding vector, and a second loss parameter for measuring the singer song evaluation classification loss is determined based on the third embedding vector and the fourth embedding vector.
[0119] Step S307: Determine a corresponding target loss parameter based on the first loss parameter and the second loss parameter.
[0120] In a specific implementation, the first loss parameter and the first preset weight coefficient corresponding to the first loss parameter, the second loss parameter and the second preset weight coefficient corresponding to the second loss parameter can be used to perform weighted calculation to obtain the corresponding target loss parameter.
[0121] That is, the weight coefficients of the first loss parameter and the second loss parameter may be preset.
[0122] In another specific implementation, the first loss parameter and the first weight coefficient corresponding to the first loss parameter, the second loss parameter and the second weight coefficient corresponding to the second loss parameter can be used to perform weighted calculation to obtain the corresponding target loss parameter; wherein the first weight coefficient and the second weight coefficient are both weight coefficients obtained through training.
[0123] That is, the weight coefficient is a learnable parameter. Specifically, the loss function for calculating the first loss parameter and the second loss parameter and the gradient calculation process can be optimized by using methods such as Uncertainty (i.e. homoscedastic uncertainty) and PC-gradient (i.e. projecting conflicting gradients) so that the target loss parameter converges to the optimal point.
[0124] Step S308: When the target loss parameter converges, the current sentiment analysis model is determined as a trained sentiment analysis model.
[0125] That is, the embodiment of the present application can use the song singer evaluation training data and sentiment classification training data in the training data set to train the sentiment analysis model, so that the trained sentiment analysis model has the ability to screen the song singer evaluation and sentiment classification. In this way, since there is a correlation between the song singer evaluation screening and sentiment classification, both need to be judged based on the sentiment words in the sentence, so the model can provide a common feature extraction capability, and training together is equivalent to indirect data enhancement, which can improve the model performance.
[0126] In a specific implementation, a multi-task training method can be adopted, including song singer evaluation screening training tasks and sentiment classification training tasks. Through hierarchical sharing, the two tasks only require one encoding process, which greatly improves the model training efficiency compared to the separate training of the existing technology.
[0127] In a specific implementation, the sentiment analysis model can be multi-task trained based on the first embedding vector, the second embedding vector, the third embedding vector, and the fourth embedding vector, and during the training process, a first loss parameter for measuring the sentiment polarity classification loss corresponding to the sentiment classification training task is determined based on the first embedding vector and the second embedding vector, and a second loss parameter for measuring the singer song evaluation classification loss corresponding to the song singer evaluation screening training task is determined based on the third embedding vector and the fourth embedding vector.
[0128] For example, see Figure 6 As shown, Figure 6 A specific sentiment analysis model training flow chart provided for this application. The training data set includes singer song evaluation training data and sentiment classification training data, wherein the singer song evaluation training data are all manually annotated training data, such as obtaining 5,000 singer song evaluation training data, and the sentiment polarity classification data may include sentiment classification training data generated using a preset sentence template and a preset sentiment dictionary, and manually annotated sentiment classification training data. Figure 6 The sentiment classification basic training data in is the manually annotated sentiment classification training data. The first embedding vector and the second embedding vector corresponding to the sentiment classification data are constructed using the preset sentiment dictionary and the specified object information, and the third embedding vector and the fourth embedding vector corresponding to the singer song evaluation training data are constructed. The multi-task shared BERT encoder layer is used to determine the second loss parameter corresponding to the song singer evaluation screening training task and the first loss parameter corresponding to the sentiment classification training task, and then the multi-task loss, i.e., the target loss parameter, is obtained.
[0129] For example, see Figure 7 As shown, Figure 7A schematic diagram of a specific sentiment analysis model structure disclosed in an embodiment of the present application. Each training data in the training data set is input into the token embedding layer, segment embedding layer, and position embedding layer of the sentiment analysis model to obtain the token embedding vector, segment embedding vector, and position embedding vector of the training data; the token embedding vector, segment embedding vector, and position embedding vector are fused to obtain a first fused vector; the first fused vector is input into the normalization layer to obtain a normalized vector; the first padding feature corresponding to each sentiment classification training data is input into the dictionary embedding layer to obtain a first embedding vector; the second padding feature is input into the object embedding layer to obtain a second embedding vector; and the third padding feature corresponding to each song singer evaluation training data is input into the dictionary embedding layer to obtain a third embedding vector; the fourth padding feature is input into the object embedding layer to obtain a fourth embedding vector, wherein the third padding feature is obtained by using the pre Assume that the padding feature corresponding to the song singer evaluation training data generated by the sentiment dictionary, the fourth padding feature is the padding feature generated using each song singer evaluation training data and the designated evaluation object information corresponding to the song singer evaluation training data, then the normalized vector corresponding to each sentiment classification training data, the first embedding vector, and the second embedding vector are fused to obtain the second fused vector corresponding to each sentiment classification training data, the normalized vector, the third embedding vector, and the fourth embedding vector corresponding to each song singer evaluation training data are fused to obtain the second fused vector corresponding to each song singer evaluation training data, and input into the BERT layer for encoding, and the outputs corresponding to BERT layer 2, BERT layer 7, and BERT layer 12 are selected for subsequent processing. It should be pointed out that not every layer of information is useful. After experiments, the output information of BERT layer 2, BERT layer 7, and BERT layer 12 is the best. The CLS embedding vectors and object embedding vectors output by BERT layer 2, BERT layer 7, and BERT layer 12 enter the sentiment classification gating layer, and the CLS embedding vectors enter the evaluation class screening gating layer, where the CLS embedding vector is the output embedding vector corresponding to the CLS (beginning of the sentence) token, and the object embedding vector is the embedding representation after the average pooling of the output embedding vectors corresponding to the words of the specified object. The sentiment classification gating layer and the evaluation class screening gating layer are the gating layers corresponding to the sentiment classification training task and the song singer evaluation class screening training task, respectively, which are used to control how much information of the specified BERT layer will flow into the final sentence representation. The gating layer formula is as follows:
[0130] r t =σ(W r x t +U rh t-1 +b r )
[0131] z t =σ(W z x t +U z h t-1 +b z )
[0132] h' t =tanh(W h x t +U h (r t ⊙h t-1 )+b h )
[0133] h t =z t ⊙h t-1 +(1-z t )h t '
[0134] Among them, x t h represents the embedding vector of the output of the current BERT layer (the sentiment classification training task includes the CLS embedding vector and the object embedding vector, and the song singer evaluation screening training task is the CLS embedding vector); t is the embedding vector after filtering by the gating layer, which is used as the sentence vector representation of a specific task in the last layer; σ represents the sigmoid activation function, and ⊙ represents the bitwise multiplication operation. The parameters W, U, and b corresponding to different tasks are different. For the specific implementation of the gating layer, please refer to the existing technology and will not be described here.
[0135] In a specific implementation, the multi-task loss corresponding to the sentiment classification task and the song singer evaluation screening task, that is, the target loss parameter, can be calculated using a weighted cross entropy loss function, and the weights of the two tasks are both 0.5, and the formula is defined as follows:
[0136] Multi Task Loss = 0.5*Cross Entropy (song singer evaluation screening) + 0.5*Cross Entropy (emotion polarity classification)
[0137] Step S309: when the music review to be analyzed is obtained, the trained sentiment analysis model is used to determine the sentiment polarity corresponding to the music review to be analyzed.
[0138] In a specific implementation, the trained sentiment analysis model can be used to determine the song singer evaluation category classification result and the sentiment polarity classification result of the music review to be analyzed. If the song singer evaluation category classification result is that the music review to be analyzed is a song singer evaluation category, then the sentiment polarity classification result is determined as the sentiment polarity corresponding to the music review to be analyzed.
[0139] It should be pointed out that music review texts contain a wide variety of subject categories, such as song evaluation, fan support, emotional catharsis, etc., and ultimately for recommendation, search and other scenarios, it is necessary to filter out song and singer evaluation reviews to obtain the corresponding emotional polarity. It is understandable that the embodiment of the present application also solves the problem of difficulty in classifying emotional polarity due to the large variety of topics in music reviews.
[0140] See Table 1, which is a comparison table of prediction results of various classification schemes.
[0141] Table 1
[0142] plan Screening accuracy of song and singer evaluation Sentiment classification accuracy Original BERT classification 0.943 0.891 This application is not multi-task training 0.943 0.925 Multi-task training in this application 0.940 0.939
[0143] During the experiment, the test set including 1000 data was respectively input into the trained song singer evaluation screening model and the trained sentiment analysis model obtained based on the original BERT classification scheme, the trained song singer evaluation screening model and the trained sentiment analysis model respectively trained based on the non-multi-task training scheme of the present application (that is, the corresponding first embedding vector and the second embedding vector were constructed using the sentiment classification training data, and the sentiment analysis model was trained to obtain the trained sentiment analysis model, and the third embedding vector and the fourth embedding vector corresponding to the singer song evaluation training data were used to train the song singer evaluation screening model to obtain the trained song singer evaluation screening model, and the two models were trained separately), and the trained sentiment analysis model obtained by the multi-task training scheme of the present application, and the prediction results of each model were obtained, and the song singer evaluation screening accuracy and sentiment classification accuracy corresponding to each scheme were calculated, wherein the calculation formula is as follows:
[0144] Screening accuracy of song singer evaluation category = (the amount of data judged by the model as evaluation category and the actual label is evaluation category + the amount of data judged by the model as non-evaluation category and the actual label is non-evaluation category) / number of test sets;
[0145] Sentiment classification accuracy = (the amount of data that the model judges as positive and the actual label is positive + the amount of data that the model judges as negative and the actual label is negative + the amount of data that the model judges as neutral and the actual label is neutral) / number of test sets.
[0146] It can be seen that although the accuracy of song singer evaluation screening has slightly decreased, there is a significant improvement in sentiment classification. The use of a multi-task framework can greatly reduce the model running time and improve prediction efficiency.
[0147] Below, taking a certain music APP as an example, the technical solution of this application is explained.
[0148] A large amount of user comment data is obtained from the background storage of this music APP, and then the song singer evaluation data is screened for manual labeling, and the sentiment classification data is screened for manual labeling, to obtain song singer evaluation training data and sentiment classification training data, which are transmitted to the background server of this music APP. The background server generates sentiment classification training data using preset sentence templates and preset sentiment dictionary, wherein the preset sentence templates include comparative sentence templates, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary, thereby obtaining a training data set. Then, the preset emotional dictionary is used to generate a first embedding vector corresponding to each emotional classification training data in the training data set; based on the specified evaluation object information corresponding to each emotional classification training data in the training data set, a second embedding vector corresponding to each emotional classification training data is generated; the preset emotional dictionary is used to generate a third embedding vector corresponding to each song singer evaluation training data in the training data set; based on the specified evaluation object information corresponding to each song singer evaluation training data in the training data set, a fourth embedding vector corresponding to each song singer evaluation training data is generated; the emotional analysis model is trained based on the first embedding vector, the second embedding vector, the third embedding vector, and the fourth embedding vector; during the training process, a first loss parameter for measuring the emotional polarity classification loss is determined based on the first embedding vector and the second embedding vector, and a second loss parameter for measuring the singer song evaluation classification loss is determined based on the third embedding vector and the fourth embedding vector; a corresponding target loss parameter is determined based on the first loss parameter and the second loss parameter, and when the target loss parameter converges, the current emotional analysis model is determined as the trained emotional analysis model.
[0149] After obtaining the trained sentiment analysis model, the user terminal obtains the music comments input by the user and transmits them to the backend server as the music comments to be analyzed. When the backend server obtains the music comments to be analyzed, it uses the trained sentiment analysis model to determine the sentiment polarity corresponding to the music comments to be analyzed. And based on the sentiment polarity of the music comments of the singers or songs, the singers and songs are sorted, and the top-ranked playlists are recommended to the user terminal, or based on the sentiment polarity of the user's music comments, personalized playlists are recommended to the user terminal.
[0150] See also Figure 8As shown, the embodiment of the present application discloses a music review sentiment analysis device, comprising:
[0151] The training data set acquisition module 11 is used to acquire a training data set; wherein the training data set at least includes sentiment classification training data generated by using a preset sentence template and a preset sentiment dictionary, wherein the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network words and sentiment polarity information of the preset network words;
[0152] A first embedding vector determination module 12, configured to generate a first embedding vector corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary;
[0153] A second embedding vector determination module 13, configured to generate a second embedding vector corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set;
[0154] A sentiment analysis model training module 14 is used to train the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model;
[0155] The comment sentiment polarity determination module 15 is used to determine the sentiment polarity corresponding to the music review to be analyzed by using the trained sentiment analysis model when the music review to be analyzed is obtained.
[0156] It can be seen that the embodiment of the present application first obtains a training data set; wherein, the training data set at least includes sentiment classification training data generated by using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary, and then uses the preset sentiment dictionary to generate a first embedding vector corresponding to each sentiment classification training data in the training data set, and generates a second embedding vector corresponding to each sentiment classification training data based on the specified evaluation object information corresponding to each sentiment classification training data in the training data set, and then trains the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model, and when a music review to be analyzed is obtained, the trained sentiment analysis model is used to determine the sentiment polarity corresponding to the music review to be analyzed. That is, the present application utilizes comparative sentence templates to generate sentiment classification training data, utilizes a preset sentiment dictionary to generate a first embedding vector of the sentiment classification training data, and generates a second embedding vector of the sentiment classification training data based on specified evaluation object information. In this way, the word embedding method is utilized to integrate preset network vocabulary, comparative sentence templates are utilized to generate sentiment classification training data for comparative sentences, and corresponding embedding vectors are generated by specifying evaluation object information, so that the trained sentiment analysis model has the ability to recognize network vocabulary and process comparative sentences, which can improve the performance of the sentiment analysis model and thus improve the accuracy of sentiment analysis of music reviews.
[0157] The first embedding vector determination module 12 specifically includes:
[0158] A first padding feature generation submodule, used to generate a first padding feature corresponding to each sentiment classification training data in the training data set using the preset sentiment dictionary; wherein the first padding feature is a feature vector represented by a first eigenvalue and / or a second eigenvalue and / or a third eigenvalue; wherein the first eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is positive, the second eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is negative, and the third eigenvalue indicates that the character at the corresponding position in the sentiment classification training data has no sentiment polarity or has a neutral sentiment polarity;
[0159] The first embedding vector mapping submodule is used to map each of the first padding features into a corresponding first embedding vector.
[0160] The second embedding vector determination module 13 specifically includes:
[0161] A second padding feature generation submodule is used to generate a second padding feature corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set; wherein the second padding feature is a feature vector represented by a fourth eigenvalue and / or a fifth eigenvalue, and the fourth eigenvalue indicates that the word to which the character at the corresponding position in the sentiment classification training data belongs is a designated object determined based on the designated evaluation object information, and the fifth eigenvalue indicates that the character at the corresponding position in the sentiment classification training data does not belong to the designated object;
[0162] The second embedding vector mapping submodule is used to map each of the second padding features into a corresponding second embedding vector.
[0163] In a specific implementation, the first padding feature generation submodule is specifically used to:
[0164] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, then the corresponding position of each character of the word in the first padding feature is directly represented by the first feature value;
[0165] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is negative, then the corresponding position of each character of the word in the first padding feature is directly represented by the second feature value;
[0166] If a word in each sentiment classification training data in the training data set cannot be found in the preset sentiment dictionary, the corresponding position of each character of the word in the first padding feature is represented by the third feature value.
[0167] In another specific implementation, the first padding feature generation submodule is specifically used to:
[0168] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, a preset probability value is used to determine that the corresponding position of each character of the word in the first padding feature is represented by the first feature value or the third feature value;
[0169] If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is negative, the preset probability value is used to determine that the corresponding position of each character of the word in the first padding feature is represented by the second feature value or the third feature value;
[0170] If a word in each sentiment classification training data in the training data set cannot be found in the preset sentiment dictionary, the corresponding position of each character of the word in the first padding feature is represented by the third feature value.
[0171] The sentiment analysis model training module 14 is specifically used for:
[0172] Input each sentiment classification training data into the token embedding layer, segment embedding layer, and position embedding layer of the sentiment analysis model to obtain the token embedding vector, segment embedding vector, and position embedding vector corresponding to each sentiment classification training data;
[0173] The token embedding vector, the segment embedding vector, and the position embedding vector corresponding to each sentiment classification training data are fused to obtain a first fused vector corresponding to each sentiment classification training data;
[0174] Normalizing the first fused vector to obtain a normalized vector;
[0175] Fusing the normalized vector, the first embedding vector, and the second embedding vector to obtain a second fused vector;
[0176] The sentiment analysis model is trained based on the second fusion vector to obtain a trained sentiment analysis model.
[0177] The sentiment analysis model training module 14 specifically includes:
[0178] A target loss parameter determination submodule, used to train the sentiment analysis model based on the first embedding vector and the second embedding vector, and determine the corresponding target loss parameter during the training process;
[0179] The post-training sentiment analysis model determination module is used to determine the current sentiment analysis model as the post-training sentiment analysis model when the target loss parameter converges.
[0180] In a specific implementation, the target loss parameter determination submodule is used to train the sentiment analysis model based on the first embedding vector and the second embedding vector, and determine a loss parameter for measuring the sentiment polarity classification loss during the training process, and determine the loss parameter as the target loss parameter.
[0181] In a specific embodiment, the target loss parameter determination submodule is used to: generate a third embedding vector corresponding to each song singer evaluation training data in the training data set using the preset sentiment dictionary; generate a fourth embedding vector corresponding to each song singer evaluation training data based on the specified evaluation object information corresponding to each song singer evaluation training data in the training data set; train the sentiment analysis model based on the first embedding vector, the second embedding vector, the third embedding vector, and the fourth embedding vector, and determine a first loss parameter for measuring the sentiment polarity classification loss based on the first embedding vector and the second embedding vector during the training process, and determine a second loss parameter for measuring the singer song evaluation classification loss based on the third embedding vector and the fourth embedding vector; determine the corresponding target loss parameter based on the first loss parameter and the second loss parameter.
[0182] In some embodiments, the target loss parameter determination submodule is used to perform weighted calculation using the first loss parameter and the first preset weight coefficient corresponding to the first loss parameter, the second loss parameter and the second preset weight coefficient corresponding to the second loss parameter to obtain the corresponding target loss parameter.
[0183] In some embodiments, the target loss parameter determination submodule is used to perform weighted calculation using the first loss parameter and the first weight coefficient corresponding to the first loss parameter, the second loss parameter and the second weight coefficient corresponding to the second loss parameter to obtain the corresponding target loss parameter; wherein the first weight coefficient and the second weight coefficient are both weight coefficients obtained through training.
[0184] The comment sentiment polarity determination module 15 is used to use the trained sentiment analysis model to determine the song singer evaluation category classification result and the sentiment polarity classification result of the music review to be analyzed. If the song singer evaluation category classification result is that the music review to be analyzed is a song singer evaluation category, then the sentiment polarity classification result is determined as the sentiment polarity corresponding to the music review to be analyzed.
[0185] Furthermore, an embodiment of the present application also provides an electronic device. Fig. 9 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0186] Fig. 9A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the music review sentiment analysis method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be a server.
[0187] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0188] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, and training data 223, etc. The storage method can be temporary storage or permanent storage.
[0189] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, so as to realize the operation and processing of the training data 223 in the memory 22 by the processor 21, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the music review sentiment analysis method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0190] Furthermore, an embodiment of the present application also discloses a storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the music review sentiment analysis method disclosed in any of the aforementioned embodiments are implemented.
[0191] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0192] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0193] The above is a detailed introduction to a music review sentiment analysis method, device and medium provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for sentiment analysis of music reviews, It is characterized in that include: Acquire a training data set; wherein the training data set at least includes sentiment classification training data generated using a preset sentence template and a preset sentiment dictionary, the preset sentence template includes a comparative sentence template, and the preset sentiment dictionary includes preset network vocabulary and sentiment polarity information of the preset network vocabulary; Generate a first embedding vector corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary; Generate a second embedding vector corresponding to each sentiment classification training data based on the specified evaluation object information corresponding to each sentiment classification training data in the training data set; Training a sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model; When the music review to be analyzed is obtained, the sentiment polarity corresponding to the music review to be analyzed is determined using the trained sentiment analysis model; The step of training the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain the trained sentiment analysis model includes: Input each sentiment classification training data into the token embedding layer, segment embedding layer, and position embedding layer of the sentiment analysis model to obtain the token embedding vector, segment embedding vector, and position embedding vector corresponding to each sentiment classification training data; The token embedding vector, the segment embedding vector, and the position embedding vector corresponding to each sentiment classification training data are fused to obtain a first fused vector corresponding to each sentiment classification training data; Normalizing the first fused vector to obtain a normalized vector; Fusing the normalized vector, the first embedding vector, and the second embedding vector to obtain a second fused vector; The sentiment analysis model is trained based on the second fusion vector to obtain a trained sentiment analysis model.
2. The music review sentiment analysis method according to claim 1, It is characterized in that The first embedding vector corresponding to each sentiment classification training data in the training data set is generated by using the preset sentiment dictionary; Generating a second embedding vector corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set includes: Generate a first padding feature corresponding to each sentiment classification training data in the training data set by using the preset sentiment dictionary; wherein the first padding feature is a feature vector represented by a first eigenvalue and / or a second eigenvalue and / or a third eigenvalue; wherein the first eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is positive, the second eigenvalue indicates that the sentiment polarity of the character at the corresponding position in the sentiment classification training data is negative, and the third eigenvalue indicates that the character at the corresponding position in the sentiment classification training data has no sentiment polarity or has a neutral sentiment polarity; Map each of the first padding features to a corresponding first embedding vector; Generate a second padding feature corresponding to each sentiment classification training data based on the designated evaluation object information corresponding to each sentiment classification training data in the training data set; wherein the second padding feature is a feature vector represented by a fourth eigenvalue and / or a fifth eigenvalue, and the fourth eigenvalue indicates that the word to which the character at the corresponding position in the sentiment classification training data belongs is a designated object determined based on the designated evaluation object information, and the fifth eigenvalue indicates that the character at the corresponding position in the sentiment classification training data does not belong to the designated object; Map each of the second padding features to a corresponding second embedding vector.
3. The music review sentiment analysis method according to claim 2, It is characterized in that The step of using the preset sentiment dictionary to generate a first padding feature corresponding to each sentiment classification training data in the training data set includes: If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, then the corresponding position of each character of the word in the first padding feature is directly represented by the first feature value; If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is negative, then the corresponding position of each character of the word in the first padding feature is directly represented by the second feature value; If a word in each sentiment classification training data in the training data set cannot be found in the preset sentiment dictionary, the corresponding position of each character of the word in the first padding feature is represented by the third feature value.
4. The music review sentiment analysis method according to claim 2, It is characterized in that The step of using the preset sentiment dictionary to generate a first padding feature corresponding to each sentiment classification training data in the training data set includes: If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is positive, a preset probability value is used to determine that the corresponding position of each character of the word in the first padding feature is represented by the first feature value or the third feature value; If a word in each sentiment classification training data in the training data set is found in the preset sentiment dictionary, and the sentiment polarity of the word is negative, the preset probability value is used to determine that the corresponding position of each character of the word in the first padding feature is represented by the second feature value or the third feature value; If a word in each sentiment classification training data in the training data set cannot be found in the preset sentiment dictionary, the corresponding position of each character of the word in the first padding feature is represented by the third feature value.
5. The method for analyzing music review sentiment according to any one of claims 1 to 4, It is characterized in that The step of training the sentiment analysis model based on the first embedding vector and the second embedding vector to obtain a trained sentiment analysis model includes: Training a sentiment analysis model based on the first embedding vector and the second embedding vector, and determining a corresponding target loss parameter during the training process; When the target loss parameter converges, the current sentiment analysis model is determined as the trained sentiment analysis model.
6. The music review sentiment analysis method according to claim 5, It is characterized in that The step of training the sentiment analysis model based on the first embedding vector and the second embedding vector, and determining a corresponding target loss parameter during the training process, includes: The sentiment analysis model is trained based on the first embedding vector and the second embedding vector, and a loss parameter for measuring sentiment polarity classification loss is determined during the training process, and the loss parameter is determined as a target loss parameter.
7. According to the music review sentiment analysis method of claim 5, It is characterized in that The step of training the sentiment analysis model based on the first embedding vector and the second embedding vector, and determining a corresponding target loss parameter during the training process, includes: Generate a third embedding vector corresponding to each song singer evaluation training data in the training data set by using the preset sentiment dictionary; Generate a fourth embedding vector corresponding to each song singer evaluation class training data based on the designated evaluation object information corresponding to each song singer evaluation class training data in the training data set; The sentiment analysis model is trained based on the first embedding vector, the second embedding vector, the third embedding vector, and the fourth embedding vector, and during the training process, a first loss parameter for measuring sentiment polarity classification loss is determined based on the first embedding vector and the second embedding vector, and a second loss parameter for measuring singer song evaluation classification loss is determined based on the third embedding vector and the fourth embedding vector; A corresponding target loss parameter is determined based on the first loss parameter and the second loss parameter.
8. The method for analyzing music review sentiment according to claim 7, It is characterized in that The determining a corresponding target loss parameter based on the first loss parameter and the second loss parameter includes: The first loss parameter and the first preset weight coefficient corresponding to the first loss parameter, the second loss parameter and the second preset weight coefficient corresponding to the second loss parameter are used to perform weighted calculation to obtain the corresponding target loss parameter.
9. According to the music review sentiment analysis method of claim 7, It is characterized in that The determining a corresponding target loss parameter based on the first loss parameter and the second loss parameter includes: The first loss parameter and the first weight coefficient corresponding to the first loss parameter, the second loss parameter and the second weight coefficient corresponding to the second loss parameter are used for weighted calculation to obtain the corresponding target loss parameter; wherein the first weight coefficient and the second weight coefficient are both weight coefficients obtained through training.
10. The method for analyzing music review sentiment according to claim 7, It is characterized in that The step of using the trained sentiment analysis model to determine the sentiment polarity corresponding to the music review to be analyzed includes: The trained sentiment analysis model is used to determine the song singer evaluation category classification result and the sentiment polarity classification result of the music review to be analyzed. If the song singer evaluation category classification result is that the music review to be analyzed is a song singer evaluation category, then the sentiment polarity classification result is determined as the sentiment polarity corresponding to the music review to be analyzed.
11. An electronic device, It is characterized in that comprising a processor and a memory; wherein, The memory is used to store the computer program; The processor is used to execute the computer program to implement the music review sentiment analysis method as described in any one of claims 1 to 10.
12. A computer-readable storage medium, It is characterized in that Used to store a computer program, wherein when the computer program is executed by a processor, the method for analyzing the sentiment of music reviews as described in any one of claims 1 to 10 is implemented.
