A multi-level analysis method and device for text sentiment classification
By adopting a multi-level analysis method in text emotion classification, using training sample association, community division and user association information, a comprehensive loss function is constructed and a multi-level emotion classifier is trained, which solves the problem of low accuracy of text emotion classification in social networks and achieves a high recognition accuracy rate.
Patent Information
- Application Number
- CN202411641132.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-11-18
AI Technical Summary
The prior art has low accuracy in text emotion classification in social networks, and cannot effectively deal with irregular expression in unstructured text and emotional differences in different contexts. It requires a large amount of training data based on machine learning methods, which is prone to overfitting problems.
A multi-level analysis method is adopted to extract the correlation information, community division results and user association information between training samples, build a comprehensive loss function and train a multi-level emotion classifier to improve the accuracy of text emotion classification.
Without relying on a large number of samples, the recognition accuracy of text sentiment classification is improved, and the problem of insufficient accuracy in the prior art is solved.
Smart Images

Figure CN119149674B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of text recognition, and in particular to a multi-level analysis method and device for text sentiment classification. Background Art
[0002] In recent years, with the rapid development of Internet technology, many social networks have emerged, becoming an important platform for users to spread information, understand current affairs, and express their opinions. A large number of opinions are flooding in them, and social networks have become a huge resource library, attracting the attention of scholars, enterprises, and governments. For example, companies can use a large amount of data on social networks to understand users' attitudes towards their products and improve their products. By mining the emotions in social networks, emergencies in the network can be detected, providing opportunities for the government to guide public opinion. Faced with the massive and complex texts in social networks, how to perform sentiment analysis on them and provide a data foundation for important applications such as recommendation systems and public opinion guidance has become an important demand.
[0003] Sentiment analysis is a branch of natural language processing, which aims to classify text information into positive, negative, neutral, or emotions such as joy, anger, sadness, and happiness. At present, there are two main methods for sentiment analysis. One is the dictionary-based sentiment analysis method, which assigns different sentiment scores to words in the text through dictionaries such as WordNet and SenticNet, and then obtains the final sentiment category of the text by combining the sentiment scores of all words. However, these methods perform poorly in the sentiment classification of text in social networks. This is because most of the text in social networks is unstructured text, containing a large number of network terms, special symbols, abbreviations, typos and other non-standard expressions. Sentiment dictionaries cannot solve the problem of sentiment assignment of non-standard expressions in text, and cannot handle the problem that the same word has different emotions in different contexts. Another method is the sentiment analysis method based on machine learning. This method maps text into vectors through different feature extraction methods such as word bags and word vectors, and inputs them into machine learning models such as SVM, CNN, LSTM, and Transformer. However, sentiment analysis methods based on machine learning require a large amount of training data, and when there is less training data, overfitting and other phenomena will occur.
[0004] Social networks have their own unique environmental factors. Currently, sentiment classification of texts appearing in social networks only analyzes the text content, ignoring the impact of social network environmental factors on text sentiment, so there is a problem of insufficient recognition accuracy. Summary of the invention
[0005] The embodiments of the present application provide a multi-level analysis method and device for text sentiment classification to solve the technical problem of low accuracy in sentiment classification of texts appearing in social networks in the prior art.
[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0007] In a first aspect, an embodiment of the present application provides a multi-level analysis method for text sentiment classification, the method comprising:
[0008] Obtaining training samples and true labels corresponding to the training samples;
[0009] Extracting first association information between one of the training samples and another training sample in the training samples, and constructing a first loss function based on the first association information;
[0010] Dividing publishers corresponding to the training samples according to communities to obtain community division results, and constructing a second loss function based on the community division results;
[0011] Extracting second association information between one of the publishers corresponding to the training sample and another publisher, and constructing a third loss function based on the second association information;
[0012] A comprehensive loss function is constructed according to the first loss function, the second loss function, and the third loss function, and a multi-level sentiment classifier is trained with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model;
[0013] The text sentiment classification model is used to perform sentiment classification on the text to be identified, and a classification result is determined.
[0014] In combination with the first aspect, in a possible design manner, the extracting first association information between one of the training samples and another training sample in the training samples includes:
[0015] Extracting a similarity comparison result between a publisher corresponding to one of the training samples and a publisher corresponding to another training sample in the training samples;
[0016] The first association information between the two training samples is determined according to the similarity comparison result.
[0017] In combination with the first aspect, in a possible design manner, the extracting the second association information between one of the publishers corresponding to the training sample and another publisher includes:
[0018] Acquire publisher information, wherein the publisher information includes a publisher's attention list, and the attention list is used to characterize attention behaviors between the publisher and other publishers;
[0019] Based on the attention list, the attention behaviors between the publisher and others are converted into a publisher relationship matrix to obtain second association information, wherein each element in the publisher relationship matrix is used to indicate whether the publisher is associated with other publishers.
[0020] In combination with the first aspect, in a possible design, extracting a similarity comparison result between a publisher corresponding to one of the training samples and a publisher corresponding to another training sample in the training samples includes:
[0021] A similarity comparison result is determined according to whether one of the training samples and another of the training samples are published by the same publisher, and whether a publisher corresponding to one of the training samples and a publisher corresponding to another of the training samples are similar.
[0022] In combination with the first aspect, in a possible design manner, constructing a first loss function based on the first association information includes:
[0023] Determining whether the two training samples are associated based on the first association information;
[0024] A first loss function is constructed according to that a first gap between predicted labels corresponding to two associated training samples is smaller than a first gap between predicted labels corresponding to two unassociated training samples.
[0025] In combination with the first aspect, in a possible design manner, constructing a second loss function based on the community division result includes:
[0026] Determine the community similarity of publishers corresponding to the two training samples based on the community division result;
[0027] A second loss function is constructed based on that a second gap between predicted labels corresponding to training samples published by two publishers with high community similarity is smaller than a second gap between predicted labels corresponding to training samples published by two publishers with low community similarity.
[0028] In combination with the first aspect, in a possible design, determining the community similarity of publishers corresponding to the two training samples based on the community division result includes:
[0029] Using nodes in the community division result to represent publishers, obtaining the number of connections between nodes in the community division result;
[0030] The number of connections between all nodes in the community where the publishers corresponding to the two training samples are located is divided by the number of all nodes in the community to obtain the community similarity, wherein the community similarity is characterized by the sparsity of the number of connections between the communities where the publishers are located.
[0031] In combination with the first aspect, in a possible design manner, constructing a third loss function based on the second association information includes:
[0032] Determining whether publishers corresponding to the two training samples are associated based on the second association information;
[0033] A third loss function is constructed according to that a third gap between the predicted labels corresponding to the training samples published by two associated publishers is smaller than a third gap between the predicted labels corresponding to the training samples published by two unassociated publishers.
[0034] In combination with the first aspect, in a possible design manner, the comprehensive loss function is constructed according to the first loss function, the second loss function, and the third loss function, including:
[0035] Assign weights to the first loss function, the second loss function, and the third loss function respectively;
[0036] The first loss function, the second loss function, the third loss function and the product of their corresponding weights are added together, and combined with model parameters and norms to construct a comprehensive loss function.
[0037] In a second aspect, the present application embodiment provides a multi-level analysis device for text sentiment classification, comprising:
[0038] A sample acquisition module is used to acquire training samples and true labels corresponding to the training samples;
[0039] A function construction module, used for extracting first association information between one of the training samples and another training sample in the training samples, and constructing a first loss function based on the first association information;
[0040] Dividing publishers corresponding to the training samples according to communities to obtain community division results, and constructing a second loss function based on the community division results;
[0041] Extracting second association information between one of the publishers corresponding to the training sample and another publisher, and constructing a third loss function based on the second association information;
[0042] A model training module is used to construct a comprehensive loss function according to the first loss function, the second loss function, and the third loss function, and train a multi-level sentiment classifier with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model;
[0043] The model application module is used to perform sentiment classification on the text to be identified through the text sentiment classification model and determine the classification result.
[0044] In a third aspect, an embodiment of the present application provides a terminal, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the method of the first aspect and possible design methods thereof.
[0045] In a fourth aspect, an embodiment of the present application provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the method of the first aspect and its possible design manner when running.
[0046] Compared with the prior art, the present application first obtains training samples and the true labels corresponding to the training samples; extracts the first association information between one of the training samples and another training sample in the training samples, and constructs a first loss function based on the first association information; divides the publishers corresponding to the training samples according to the community, obtains the community division result, and constructs a second loss function based on the community division result; extracts the second association information between one of the publishers corresponding to the training samples and another publisher, and constructs a third loss function based on the second association information; constructs a comprehensive loss function according to the first loss function, the second loss function, and the third loss function, and trains the multi-level sentiment classifier with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model; uses the text sentiment classification model to perform sentiment classification on the text to be identified, and determines the classification result. The present application considers the influence of the three levels of sample relevance, community similarity, and user relevance on sentiment analysis, and constructs the first loss function based on the first association information obtained by sample relevance, the second loss function based on the second association information based on community similarity, and the third loss function based on the third association information of user relevance, and constructs a comprehensive loss function by combining the first association information, the second association information, and the third association information. By optimizing the parameters of the multi-level sentiment classifier with the goal of minimizing the comprehensive loss function, a text sentiment classification model can be trained. Since the training process of the model takes into account the influence of the above three levels, the model can achieve a higher recognition accuracy when recognizing unstructured text without relying on a large number of samples, which solves the current problem of insufficient recognition accuracy in text sentiment classification.
[0047] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0049] Figure 1 A hardware structure block diagram of a terminal provided in an embodiment of the present application is shown;
[0050] Figure 2 A flowchart of a multi-level analysis method for text sentiment classification provided by an embodiment of the present application is shown;
[0051] Figure 3 A schematic diagram of a multi-level social network sentiment analysis system provided by an embodiment of the present application is shown;
[0052] Figure 4 A flowchart of a service execution method based on emotion classification provided by an embodiment of the present application is shown;
[0053] Figure 5 A flowchart of a method for extracting association relationships provided by an embodiment of the present application is shown;
[0054] Figure 6 A schematic diagram of a text sentiment classification method provided by an embodiment of the present application is shown;
[0055] Figure 7 A structural block diagram of a multi-level analysis device for text sentiment classification provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0056] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0057] Unless otherwise defined, technical terms or scientific terms involved in this application shall have the general meanings understood by those with ordinary skills in the technical field to which this application belongs. In this application, words such as "a", "an", "one", "the", "these" and the like do not indicate a limitation in quantity, and they can be singular or plural. The terms "including", "comprising", "having" and any variants thereof involved in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent in these processes, methods, products or devices. The terms "connected", "linked", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The term "plurality" involved in this application means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, "A and / or B" may represent: A exists alone, A and B exist simultaneously, and B exists alone. Usually, the character " / " indicates that the objects associated before and after are in an "or" relationship. The terms "first", "second", "third" and the like involved in this application are only used to distinguish similar objects and do not represent a specific order for the objects.
[0058] Sentiment analysis technology stems from the need for efficient utilization of massive texts and technological progress. With the rapid development of Internet technology, social networks have become a huge resource library. By mining the sentiment in social networks, a data foundation is provided for important applications such as recommendation systems and public opinion guidance. The texts that appear in social networks are mostly unstructured texts, containing a large number of non-standard elements such as Internet jargon, special symbols, abbreviations, and typos. Taking microblogs as an example, their length is generally no more than 140 characters and also contains a large number of emoticons, slang, typos, etc., such as "^_^", "肿么了" (what's wrong in Chinese), etc. This results in problems of low recognition accuracy whether using sentiment dictionaries to identify texts or using machine learning to identify texts.
[0059] Social networks have their own specific environmental factors. Users will form communities, and users in the same community will share some similar characteristics, such as similar language expression habits. Different users in the same community also retain their individuality and have special personal expression habits. In addition, users will also use some common expression methods when expressing emotions, such as "good", "bad", etc. However, related technologies ignore the influence of social network environmental factors on text sentiment, resulting in poor sentiment analysis effects on texts.
[0060] In view of this, an embodiment of the present application provides a multi-level analysis method for text sentiment classification, constructs a multi-level sentiment classifier, and trains it through a comprehensive loss function so that the trained text sentiment classification model can be fitted based on three levels: sample association, community association, and user association. In this way, the trained model is more accurate in sentiment classification of texts in community networks, and the data analysis based on the classification results is more effective.
[0061] This method can be applied to social media regulation, such as companies and governments can use this method to detect public sentiment on social media and respond to social hot spots and crisis events in a timely manner. This method can also be applied to marketing, such as companies use this method to analyze consumers' emotional reactions to marketing activities to optimize advertising and promotion strategies. This method can also be applied to sentiment analysis of competitors' social media activities to gain market competitive advantages. In addition, this method can also be applied to financial analysis, such as financial institutions can analyze sentiment on social media about stocks, currencies or other financial products to assist investment decisions. When the classification accuracy of text sentiment is high, the effect of applying it to the above scenarios is better.
[0062] The method can be executed in a terminal, a computer or a similar test system. Taking running on a terminal as an example, Figure 1 FIG. 1 shows a hardware structure block diagram of a terminal provided in an embodiment of the present application. Figure 1 As shown, the terminal may include one or more ( Figure 1 The terminal may further include a transmission device 106 and an input / output device 108 for communication functions. It will be appreciated by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0063] The memory 104 can be used to store computer programs, for example, software programs and modules of application software. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, the above-mentioned method is realized. The memory 104 can be used to store data, for example, training samples, true labels, etc. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0064] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0065] Figure 2 A flowchart of a multi-level analysis method for text sentiment classification provided by an embodiment of the present application is shown. Figure 2 As shown, the method includes steps S201 to S206.
[0066] Step S201: Obtain training samples and true labels corresponding to the training samples.
[0067] Among them, the training samples can be pre-processed texts. Specifically, the training samples are generated by converting the original text symbols into English symbols, removing URL information, filtering out connection symbols and user names from Weibo, removing words such as "reply", "forward Weibo" and forwarded content, etc.
[0068] Among them, the real label can be an emotion category marked manually or automatically, such as sad, happy, excited, calm, etc. These emotion categories can be represented by characters, such as sad corresponds to the number 1, happy corresponds to the number 2, excited corresponds to the number 3, and calm corresponds to the number 4.
[0069] It should be noted that in the embodiment of the present application, the real label refers to the marked emotion category, and the predicted label refers to the probability of the training samples recognized by the model under each emotion category. For example, the model recognizes the predicted label of the emotion of a text as: sad 70%, happy 10%, excited and happy 10%, calm 10%.
[0070] It can be understood that the smaller the gap between the predicted label and the true label, the closer the model's prediction is to the true label. Conversely, the larger the gap between the predicted label and the true label, the closer the model's prediction is to the true label. During the training process, by minimizing the comprehensive loss function, the model parameters are continuously adjusted to enable the model to better fit the training data.
[0071] The training samples and true labels obtained in step S201 are used to train the model to obtain a text sentiment classification model that can identify classification results based on a text. The specific training process can be referred to the following description.
[0072] Step S202: extract first association information between one of the training samples and another training sample in the training samples, and construct a first loss function based on the first association information.
[0073] This step uses the sentiment labels corresponding to the associated texts to train the model so that it can learn richer features, such as those subtle sentiment differences that are difficult to extract directly from a single text, to strengthen feature learning. Not only that, by effectively utilizing the correlation between texts and borrowing label information between associated texts, the reliance on a large amount of labeled data can be reduced. In other words, sentiment analysis methods based on machine learning require a large amount of training data, and when there is less training data, overfitting and other phenomena will occur. This step helps to reduce the annotation cost by extracting the correlation information between the training samples, and there will be no overfitting problem, so the recognition accuracy of the trained model is high. In addition, when the number of samples in different emotion categories is unbalanced, the distribution of emotion labels can be balanced during the training process by extracting the correlation between training samples, thereby enhancing the model's recognition ability for a few categories and improving the model's generalization ability.
[0074] The following is a further explanation of the method of extracting the first association information. The influence of the first association information on sentiment analysis is considered during model training: if there is first association information between two training samples, the sentiment labels predicted by the model tend to be similar. Based on this, the first association information between the training samples is represented, such as manual or automatic labeling. If there is a correlation between the two training samples, it is labeled as 1, and if there is no correlation between the two training samples, it is labeled as 0.
[0075] Specifically, the above-mentioned extraction of association information between one of the training samples and another training sample includes: extracting the similarity comparison result between the publisher corresponding to one of the training samples (corresponding to the user hereinafter) and the publisher corresponding to the other training sample; determining the first association information between the two training samples according to the similarity comparison result. The similarity comparison results here include: the same, different but similar, and different and not similar. Among them, publisher similarity refers to the high similarity of multiple publishers in characteristics or behaviors. These characteristics include interest preferences, behavior patterns, basic attributes, etc., among which interest preferences refer to users having similar interests in the same type of content, products or activities, behavior patterns include user activity frequency, interaction methods or purchase history, etc., and basic attributes include age, gender, geographic location, occupation, etc. By setting a threshold, two publishers with a similarity higher than the threshold are considered similar, and two publishers with a similarity lower than or equal to the threshold are considered dissimilar.
[0076] The above-mentioned similarity comparison result between the publisher corresponding to one of the training samples and the publisher corresponding to another training sample includes: determining the similarity comparison result according to whether one of the training samples and the other training sample are published by the same publisher, and whether the publisher corresponding to one of the training samples and the publisher corresponding to the other training sample are similar.
[0077] In some of the embodiments, based on the emotion consistency theory, whether two training samples are related is determined by whether they are posted by the same user, and the emotion labels of two related training samples tend to be consistent.
[0078] Specifically, if two training samples are published by the same user, it is determined that there is a correlation between the two training samples, so the sentiment labels of the training samples published by the same user tend to be consistent; conversely, if the two training samples are published by different users, it is determined that there is no correlation between the two training samples.
[0079] More specifically, the training samples come from social platforms. Therefore, the user emotions corresponding to the training samples posted by the same user collected in a short period of time tend to be consistent. For example, a user posts multiple Weibo posts about an event on a certain day. Each Weibo post is equivalent to a training sample. The correlation of these training samples comes from the fact that they are posted by the same user. The emotions of the user when posting these Weibo posts tend to be consistent, so the emotional labels corresponding to these Weibo posts tend to be consistent.
[0080] In other embodiments, based on the theory of emotional contagion, whether two training samples are related is determined by whether they are posted by similar users, and the emotional labels of two related training samples tend to be consistent.
[0081] Specifically, if two training samples are published by similar users, it is determined that there is a correlation between the two training samples, so the sentiment labels of the training samples published by similar users tend to be consistent; conversely, if the two training samples are published by dissimilar users, it is determined that there is no correlation between the two training samples.
[0082] More specifically, social platforms have their own unique environmental factors, that is, a group of people will publish similar views on the same event or hot topic. For example, two students in the same class posted a microblog about tutoring on the Weibo platform on the same day. These two microblogs are equivalent to two training samples. Since the two students in the same class are similar, and the relevance of these two training samples comes from the fact that they are posted by similar users, and the emotions of similar users when posting microblogs tend to be consistent, then the emotional labels corresponding to these microblogs tend to be consistent. It should be noted that the above example of microblogs posted within one day is only an exemplary explanation. In practice, the collection time can be one hour, one minute, six hours, half a month, one month, etc. Text (including input samples, test samples, real-time text data) can be collected from social networks such as Weibo platforms and Twitter platforms, and this application does not limit this.
[0083] This step is based on the theory of emotional consistency and emotional contagion, and constructs a first loss function based on the first association information, wherein the first loss function is used to characterize the first gap between the predicted label corresponding to one training sample and the predicted label corresponding to another training sample, and the first gap between the predicted labels corresponding to two associated training samples is smaller than the first gap between the predicted labels corresponding to two unassociated training samples. The global text sentiment classifier is trained with the first loss function, and the model parameters of the global text sentiment classifier are optimized with minimizing the first loss function as the optimization goal.
[0084] Step S203: divide the publishers corresponding to the training samples according to communities, obtain community division results, and construct a second loss function based on the community division results.
[0085] This step constructs the second loss function based on the community division results, so that it can learn rich features, such as subtle emotional differences that are difficult to directly extract from a single text, to strengthen feature learning. Not only that, through the correlation between communities, the model can borrow label information between texts posted by users in related communities (such as the same community or similar communities), which can reduce dependence on a large amount of labeled data, help reduce labeling costs, and avoid overfitting problems, so the trained model has high recognition accuracy. In addition, when the number of samples in different emotion categories is unbalanced, by extracting the correlation between communities, the distribution of emotional labels can be balanced during the training process, thereby enhancing the model's recognition ability for minority categories and improving the model's generalization ability.
[0086] The following is a further explanation of the method of extracting the second associated information. The impact of the second associated information on sentiment analysis is considered during model training: users in the same community will have some similar properties due to their structural similarities, such as sharing similar expressions. Although the connection between two communities is less than that within a community, it also provides a lot of useful information. Therefore, the concept of community similarity is introduced. If the community similarity is high, the probability of sharing similar expressions between communities is high, such as using emoticons to express emotions, or most of the posts in the Tucao super topic are negative emotions. On the contrary, if the community similarity is low, the probability of sharing similar expressions between communities is small. Based on this, this step constructs a second loss function based on the community division result, wherein the second loss function is used to characterize the second gap between the predicted label corresponding to one training sample and the predicted label corresponding to another training sample, wherein the second gap between the predicted labels corresponding to the training samples published by the publisher with high community similarity is smaller than the second gap between the predicted labels corresponding to the training samples published by the publisher with low community similarity.
[0087] Specifically, a user relationship network is obtained, in which each node represents a user. The user relationship network is divided based on the distance between the nodes to obtain a community division result. After obtaining the community division result, the second loss function is constructed based on the community division result, including: determining the community similarity of the publishers corresponding to the two training samples based on the community division result; constructing a second loss function based on the second gap between the predicted labels corresponding to the training samples published by two publishers with high community similarity being smaller than the second gap between the predicted labels corresponding to the training samples published by two publishers with low community similarity. The community-level text sentiment classifier is trained with the second loss function, and the model parameters of the community-level text sentiment classifier are optimized with minimizing the second loss function as the optimization goal.
[0088] More specifically, the above-mentioned determination of the community similarity of the publishers corresponding to the two training samples based on the community division result includes: representing the publishers with the nodes in the community division result, and obtaining the number of connections between the nodes in the community division result; dividing the number of connections between all nodes in the community where the publishers corresponding to the two training samples are located by the number of all nodes in the community, to obtain the community similarity, wherein the community similarity is characterized by the sparsity of the number of connections between the communities where the publishers are located.
[0089] Step S204: extract second association information between one of the publishers corresponding to the training sample and another publisher, and construct a third loss function based on the second association information.
[0090] This step constructs a third loss function based on the second association information to train a user-level text sentiment classifier. The model can borrow label information between texts posted by related users, reduce dependence on a large amount of labeled data, help reduce labeling costs, and avoid overfitting problems, so the trained model has high recognition accuracy. In addition, when the number of samples in different emotion categories is unbalanced, the distribution of emotion labels can be balanced during the training process by extracting the association between users, thereby enhancing the model's recognition ability for a minority of categories and improving the model's generalization ability.
[0091] The relevance of users can be determined by their follow list, number of interactions, intimacy, etc., which will be explained below.
[0092] Taking the user's follow list to determine the correlation between users as an example: the comparison result (correlation) between users can be represented by establishing a user relationship matrix. Specifically, the method also includes: obtaining user information, wherein the user information includes the user's follow list, and the follow list is used to represent the follow behavior between the user and other users; establishing a user relationship matrix, converting the follow behavior between the user and others into the user relationship matrix, wherein each element in the user relationship matrix indicates whether there is a correlation between the user and other users.
[0093] In this embodiment, the association relationship between users is revealed through the user relationship matrix, and converting it into a user relationship matrix is conducive to the subsequent mining of the similarity between the texts posted by the associated users of the social network through the model. Specifically, it is achieved through the training model: if the comparison result indicates that the two users follow each other, then the third association information indicates that there is an association between the two training samples; if the comparison result indicates that the two users are not related to each other, then the association information indicates that there is no association between the two training samples. The model trained in this way borrows the label information of the text posted by the associated users, and can maintain a high recognition rate with a small amount of annotated data, thereby reducing the dependence on the number and distribution of annotated data, and the model performance will be better.
[0094] Regarding the number of interactions and intimacy, please refer to the above introduction to the follow list, which will not be explained here.
[0095] The third loss function is constructed based on the second association information, including: determining whether publishers corresponding to two training samples are associated based on the second association information; constructing the third loss function according to the third gap between the predicted labels corresponding to the training samples published by two associated publishers being smaller than the third gap between the predicted labels corresponding to the training samples published by two unassociated publishers. The user-level text sentiment classifier is trained with the third loss function, and the model parameters of the user-level text sentiment classifier are optimized with minimizing the third loss function as the optimization goal.
[0096] Step S205: construct a comprehensive loss function according to the first loss function, the second loss function, and the third loss function, and train the multi-level sentiment classifier with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model.
[0097] It can be understood that the multi-level sentiment classifier includes the global text sentiment classifier, community-level text sentiment classifier, and user-level text sentiment classifier mentioned above, so the comprehensive loss function of the multi-level sentiment classifier is constructed by the first loss function corresponding to the global text sentiment classifier, the second loss function corresponding to the community-level text sentiment classifier, and the third loss function corresponding to the user-level text sentiment classifier. Specifically, weights can be assigned to the first loss function, the second loss function, and the third loss function, respectively, and the calculated loss functions and the weight products and the model parameters and norms are added to obtain a comprehensive loss function, or the first loss function, the second loss function, and the third loss function themselves already include weights, then the three are directly added to the model parameters and norms to obtain a comprehensive loss function. Alternatively, the global text sentiment classifier is trained based on the first loss function, the community-level text sentiment classifier is trained based on the second loss function, and the user-level text sentiment classifier is trained based on the third loss function, and then the features output by the three are fused through the fully connected layer, and the relationship between the features output by different classifiers is automatically captured through the fully connected layer.
[0098] In some of the embodiments, after step S205, the text sentiment classification device may also be tested, the purpose of the test is to use a set of test samples and corresponding true labels as inputs of the model, with the goal of minimizing the distance between the test labels and the training labels, and optimizing the parameters of the model.
[0099] Step S206: sentiment classification is performed on the text to be recognized using a text sentiment classification model to determine a classification result.
[0100] The classification result refers to the probability of the training samples recognized by the model in each emotion category. For example, the model recognizes the predicted labels of a text emotion as: sad 70%, happy 10%, excited and happy 10%, and calm 10%.
[0101] The trained text sentiment classification model has a good recognition accuracy, and the classification result obtained by sentiment classification of the text to be recognized is closer to the real label of the text.
[0102] In the embodiment recorded in the above steps S201 to S206, training samples and true labels corresponding to the training samples are obtained; first association information between one of the training samples and another training sample is extracted, and a first loss function is constructed based on the first association information; publishers corresponding to the training samples are divided according to communities to obtain community division results, and a second loss function is constructed based on the community division results; second association information between one of the publishers corresponding to the training samples and another publisher is extracted, and a third loss function is constructed based on the second association information; a comprehensive loss function is constructed according to the first loss function, the second loss function, and the third loss function, and a multi-level sentiment classifier is trained with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model; sentiment classification is performed on the text to be identified through the text sentiment classification model to determine the classification result. This application considers the influence of three levels, namely, sample correlation, community similarity, and user correlation, on sentiment analysis, and constructs a first loss function based on the first correlation information obtained from sample correlation, a second loss function based on the second correlation information obtained from community similarity, and a third loss function based on the third correlation information obtained from user correlation, and constructs a comprehensive loss function by combining the first correlation information, the second correlation information, and the third correlation information. By optimizing the parameters of the multi-level sentiment classifier with the purpose of minimizing the comprehensive loss function, a text sentiment classification model can be trained. Since the training process of the model considers the influence of the above three levels, the model can achieve a high recognition accuracy rate when recognizing unstructured text without relying on a large number of samples, which solves the problem of insufficient recognition accuracy in the current sentiment classification of text.
[0103] The following uses a microblog as an example to further illustrate the method of the embodiment of the present application. Figure 3 A schematic diagram of a multi-level social network sentiment analysis system provided by an embodiment of the present application is shown. Figure 3 As shown, including:
[0104] The text preprocessing module 31 is used to preprocess the collected original microblogs to obtain microblog samples (hereinafter referred to as microblogs). For the preprocessing steps, please refer to the description of step S201 above.
[0105] The text association information extraction module 32 extracts the first association information between each training sample.
[0106] The multi-level social network text sentiment analysis system construction module 33 combined with social knowledge is used to construct a multi-level text sentiment classification model. For details, please refer to the description of steps S201 to S205 above.
[0107] The multi-level sentiment analysis system optimization module 34 is used to optimize the parameters of the text sentiment classification model through test samples to make the classification accuracy of the model higher.
[0108] The above is a brief description of the analysis system. The following will continue to describe and illustrate the method of using the analysis system to perform sentiment analysis using Weibo as an example.
[0109] Figure 4 A flowchart of a service execution method based on emotion classification provided by an embodiment of the present application is shown. Figure 4 As shown, the method includes:
[0110] S401, pre-processing the microblog.
[0111] Among them, the preprocessed data set is represented as X dataset , and the sentiment label corresponding to the dataset is represented as Y dataset , and extract the preprocessed text features. The i-th text is represented as x after feature extraction. i , the sentiment label corresponding to the i-th text is represented as y i .
[0112] S402: Extracting correlation information between microblogs.
[0113] Among them, the associated information is represented by the text association matrix C, C ij = 1 means if and only if there is a correlation between the i-th text and the j-th text. Figure 5 A flowchart of a method for extracting association relationships provided by an embodiment of the present application is shown. Figure 5 , S402 may further include:
[0114] S402a. Extract correlation relationships based on the emotion consistency theory in sociology.
[0115] Specifically, if two microblogs are posted by the same user on the same topic, then the sentiment labels of the two microblogs are more likely to be consistent. Assuming that the user microblog relationship matrix is U, the microblog relationship matrix C is obtained from the sentiment consistency theory: sc =U T U, If and only if the i-th text and the j-th text are published by the same user.
[0116] S402b. Extract correlation relationships based on the emotional contagion theory in sociology.
[0117] Specifically, if two microblogs are posted by similar users on the same topic, then the emotional labels of the two microblogs are more likely to be consistent. Assuming that the user microblog relationship matrix is U and the user matrix is F, the matrix C is obtained from the emotional contagion theory: ec =U T FU, If and only if the i-th text and the j-th text are posted by similar users.
[0118] S402c, combining the emotion consistency theory and the emotion contagion theory to obtain the microblog related information matrix.
[0119] The microblog related information matrix is calculated based on the theory of emotional consistency and emotional contagion, that is, C = C ec +C sc .
[0120] The above is an explanation of extracting correlation relationships. After obtaining the correlation relationships, a multi-level text sentiment analysis model is constructed. Specifically, a three-level text sentiment analysis model is constructed, which is a global sentiment classifier. , Community Sentiment Classifier , and user-personalized sentiment classifier , please refer to the following description for details.
[0121] The impact of correlation on sentiment analysis is taken into account during model training. Specifically, if two microblogs are correlated, the sentiment labels predicted by the machine model should be similar, so modeling can be performed. Please refer to the following description for details.
[0122] S403: Build a global sentiment classifier.
[0123] The global sentiment classifier is trained using all training samples to extract common emotional expressions. In addition, similar users usually have the same emotions, and the global sentiment classifier also considers this information. If there is related information between two texts, the emotional labels predicted by the machine model should be similar. Therefore, this part of the model is constructed as follows:
[0124]
[0125] Among them, w represents the model parameters of the global text sentiment classifier, and the function f represents the selected classification model, such as the maximum entropy model, support vector machine, etc. represents the predicted label obtained by the global sentiment classifier, where represents the sentiment label predicted by the machine, c represents the category of the sentiment label, C represents the number of categories, N represents the number of texts, ||w|| represents the 2-norm of the model parameter, ||w||1 represents the 1-norm of the model parameter, λ1 and λ2 represent different regularization weights of the global sentiment classifier parameters, and α represents the weight of the microblog graph regularization.
[0126] S404. Build a community-level sentiment classifier.
[0127] Perform community division on the user relationship network F to obtain the community division result. Use this information to build a community-level sentiment classifier. The connections between communities are relatively sparse, and the connections within a community are relatively tight. Users in the same community have some similar properties due to their structural similarities, such as sharing similar expressions; the connection between two communities is less than the connection within a community, but it also provides a lot of useful information. In order to accurately represent the connection between the texts posted by users in the same and similar communities, community similarity is introduced, which can be calculated by the following formula:
[0128]
[0129] Among them, A s,t represents the number of connections between community i and community j, s represents the nodes belonging to community i, and t represents the nodes belonging to community j. Represents the number of nodes in the two communities.
[0130] The community-level Weibo sentiment classifier is constructed as follows:
[0131]
[0132] in, represents the parameters of the community-level sentiment classifier, N m represents the number of texts contained in the corresponding community, and M represents the number of communities. λ1 and λ2 represent different regularization weights of community-level sentiment classifier parameters, and ||W c || F represents the Frobenius norm, represents the 1-norm, and β represents the weight of community regularization.
[0133] S405: Build a user-level sentiment classifier.
[0134] When users publish text, they will embed some of their own personalized information. At the same time, related users tend to have the same way of expression. The model constructed in this section is as follows:
[0135]
[0136] in, represents the parameters of the user-level sentiment classifier, N p represents the number of texts posted by users, and P represents the number of users. λ1 and λ2 represent different regularization weights of user-level sentiment classifier parameters, ||W P || F represents the Frobenius norm, represents the 1 norm, η represents the user regularization weight, and the matrix F represents the association matrix between users. i,j = 1, there is an association between user i and user j.
[0137] S406. Construct a multi-level text sentiment classifier.
[0138] The multi-level sentiment analysis system combines the three levels of sentiment classifiers mentioned above, and its construction method is as follows:
[0139]
[0140] S407: Calculate the search point of the multi-level text sentiment classifier.
[0141] Find the model parameters: w, W P , W C The search point is calculated as follows:
[0142]
[0143]
[0144]
[0145] Define the function p(w,W C ,W P ):
[0146]
[0147] S408. Calculate the partial derivative of the optimization target.
[0148] Calculate the function p(w,W C ,W P ) for w, W P , W C The partial derivative of is calculated as follows:
[0149]
[0150]
[0151]
[0152]
[0153]
[0154] Among them, the matrix L represents the Laplace matrix, L = D - C, .
[0155] S409: Update the search point until convergence.
[0156] Update w, W C , W P , calculated as follows:
[0157]
[0158]
[0159]
[0160] in, , represents the step size during update, which is selected by the following formula:
[0161]
[0162] S410, performing sentiment analysis on the microblog.
[0163] The microblog is input into the multi-level text sentiment classifier obtained by the test, and the classifier outputs the classification result. The sentiment label of the microblog can be determined based on the classification result.
[0164] The embodiment of the present application provides a multi-level social network sentiment analysis method, which can improve the effect of microblog sentiment analysis by improving the training phase of the model using the associated information of microblogs from the two aspects of sentiment consistency and sentiment infectiousness; and constructs a multi-level text sentiment analysis system, which considers the impact of social knowledge on different classifiers from three perspectives: global level, community level and user level, and can obtain better sentiment analysis results. At the same time, the optimization of the regularization term using the FISTA algorithm improves the iteration speed, accelerates convergence and increases the generalization of the model.
[0165] Figure 6 A schematic diagram of a text sentiment classification method provided by an embodiment of the present application is shown. Figure 6As shown, the method provided in the embodiment of the present application preprocesses text features and extracts microblog text relations, and inputs the text features and text relations into a multi-level sentiment classifier for training, wherein the multi-level sentiment classifier integrates a global sentiment classifier, a community-level sentiment classifier, and a user-level sentiment classifier, and optimizes the sentiment classifier by the text to be tested, and finally outputs the sentiment analysis result. Through this method, the problem of insufficient recognition accuracy in sentiment classification of texts appearing in social networks is solved.
[0166] The present application also provides a multi-level analysis device for text sentiment classification in the embodiments, which is used to implement the above embodiments and preferred implementation modes, and will not be repeated hereafter. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware for predetermined functions. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0167] Figure 7 FIG. 4 shows a structural block diagram of a multi-level analysis device for text sentiment classification provided by an embodiment of the present application. Figure 7 As shown, the device comprises:
[0168] A sample acquisition module 71 is used to acquire training samples and true labels corresponding to the training samples;
[0169] A function construction module 72, configured to extract first association information between one of the training samples and another training sample in the training samples, and construct a first loss function based on the first association information;
[0170] Divide the publishers corresponding to the training samples into communities, obtain community division results, and construct a second loss function based on the community division results;
[0171] Extracting second association information between one of the publishers corresponding to the training sample and another publisher, and constructing a third loss function based on the second association information;
[0172] A model training module 73 is used to construct a comprehensive loss function according to the first loss function, the second loss function, and the third loss function, and train a multi-level sentiment classifier with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model;
[0173] The model application module 74 is used to perform sentiment classification on the text to be recognized through the text sentiment classification model and determine the classification result.
[0174] In some embodiments, the function construction module 72 is further used to extract similar comparison results between a publisher corresponding to one of the training samples and a publisher corresponding to another training sample in the training samples;
[0175] The first association information between the two training samples is determined according to the similarity comparison result.
[0176] In some embodiments, the function building module 72 is further used to obtain publisher information, wherein the publisher information includes a publisher's attention list, and the attention list is used to characterize attention behaviors between the publisher and other publishers;
[0177] Based on the attention list, the attention behaviors between publishers are converted into a publisher relationship matrix to obtain second association information, wherein each element in the publisher relationship matrix is used to indicate whether a publisher is associated with other publishers.
[0178] In some of the embodiments, the function construction module 72 is further used to determine the similarity comparison result according to whether one of the training samples and another of the training samples are published by the same publisher, and whether the publisher corresponding to one of the training samples and the publisher corresponding to another of the training samples are similar.
[0179] In some embodiments, the function construction module 72 is further used to determine whether two training samples are associated based on the first association information;
[0180] A first loss function is constructed according to that a first gap between predicted labels corresponding to two associated training samples is smaller than a first gap between predicted labels corresponding to two unassociated training samples.
[0181] In some embodiments, the function construction module 72 is further used to determine the community similarity of publishers corresponding to the two training samples based on the community division result;
[0182] A second loss function is constructed based on that a second gap between predicted labels corresponding to training samples published by two publishers with high community similarity is smaller than a second gap between predicted labels corresponding to training samples published by two publishers with low community similarity.
[0183] In some of the embodiments, the function construction module 72 is further used to represent the publisher with the nodes in the community division result, and obtain the number of connections between the nodes in the community division result;
[0184] The number of connections between all nodes in the community where the publishers corresponding to the two training samples are located is divided by the number of all nodes in the community to obtain the community similarity, where the community similarity is characterized by the sparsity of the number of connections between the communities where the publishers are located.
[0185] In some embodiments, the function building module 72 is further used to determine whether publishers corresponding to the two side stone samples are associated based on the second association information;
[0186] A third loss function is constructed based on that a third gap between predicted labels corresponding to training samples published by two associated publishers is smaller than a third gap between predicted labels corresponding to training samples published by two unassociated publishers.
[0187] In some embodiments, the model training module 73 is further used to assign weights to the first loss function, the second loss function, and the third loss function respectively;
[0188] The first loss function, the second loss function, the third loss function and the product of their corresponding weights are added together, and combined with the model parameters and norms to construct a comprehensive loss function.
[0189] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0190] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0191] In this embodiment, an electronic device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0192] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0193] Optionally, in this embodiment, the processor may be configured to execute the following steps S1 to S6 through a computer program.
[0194] S1. Obtain training samples and the true labels corresponding to the training samples.
[0195] S2. Extract first association information between one of the training samples and another training sample in the training samples, and construct a first loss function based on the first association information.
[0196] S3. Divide the publishers corresponding to the training samples according to communities, obtain community division results, and construct a second loss function based on the community division results.
[0197] S4. Extract second association information between one of the publishers corresponding to the training sample and another publisher, and construct a third loss function based on the second association information.
[0198] S5. A comprehensive loss function is constructed according to the first loss function, the second loss function, and the third loss function, and a multi-level sentiment classifier is trained with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model.
[0199] S6. Perform sentiment classification on the text to be identified through the text sentiment classification model and determine the classification result.
[0200] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.
[0201] In addition, in combination with the method provided in the above embodiment, a storage medium can also be provided in this embodiment to implement the method. The storage medium stores a computer program; when the computer program is executed by the processor, any multi-level analysis method for text sentiment classification in the above embodiment is implemented.
[0202] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer executes each function or step executed by the processor in the above method embodiment.
[0203] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.
[0204] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.
[0205] The term "embodiment" in this application refers to a specific feature, structure or characteristic described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various locations in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.
[0206] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.
Claims
1. A multi-level analysis method for text sentiment classification, characterized in that: The method comprises: Obtaining training samples and true labels corresponding to the training samples; Extracting first association information between one of the training samples and another training sample in the training samples, and constructing a first loss function based on the first association information; Dividing publishers corresponding to the training samples according to communities to obtain community division results, and constructing a second loss function based on the community division results; Extracting second association information between one of the publishers corresponding to the training sample and another publisher, and constructing a third loss function based on the second association information; A comprehensive loss function is constructed according to the first loss function, the second loss function, and the third loss function, and a multi-level sentiment classifier is trained with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model; The text sentiment classification model is used to perform sentiment classification on the text to be identified, and a classification result is determined.
2. The multi-level analysis method for text sentiment classification according to claim 1, characterized in that: The extracting first association information between one of the training samples and another training sample in the training samples includes: Extracting a similarity comparison result between a publisher corresponding to one of the training samples and a publisher corresponding to another training sample in the training samples; The first association information between the two training samples is determined according to the similarity comparison result.
3. The multi-level analysis method for text sentiment classification according to claim 1, characterized in that: The extracting second association information between one of the publishers corresponding to the training sample and another publisher includes: Acquire publisher information, wherein the publisher information includes a publisher's attention list, and the attention list is used to characterize attention behaviors between the publisher and other publishers; Based on the attention list, the attention behaviors between publishers are converted into a publisher relationship matrix to obtain second association information, wherein each element in the publisher relationship matrix is used to indicate whether a publisher is associated with other publishers.
4. The multi-level analysis method for text sentiment classification according to claim 2, characterized in that: The extracting a similarity comparison result between a publisher corresponding to one of the training samples and a publisher corresponding to another training sample includes: A similarity comparison result is determined according to whether one of the training samples and another of the training samples are published by the same publisher, and whether a publisher corresponding to one of the training samples and a publisher corresponding to another of the training samples are similar.
5. The multi-level analysis method for text sentiment classification according to claim 1 or claim 2, characterized in that: The constructing a first loss function based on the first association information includes: Determining whether the two training samples are associated based on the first association information; A first loss function is constructed according to that a first gap between predicted labels corresponding to two associated training samples is smaller than a first gap between predicted labels corresponding to two unassociated training samples.
6. The multi-level analysis method for text sentiment classification according to any one of claims 1 to 4, characterized in that: The constructing a second loss function based on the community division result includes: Determine the community similarity of publishers corresponding to the two training samples based on the community division result; A second loss function is constructed based on that a second gap between predicted labels corresponding to training samples published by two publishers with high community similarity is smaller than a second gap between predicted labels corresponding to training samples published by two publishers with low community similarity.
7. The multi-level analysis method for text sentiment classification according to claim 6 is characterized in that: The determining, based on the community division result, the community similarity of publishers corresponding to the two training samples comprises: Using nodes in the community division result to represent publishers, obtaining the number of connections between nodes in the community division result; The number of connections between all nodes in the community where the publishers corresponding to the two training samples are located is divided by the number of all nodes in the community to obtain the community similarity, wherein the community similarity is characterized by the sparsity of the number of connections between the communities where the publishers are located.
8. The multi-level analysis method for text sentiment classification according to any one of claims 1 to 4, characterized in that: The constructing a third loss function based on the second association information includes: Determining whether publishers corresponding to the two training samples are associated based on the second association information; A third loss function is constructed according to that a third gap between the predicted labels corresponding to the training samples published by two associated publishers is smaller than a third gap between the predicted labels corresponding to the training samples published by two unassociated publishers.
9. The multi-level analysis method for text sentiment classification according to any one of claims 1 to 4, characterized in that: The comprehensive loss function is constructed according to the first loss function, the second loss function, and the third loss function, including: Assign weights to the first loss function, the second loss function, and the third loss function respectively; The first loss function, the second loss function, the third loss function and the product of their corresponding weights are added together, and combined with model parameters and norms to construct a comprehensive loss function.
10. A multi-level analysis device for text sentiment classification, characterized in that: include: A sample acquisition module is used to acquire training samples and true labels corresponding to the training samples; A function construction module, used for extracting first association information between one of the training samples and another training sample in the training samples, and constructing a first loss function based on the first association information; Dividing publishers corresponding to the training samples according to communities to obtain community division results, and constructing a second loss function based on the community division results; Extracting second association information between one of the publishers corresponding to the training sample and another publisher, and constructing a third loss function based on the second association information; A model training module is used to construct a comprehensive loss function according to the first loss function, the second loss function, and the third loss function, and train a multi-level sentiment classifier with the goal of minimizing the comprehensive loss function to obtain a text sentiment classification model; The model application module is used to perform sentiment classification on the text to be identified through the text sentiment classification model and determine the classification result.
11. A terminal comprising a memory, a processor and a display screen, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the multi-level analysis method for text sentiment classification according to any one of claims 1 to 9.
12. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the multi-level analysis method for text sentiment classification according to any one of claims 1 to 9 when running.
Citation Information
Patent Citations
Multi-label classification model training method and device, medium and equipment
CN116992061A
Text sentiment classification method and system based on aspect semantic enhancement
CN117112790A