A policy announcement network comment sentiment analysis method, system and device
By constructing a fine-grained sentiment dictionary and a user classification model for online platforms, and combining semantic dependency algorithms and N-Gram language models for word segmentation, the problem of sentiment analysis in the field of policy announcements has been solved, achieving efficient and accurate sentiment detection and public opinion early warning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING YUNCHUANG NETWORK INFORMATION TECH CO LTD
- Filing Date
- 2022-08-31
- Publication Date
- 2026-07-03
AI Technical Summary
Existing technologies struggle to perform fine-grained sentiment analysis in the field of policy announcements. Traditional word segmentation methods are ill-suited for handling ambiguity, and supervised learning methods rely on extensive data annotation and have poor fitting results, failing to effectively reflect netizens' reactions to government affairs.
We construct a fine-grained sentiment dictionary, combine semantic dependency algorithm, graph search algorithm and N-Gram language model for word segmentation, and conduct multi-dimensional sentiment analysis through a zero-shot learning network platform user classification and recognition model, and integrate like weighting rules to improve the accuracy of analysis.
It achieves efficient and fine-grained sentiment detection and public opinion early warning for policy announcements and comments, which can truly reflect netizens' emotions, improve word segmentation efficiency and semantic restoration accuracy, reduce human intervention, and adapt to the complex analysis needs in the online context.
Smart Images

Figure CN115238709B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of text data mining and text sentiment analysis, and relates to a method, system and device for network comment sentiment analysis, in particular to a method, system and device for sentiment analysis of policy announcement-related netizen comments based on a fine-grained sentiment dictionary. Background Art
[0002] With the development of Internet big data and text mining technologies, it has become possible to monitor the real-time sentiment of a large number of people on the Internet. Currently, researchers have developed a variety of online software or tools directly applicable to obtaining information on the types or dimensions of network sentiment. For example, the online software "Opinion-Finder" and "Linguistic Inquiry and Word Count" (LIWC), but few can meet the actual analysis needs of network government public opinion. Previous Chinese sentiment dictionaries such as the Dalian University of Technology Sentiment Lexical Ontology, Hownet Sentiment Dictionary, and NTUSD Sentiment Dictionary all have the disadvantages of relatively coarse granularity and difficulty in applying the corpus to network scenarios. Especially for the analysis of policy announcement comments, previous dictionaries are difficult to support the analysis work due to domain or industry differences. To accurately and comprehensively reflect the responses of netizens to government affairs, a new fine-grained sentiment dictionary needs to be established.
[0003] In the prior art, traditional word segmentation methods such as jieba word segmentation are mostly used for word segmentation. The application of jieba word segmentation is extensive, but it is difficult to solve ambiguity situations (for example, the word segmentation of "正在解决" may be "正解 / 决" or "正 / 解决"). Previous word segmentation schemes such as jieba word segmentation need to rely on a stop word dictionary to exclude meaningless stop words in the word segmentation results, and additionally perform negative word valence matching to handle reverse expressions. This not only increases the work of manual intervention but also easily loses language information.
[0004] Previous classification of online platform users often employed supervised learning methods such as logistic regression and neural network learning. This relies heavily on large amounts of labeled data, making feature extraction and selection complex and ambiguous, and the fitting effect difficult to control. For example, a user classification method and server (authorization announcement number: CN105701498A). Previous industry or field sentiment analysis patents primarily focused on the analytical perspectives of "object, attribute," "attribute, evaluation," and "attribute, sentiment." Examples include a fine-grained sentiment analysis system and method for product review information (authorization announcement number: CN103207855B), a fine-grained sentiment analysis model construction method, device, and readable storage medium (authorization announcement number: CN108647205B), a fine-grained sentiment analysis method for industry review data (authorization announcement number: CN104268197B), and a sentiment analysis method and device for movie reviews (authorization announcement number: CN109684647B). This solution, however, analyzes online public opinion in the policy announcement field from the perspective of the "online platform user category, sentiment" binary pair and the correlation with other dimensions.
[0005] This invention differs from previous coarse-grained sentiment analysis methods. It constructs a novel fine-grained sentiment dictionary tailored to the characteristics of natural language in online contexts, formulates a series of sentiment analysis rules including a weighted 'like' rule, and performs multi-dimensional, fine-grained sentiment analysis using a zero-shot learning-based user classification and recognition model for online platforms. Furthermore, this solution proposes a novel word segmentation method integrating semantic dependency algorithms, graph search algorithms, and N-Gram language models to address the problems of current word segmentation methods. Compared to existing technologies, this word segmentation method not only automatically excludes meaningless words and has high segmentation efficiency, but also identifies negative collocations, resulting in higher semantic fidelity. Summary of the Invention
[0006] To address the aforementioned technical problems, this invention provides a method, system, and device for sentiment analysis of online comments on policy announcements, used for fine-grained sentiment detection and public opinion early warning of online comments on policy announcements.
[0007] The technical solution adopted by the method of the present invention is: a method for sentiment analysis of online comments on policy announcements, comprising the following steps:
[0008] Step 1: For the policy announcement to be analyzed, obtain the text data associated with the policy announcement from the online platform;
[0009] The policy announcements to be analyzed are determined based on the number of online comments on the policy announcements, or subjectively determined based on the analyst's analytical needs.
[0010] Step 2: Preprocess the collected text data, including removing noise data;
[0011] Regular expressions are used to match and remove irrelevant noise data. Irrelevant noise data mainly includes marketing advertisements, celebrity supertopics, and irrelevant URLs.
[0012] Step 3: Segment the preprocessed comment text from Step 2 using a word segmentation method that integrates semantic dependency algorithm, graph search algorithm and N-Gram language model;
[0013] The specific implementation of the word segmentation method of this invention includes the following sub-steps:
[0014] Step 3.1: Use the SDP / DEP semantic dependency algorithm to map the text data into a graph structure and generate a semantic dependency graph for sentences or passages;
[0015] Step 3.2: Use both Depth-First Search (SFS) and Breadth-First Search (BFS) algorithms to search for suitable linguistic units (LUs) on the semantic dependency graph. Each linguistic unit (LU) is a word segmentation result.
[0016] The depth-first search (SFS) algorithm moves from a starting node to an ending node, and then repeats the search along different paths from the same starting node until the answer is found.
[0017] The breadth-first search (BFS) algorithm searches by exploring one layer at a time, starting with the node one layer deeper than the starting node, then the node at depth two, then the node at depth three, and so on, until the entire graph has been traversed.
[0018] Step 3.3: The N-Gram language model can be used to compute the language unit LU={W1,W2,…W n The N-Gram language model is used to select language units LU={W1,W2,…W1} according to the principle of maximizing joint probability. n}; P (W 1:n ) represents the joint probability, specifically expressed as:
[0019] ;
[0020] W k It is a word unit in a language unit group, k is the order of word units, n is the upper bound of k, k=1,2,…,n;
[0021] The relationship between a sentence and its group of language units satisfies a Markov relation. Language units LU={W1,W2,…W2} can be selected according to the principle of maximizing joint probability. n}, where each word unit W k They are not necessarily interconnected.
[0022] Step 4: Use a network platform user classification model to identify network platform users whose information overlaps with policy announcements;
[0023] Step 4.1 Based on the large amount of user homepage information collected from online platforms, user categories on online platforms are labeled according to the tagging system and an artificial dataset is established;
[0024] Based on the collected user homepage information from several online platforms, user categories on the online platforms were labeled according to a pre-set tagging system, and an artificial dataset was established.
[0025] The user homepage information of the network platform includes three types: user name, platform identification attributes, and user-defined description. The platform identification attributes can be divided into authentication status, membership level, number of followers, and industry category. The user-defined description can be divided into user description, user profile, and user tags.
[0026] The network platform user identity category and network platform user professional field category are both predefined first-level categories, and second-level categories are further predefined based on these.
[0027] A knowledge base of online platform users related to policy announcements will be established based on manually labeled data to serve as the artificial dataset for the classification model. The primary label categories that need to be manually labeled include the online platform user identity category, the online platform user's professional field category, and the secondary labels attached to the primary labels.
[0028] Step 4.2 Construct a network platform user classification model using artificial datasets and natural language text, which will then be used to identify the network platform user categories in the dataset to be analyzed;
[0029] The network platform user classification model consists of a sentence transformation model SBERT, a word transformation model word2vec, and a zero-shot learning classifier.
[0030] For the text features of user name, user description, user profile, and user tags, the SBERT sentence transformation model is used to transform them into 768-dimensional feature vectors;
[0031] For the primary and secondary category data of network platform users, the word transformation model word2vec is used to transform them into feature vectors of different dimensions.
[0032] Predefined tag category names are usually very short phrases, so word2vec is used for vectorization;
[0033] The outputs of the sentence transformation model SBERT and the word transformation model word2vec are used as language quantization representations, and a zero-shot learning classifier is used to identify the user types of the online platform. ;
[0034] ;
[0035] Where X is the projection of the SBERT feature vectors of user name, user description, profile content, and user tag text into the word vector space; Y is the word2vec word vector of the first-level and second-level category names of the network platform user; W is the matrix parameter, λ is a fixed constant, and I is the identity matrix;
[0036] For the data to be analyzed, the corresponding network platform user categories can be identified by applying a pre-trained network platform user classification model.
[0037] Step 5: Perform sentiment analysis based on the constructed fine-grained sentiment lexicon and sentiment analysis rules;
[0038] Sentiment analysis is performed on the comment text to be analyzed based on the constructed fine-grained sentiment lexicon and sentiment analysis rules, including the following sub-steps:
[0039] Step 5.1: Construct a fine-grained sentiment dictionary based on a semi-automated dictionary construction scheme;
[0040] First, a fine-grained emotion classification system was designed based on social psychology. The 50 emotion categories in the fine-grained emotion classification system are as follows: admiration, happiness, optimism, satisfaction, expectation, liking, belief, praise, blessing, gratitude, emotion, sadness, criticism, frustration, depression, jealousy, annoyance, anger, loneliness, anxiety, tension, fear, contempt, disappointment, helplessness, decadence, grievance, panic, shyness, guilt, disgust, doubt, depression, resentment, inferiority complex, sarcasm, numbness, questioning, embarrassment, relaxation, surprise, alertness, excitement, pride, calmness, longing, sympathy, boredom, anxiety, and indifference.
[0041] Secondly, the accumulated corpus of comments in the field of government affairs is segmented using the word segmentation method of this scheme to obtain word segmentation data, and a fine-grained sentiment seed lexicon is constructed through "sentiment classification, expansion based on external dictionaries or thesaurus, and manual screening".
[0042] Finally, external media and commentary corpora were used as source corpora for expanded vocabulary; based on the fine-grained sentiment seed lexicon, the lexicon was expanded using LU language unit groups, and supplemented with online emoticon and phrase structure rules, and finally constructed a fine-grained sentiment lexicon after manual correction.
[0043] Step 5.2: Match the comment text to be analyzed with a fine-grained sentiment dictionary, and calculate the sentiment score of netizens based on sentiment analysis rules, including sentiment score calculation rules and like weighted score calculation rules; calculate the sentiment score of each category of sentiment in the overall network platform user comments; compare the fine-grained sentiment of different categories of network platform users under a certain topic policy announcement, or combine it with other dimensions for cross analysis;
[0044] The aforementioned category of emotions i Emotional score ;in, T For emotions i The number of comments that were hit; For emotions i In the k The number of hits on the comments L ik The weighted score for the likes corresponding to this comment is calculated; if the same term appears in different comments, it is counted separately for each comment.
[0045] The weighted score of likes for each individual comment for:
[0046] ;
[0047] in, M It is an adjustment factor. M When ≤0, the formula has no practical application. M A value greater than 140 results in a weighted result that exceeds a reasonable range and approaches an extreme value. M The range of values for is defined as (0, 140]; It is the number of likes a single comment receives. ; It is the base of the logarithmic function and In this embodiment, we take the commonly used logarithm, that is, let... .
[0048] The sum of the emotion scores for the different categories of emotions E i = ;in, S i It is an emotion category i The emotional score, N It represents the total number of emotion categories.
[0049] Step 5.3: Conduct cross-analysis based on network platform user categories, fine-grained sentiment, and other dimensions, and visualize the analysis results: Cross-analysis includes cross-analysis within the <network platform user category, fine-grained sentiment> binary in policy announcements and netizens' comments, and cross-analysis between the <network platform user category, fine-grained sentiment> binary and other dimensions; Other dimensions include time, IP location, etc.
[0050] The technical solution adopted by the system of this invention is: a policy announcement online comment sentiment analysis system based on a fine-grained sentiment dictionary, comprising the following modules:
[0051] Module 1 is used to obtain text data related to the policy announcement to be analyzed from the online platform;
[0052] Module 2 is used to preprocess the collected text data and remove irrelevant noise data;
[0053] Module 3 is used to segment the preprocessed comment text from Module 2.
[0054] Module 4 is used to identify online platform users whose information overlaps with policy announcements using an online platform user classification model;
[0055] The network platform user classification model consists of a sentence transformation model SBERT, a word transformation model word2vec, and a zero-shot learning classifier.
[0056] Module 5 is used to perform sentiment analysis on the comment text to be analyzed based on the constructed fine-grained sentiment lexicon and sentiment analysis rules.
[0057] The technical solution adopted by the device of the present invention is: a sentiment analysis device for online comments on policy announcements, comprising:
[0058] One or more processors;
[0059] A storage device for storing one or more programs, which, when executed by one or more processors, enable the one or more processors to implement the policy announcement online comment sentiment analysis method.
[0060] This invention differs from previous methods of classifying and analyzing positive and negative sentiment. It constructs a fine-grained sentiment dictionary for natural language texts related to policy announcements, taking into account the characteristics of netizens' expressions in online commentary contexts. From the perspective of actual word segmentation results, it constructs a word segmentation method that integrates semantic dependency algorithms, graph search algorithms, and N-Gram language models. Based on previously common sentiment score calculation rules, it incorporates a like-weighted rule to better reflect the characteristics of netizens' expressions and authentically reflect social mentality. Finally, it identifies user types on online platforms through a user classification and identification model, and performs multi-dimensional sentiment analysis.
[0061] This invention's fundamental research in areas such as online sentiment analysis, online public opinion monitoring, and government governance can provide relevant institutions or departments with insights and suggestions for government practice, helping policymakers and issuers to better listen to public opinion and interact with the public. Furthermore, this invention can provide a research foundation for other related text mining and analysis studies, enabling more timely, comprehensive, and effective identification and analysis of online sentiment in the field of government communication. Attached Figure Description
[0062] Figure 1 This is a flowchart illustrating a method for sentiment analysis of online comments on policy announcements according to an embodiment of the present invention.
[0063] Figure 2 This is a sentence-level semantic dependency graph according to an embodiment of the present invention;
[0064] Figure 3 This is a document-level semantic dependency graph according to an embodiment of the present invention;
[0065] Figure 4 This is a schematic diagram of the depth-first search algorithm according to an embodiment of the present invention;
[0066] Figure 5 This is a schematic diagram of the breadth-first search algorithm according to an embodiment of the present invention;
[0067] Figure 6 This is a structural diagram of the zero-shot learning model according to an embodiment of the present invention;
[0068] Figure 7 This is a structural diagram of the network platform user classification and recognition model according to an embodiment of the present invention. Detailed Implementation
[0069] To facilitate understanding and implementation of the present invention by those skilled in the art, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0070] Please see Figure 1This invention provides a method for sentiment analysis of online comments on policy announcements, comprising the following steps:
[0071] Step 1: For the policy announcement to be analyzed, obtain the text data associated with the policy announcement from the online platform.
[0072] The associated text data includes comment text, body text, user information, time, IP address, etc.; user information includes user name, platform-identified attributes, and user-defined descriptions.
[0073] This embodiment can take recent policy announcements with high public participation as the analysis object, and judge the public participation of policy announcements based on the number of online comments on policy announcement information. Keywords related to "policy / announcement" can be selected to obtain the number of comments on policy announcement information on the Internet, and the trend of time change can be used for analysis.
[0074] Furthermore, this embodiment can collect text data to be analyzed in a targeted manner according to the analyst's analytical needs: mainly by setting combined keywords under a certain topic, determining specific website links, and determining topic tags to collect text data to be analyzed.
[0075] Step 2: Preprocess the collected text data to remove irrelevant noise data.
[0076] In this embodiment, regular expressions are used to match and remove irrelevant data; irrelevant data mainly includes noisy data such as marketing advertisements, celebrity supertopics, and irrelevant URLs.
[0077] A regular expression is a logical formula composed of ordinary characters and regular expression metacharacters; a regular expression can be used to describe or match a series of strings that conform to a certain syntax rule, and to filter strings.
[0078] Step 3: Perform word segmentation on the preprocessed comment text from Step 2.
[0079] In this embodiment, a word segmentation method is constructed based on semantic dependency relations, graph search algorithms, and the N-Gram language model. First, the semantic space statistical features of semantic dependencies are obtained through large-scale news corpora and online comment corpora. Then, the optimal combination of words is found based on the conditional probability maximization method, and word phrases are obtained.
[0080] Conventional word segmentation methods are dictionary-based, first dividing the sentence into words according to the dictionary, and then finding the best combination of words, such as the conditional probability method. However, the same word can have different meanings in different sentences, or different semantic combinations of words in the same sentence (e.g., "no taste," "convenience store," "pediatrician," "faint smell"). Conventional dictionary-based word segmentation methods introduce interference and are difficult to meet real-world analysis needs. This solution is based on the idea that language units (LUs) obey the law of large numbers in spatial statistics, meaning that the expression of a language unit (LU) must be adopted by many speakers and documents to become an accepted word segment. The spatial statistical characteristics of language units appearing in different texts constitute the mathematical principle of this word segmentation algorithm.
[0081] The word segmentation method of this invention consists of three steps.
[0082] The first step is to use the SDP / DEP semantic dependency algorithm to map the relationships in a text into a graph structure, generating a semantic dependency graph based on the text (examples of sentence-level and document-level semantic dependency graphs can be found separately). Figure 2 , Figure 3 A relational graph consists of vertices and edges. The relationship between any two vertices can be represented by an edge. The vertex set is finite and non-empty, while the edge set can be empty.
[0083] The second step involves generating a semantic dependency graph for the text to be analyzed using the SDP / DEP semantic dependency algorithm. Then, two graph search algorithms, depth-first search (SFS) and breadth-first search (BFS), are used to search for suitable word segmentation results, i.e., language units (LUs), on the semantic dependency graph.
[0084] Please see Figure 4 The SFS algorithm, based on the Last-In-First-Out (LIFO) stack concept, performs a top-down traversal search, with numerical indices indicating the search order. The SFS algorithm moves from a starting node to an ending node, then repeats the search along different paths from the same starting node until the answer is found. SFS is a suitable choice for attempting to discover discrete information and is also suitable for general graph traversal. For semantically rich graphs, informed search is allowed; if no compatible outgoing nodes are found, the search can be terminated early. Therefore, informed search has a shorter execution time and higher efficiency.
[0085] Please see Figure 5 The BFS algorithm is based on the first-in-first-out queue concept to perform a layer-by-layer traversal search, with the numerical sequence number indicating the search order. The BFS algorithm searches one layer at a time, starting with the node one layer deeper than the starting node, then the node at depth two, then the node at depth three, and so on, until the entire graph has been traversed.
[0086] The third step is to use the N-Gram language model to select appropriate language units LU={W1,W2,…W} based on the principle of maximizing joint probability, for the set of language units {LU} obtained by the graph search algorithm described above. n};
[0087] This embodiment calculates the joint probability based on the N-Gram language model. P (W 1:n And select the language unit LU={W1,W2,…W1} according to the principle of maximizing probability. n}, P (W 1:n Specifically, it is expressed as:
[0088] ;
[0089] W k W represents a word unit in a language unit group, where k is the order of the word units, and n is an upper bound of k, where k = 1, 2, ..., n; the relationship between a sentence and its language unit group satisfies a Markov relation, where each word W... k They are not necessarily connected together; the probability of generating the k-th word unit can be determined by the k-1 words that have already been generated.
[0090] Through the above steps, the text to be analyzed is divided into several commonly used word combinations with high semantic fidelity. In particular, the above steps can obtain word combinations of "negation words + sentiment words," and meaningless stop words can be automatically excluded, ensuring the accuracy of word segmentation and semantic fidelity.
[0091] Step 4: Use a network platform user classification model to identify network platform users who have overlap with policy announcements.
[0092] Specifically, it includes the following sub-steps:
[0093] Step 4.1 Based on the large amount of user homepage information collected from online platforms, user categories on online platforms are labeled according to the tag system and an artificial dataset is established.
[0094] This embodiment uses collected user homepage information from several online platforms to label user categories according to a pre-set tagging system and establishes an artificial dataset.
[0095] A network platform user classification model was constructed using artificial datasets and natural language text, which was then used to identify the network platform user categories in the dataset to be analyzed.
[0096] The homepage information of users on social networking sites is extracted, and user characteristics are determined based on the homepage information. The specific classification is shown in Table 1.
[0097] Table 1
[0098]
[0099] To meet the analytical needs, a predefined tagging system for network platform users was developed, and manual annotation was performed based on the accumulated network platform user data. The new tag categories that need to be manually annotated include: network platform user type, and primary and secondary category tags of the professional fields to which network platform users belong. A knowledge base of network platform users related to policy announcements was established based on the manually annotated tag data as a manual dataset. Logically, each primary category tag is independent of the others, and secondary category tags belonging to the primary category tags are listed in parallel internally. The classification system and annotation basis are shown in Table 2.
[0100] Table 2
[0101]
[0102] The labeling of user identity categories on online platforms can be based on the homepage information of all users on the online platform; however, there is no logical connection between "the professional field category of the online platform user" and certain homepage information (such as the number of followers, membership level, etc.).
[0103] Step 4.2 Build a network platform user classification model using artificial datasets and natural language text, which will then be used to identify the network platform user categories in the dataset to be analyzed.
[0104] The network platform user classification model in this embodiment is a classification model based on the zero-shot learning principle. The structure of the zero-shot learning model can be seen... Figure 6 During the training phase, the sample data and semantic auxiliary information (user name, user description, profile content, user tags) of the network platform user classification and annotation are encoded into vectors, and the learner is trained based on these vectors. During the testing phase, the test data is input, the semantic auxiliary information of the test class is encoded, and the information obtained during the training process is combined to output the predicted category. Finally, the nearest predicted category is identified through similarity comparison.
[0105] Specifically, during the training phase, a bidirectional mapping from the text to the feature subspace is constructed using auxiliary information from the training class to determine its feature representation (Feature 1). Then, based on the correspondence between the training examples and the text feature representations in the auxiliary information, a mapping function is trained to obtain the feature representation. During the testing phase, a bidirectional mapping from the test class to the feature subspace (Feature 3) is constructed based on the auxiliary information from the test class. Then, the mapping function from the training phase is used to map the test examples to the feature subspace to obtain the feature representation (Feature 2). Finally, similarity discrimination is performed to determine the classification. Furthermore, semantic auxiliary information can play a linking role between the training and test sets, enabling the datasets to share feature subspaces.
[0106] The network platform user classification model in this embodiment consists of a sentence transformation model (SBERT–sentence BERT), a word transformation model (word2vec), and a zero-shot learning classifier; the structure of the network platform user classification model is shown below. Figure 7 .
[0107] For the text features of user name, user description, profile content, and user tags, the SBERT sentence transformation model is used to transform them into 768-dimensional feature vectors;
[0108] For the primary and secondary category data of network platform users, the word transformation model word2vec is used to transform them into feature vectors of different dimensions.
[0109] The outputs of the sentence transformation model SBERT and the word transformation model word2vec are used as language quantization representations, and a zero-shot learning classifier is used to identify the user types of the online platform. ;
[0110] ;
[0111] Where X is the projection of the SBERT feature vectors of user name, user description, profile content, and user tag text into the word vector space; Y is the word2vec word vector of the first-level and second-level categories of the network platform user; W is the matrix parameter, λ is a fixed constant, and I is the identity matrix;
[0112] For the data to be analyzed, the corresponding network platform user categories can be identified by applying a pre-trained network platform user classification model.
[0113] Step 5: Perform sentiment analysis on the comment text to be analyzed using the constructed fine-grained sentiment lexicon.
[0114] Step 5.1: Construct a fine-grained sentiment dictionary suitable for online contexts.
[0115] Social psychology theory posits that social emotion is a core element of social mentality with a dynamic tendency, representing an experience shared by the majority of members of a group and society. This proposal first designs a fine-grained emotion classification system from the perspective of social mentality, based on social psychology theory. The system includes 50 emotions as follows: admiration, happiness, optimism, satisfaction, expectation, liking, belief, praise, blessing, gratitude, emotion, sadness, criticism, frustration, depression, jealousy, annoyance, anger, loneliness, anxiety, tension, fear, contempt, disappointment, helplessness, decadence, grievance, panic, shyness, guilt, disgust, doubt, depression, resentment, inferiority complex, sarcasm, numbness, questioning, embarrassment, relaxation, surprise, alertness, excitement, pride, calmness, longing, sympathy, boredom, anxiety, and indifference.
[0116] Secondly, based on the word segmentation method proposed in this scheme, 200GB of government affairs commentary texts crawled from online platforms were segmented to form an initial seed lexicon. Furthermore, C-LIWC dictionary, Hownet dictionary, Sogou input method lexicon, QQ input method lexicon, Baidu input method lexicon, and Xinhua online language dictionary were used as extended sources for the initial seed lexicon. The word2vec word vector tool was used to calculate the semantic similarity of Chinese words, and 10 synonyms were queried for each seed word. A formal seed lexicon was then established through manual screening and classification.
[0117] Finally, external media and commentary corpora were used as the source corpora for expanding the vocabulary, specifically including the Fudan University News Corpus and 5 million Weibo posts from the Beijing Institute of Technology Search and Mining Laboratory. Based on the formal seed lexicon, the lexicon was expanded using LU language unit groups and supplemented with rules for online emoticons and phrase structures. Finally, after manual correction, a semi-automated expanded fine-grained sentiment dictionary was constructed.
[0118] Step 5.2: Calculate the sentiment score of user comments on online platforms that intersect with policy announcements.
[0119] In this embodiment, a sentiment analysis is performed on the comment text to be analyzed based on the constructed fine-grained sentiment dictionary and sentiment analysis rules. The sentiment analysis rules include sentiment score calculation rules and like weighting rules. The fine-grained sentiment dictionary is used to match the comment text to be analyzed, and the sentiment score is calculated according to the sentiment analysis rules. The fine-grained sentiment of users of different categories of online platforms under a certain topic policy announcement is compared, or cross-analysis is performed in combination with other dimensions.
[0120] The aforementioned category of emotions i Emotional score ;in, T For emotions i The number of comments that were hit; For emotions i In the kThe number of hits on the comments L ik The weighted score for the likes corresponding to this comment is calculated; if the same term appears in different comments, it is counted separately for each comment.
[0121] This embodiment calculates the weighted score of a user's comment on a network platform using the following weighted score formula based on the Box-Cox transformation principle of statistical data. :
[0122] ;
[0123] in, M It is an adjustment factor. M When ≤0, the formula has no practical application. M A value greater than 140 results in a weighted result that exceeds a reasonable range and approaches an extreme value. M The range of values for is defined as (0, 140]; It is the number of likes a single comment receives. ); It is the base of the logarithmic function and In this embodiment, we take the commonly used logarithm, that is, let... .
[0124] The sum of the emotion scores for the different categories of emotions E i = ;in, S i It is an emotion category i The emotional score, N It represents the total number of emotion categories.
[0125] Step 5.3 Perform cross-analysis based on network platform user categories, fine-grained sentiment, and other dimensions, and visualize the analysis results.
[0126] Cross-analysis includes cross-analysis within the binary of "online platform user category, fine-grained sentiment category" in policy announcements and online comments, as well as cross-analysis between the binary of "online platform user category, fine-grained sentiment category" and other dimensions; other dimensions include time, IP location, etc.
[0127] The network platform user classification and recognition model used in this embodiment is a pre-trained network platform user classification and recognition model. During training, a training set and a test set of data were first constructed.
[0128] This embodiment can statistically analyze the absolute and relative numbers of the items involved in the analysis.
[0129] This embodiment can combine the results of network platform user classification and identification with other user identity information to analyze the static distribution and time trend of fine-grained emotional expression in online comments of different categories of network platform users and network platform users with different IP locations, and make comparisons.
[0130] This embodiment can provide an overall description and comparative analysis of fine-grained sentiment in policy announcement comments, statistically analyze and rank the sentiment scores of each fine-grained element in netizens' comments, and can also describe the changing trends by combining time data;
[0131] This embodiment analyzes the distribution of fine-grained sentiment in comments on a certain type of policy announcement. The percentage of a fine-grained sentiment score = the total score of that fine-grained sentiment / the sum of the scores of all sentiments. The changing trend of the percentage of fine-grained sentiment scores can also be described by combining time data.
[0132] It should be noted that cross-analysis is not limited to the intersection of the above two dimensions, but can be used for complex multi-dimensional analysis.
[0133] This embodiment utilizes a computer program to construct a sentiment analysis visualization system for performing sentiment analysis, descriptive statistics, and result visualization. Visualization graphics include pie charts, bar charts, column charts, area charts, line charts, radar charts, Sankey diagrams, word clouds, and other combinations thereof. Visualized data dimensions include network platform user categories, fine-grained sentiment categories, and other dimensions (time trends, user IP location, etc.).
[0134] This invention provides fundamental research in areas such as online sentiment analysis, online public opinion monitoring, and government governance. It offers insights and suggestions for relevant institutions and departments in their government practices, helping policymakers and issuers to better listen to public opinion and interact with the public. Furthermore, this invention lays the foundation for further research in other related text mining and analysis, enabling more timely, comprehensive, and effective identification and analysis of online sentiment in the field of government communication.
[0135] It should be understood that the above description of the preferred embodiments is quite detailed, but it should not be considered as a limitation on the scope of protection of this invention. Those skilled in the art, under the guidance of this invention, can make substitutions or modifications without departing from the scope of protection of the claims of this invention, and all such substitutions or modifications fall within the scope of protection of this invention. The scope of protection of this invention should be determined by the appended claims.
Claims
1. A method for sentiment analysis of online comments on policy announcements, characterized in that, Includes the following steps: Step 1: For the policy announcement to be analyzed, obtain the text data associated with the policy announcement from the online platform; Step 2: Preprocess the collected text data to remove irrelevant noise data; Step 3: Perform word segmentation on the preprocessed comment text from Step 2 to obtain the comment text to be analyzed; The word segmentation is performed according to a word segmentation method, and its specific implementation includes the following sub-steps: Step 3.1: Use the SDP or DEP semantic dependency algorithm to map the text data into a graph structure and generate a semantic dependency graph for the text data to be analyzed; Step 3.2: Use both Depth-First Search (SFS) and Breadth-First Search (BFS) algorithms to search for suitable linguistic units (LUs) on the semantic dependency graph. Each linguistic unit (LU) is a word segmentation result. Step 3.3: Use the N-Gram language model and select language units LU={W1,W2,…W1} according to the principle of maximizing joint probability. n }; P (W 1:n ) represents the joint probability, specifically expressed as: ; wherein W k is a word unit in a language unit group, k is the arrangement order of the word unit, n is the upper limit of k, k = 1, 2, …, n; the relationship between each sentence and its language unit group satisfies a Markov relationship, and the language unit LU = {W1, W2, …, W n} is selected according to the principle of maximum joint probability; and each word unit W k is not necessarily connected together. Step 4: Use a network platform user classification model to identify network platform users whose information overlaps with policy announcements; The network platform user classification model consists of a sentence transformation model SBERT, a word transformation model word2vec, and a zero-shot learning classifier. Step 5: Perform sentiment analysis on the comment text to be analyzed based on the constructed fine-grained sentiment lexicon and sentiment analysis rules; A fine-grained sentiment dictionary is built based on a semi-automated construction scheme to match the comment text to be analyzed, and sentiment scores are calculated using sentiment analysis rules.
2. The method for sentiment analysis of online comments on policy announcements according to claim 1, characterized in that: The policy announcements to be analyzed in step 1 are determined based on the number of online comments on the policy announcements, or subjectively determined based on the analyst's analytical needs.
3. The method for sentiment analysis of online comments on policy announcements according to claim 1, characterized in that: The removal of irrelevant noise data in step 2 involves using regular expressions to match and remove unrelated noise data.
4. The method for sentiment analysis of online comments on policy announcements according to claim 1, characterized in that: Step 4, which involves using a network platform user classification model to identify network platform users whose information overlaps with policy announcements, specifically includes the following sub-steps: Step 4.1 Based on the large amount of user homepage information collected from online platforms, user categories on online platforms are labeled according to the tagging system and an artificial dataset is established; Based on the collected homepage information of users from several online platforms, the categories of users on the online platforms are labeled according to a pre-set tagging system and an artificial dataset is established. Based on the artificial dataset and natural language text, an online platform user classification model is constructed and used to identify the categories of online platform users in the dataset to be analyzed. The user homepage information of the network platform includes user name, platform identification attributes, and user-defined description. The platform identification attributes include authentication status, membership level, number of followers, and industry category. The user-defined description includes user description, profile content, and user tags. The user categories of the network platform include identity category and professional field category, which are both predefined primary categories, and secondary categories are further predefined based on these. Step 4.2 Construct a network platform user classification model based on artificial datasets and natural language text, and use it to identify the network platform user categories in the dataset to be analyzed; The network platform user classification model consists of a sentence transformation model, a word transformation model (word2vec), and a zero-shot learning classifier. For the text features of user name, user description, profile content, and user tags, the SBERT sentence transformation model is used to transform them into 768-dimensional feature vectors; For the predefined primary and secondary categories of network platform users, the word transformation model word2vec is used to transform them into feature vectors of different dimensions. The outputs of the sentence transformation model SBERT and the word transformation model word2vec are used as language quantization representations, and a zero-shot learning classifier is used to identify the user types of the online platform. ; ; Where X is the projection of the SBERT feature vectors of the user name, user description, profile content, and user tag text onto the word vector space; Y is the word2vec word vector of the first-level and second-level predefined category tags of the network platform user; W is the matrix parameter, λ is a fixed constant, and I is the identity matrix.
5. The method for sentiment analysis of online comments on policy announcements according to claim 1, characterized in that: In step 5, sentiment analysis is performed on the comment text to be analyzed based on the constructed fine-grained sentiment lexicon and sentiment analysis rules, including the following sub-steps: Step 5.1: Construct a fine-grained sentiment dictionary based on a semi-automated dictionary construction scheme; Step 5.2: Match the comment text to be analyzed with a fine-grained sentiment dictionary, and calculate the sentiment score using sentiment analysis rules; the sentiment analysis rules include sentiment score calculation rules and like-weighted score calculation rules; Step 5.3: Perform cross-analysis based on network platform user categories, fine-grained sentiment, and other dimensions, and visualize the analysis results: Cross-analysis includes cross-analysis within the <network platform user category, fine-grained sentiment> binary in policy announcements and netizens' comments, and cross-analysis between the <network platform user category, fine-grained sentiment> binary and other dimensions; the other dimensions include time and IP location.
6. The method for sentiment analysis of online comments on policy announcements according to claim 5, characterized in that: In step 5.1, a fine-grained emotion classification system is first designed based on social psychology, which includes the following 50 emotion categories: admiration, happiness, optimism, satisfaction, expectation, liking, belief, praise, blessing, gratitude, emotion, sadness, criticism, frustration, depression, jealousy, annoyance, anger, loneliness, anxiety, tension, fear, contempt, disappointment, helplessness, decadence, grievance, panic, shyness, guilt, disgust, doubt, depression, resentment, inferiority complex, sarcasm, numbness, questioning, embarrassment, relaxation, surprise, alertness, excitement, pride, calmness, longing, sympathy, boredom, anxiety, and indifference. Secondly, based on accumulated word segmentation data in the government sector, external dictionaries or thesaurus, a fine-grained sentiment seed thesaurus is constructed through sentiment classification, expansion based on external dictionaries or thesaurus, and manual screening. Finally, using external media and commentary corpora as the source corpus for extended words, the corpus was expanded using LU language unit groups based on the seed corpus, and a semi-automated fine-grained sentiment dictionary was constructed after manual correction.
7. The method for sentiment analysis of online comments on policy announcements according to claim 5, characterized in that: In step 5.2, firstly, the text of the comment to be analyzed is matched with a fine-grained sentiment lexicon, and the weighted score of likes and the sentiment score of the comment are calculated according to the sentiment analysis rules; secondly, the sentiment scores are summarized and compared by users of different categories of online platforms, or cross-analysis is performed in combination with other dimensions; the formulas involved are as follows: ; in, S i For a certain category of emotion i The emotional score, T For emotions i The number of comments that were hit For emotions i In the k The number of hits on the comments L ik The weighted score for the likes corresponding to this comment; if the same term appears in different comments, it will be counted separately for each comment. ; in, It is the weighted score of likes for a single comment; M It is an adjustment factor. M When ≤0, the formula has no practical application. M A value greater than 140 results in a weighted result that exceeds a reasonable range and approaches an extreme value. M The range of values for is defined as (0, 140]; It is the number of likes a single comment receives. ; It is the base of the logarithmic function and ; ; in, E i It is the sum of the emotional scores for different categories of emotions. S i It is an emotion category i The emotional score, N It represents the total number of emotion categories.
8. A sentiment analysis system for online comments on policy announcements, characterized in that, Includes the following modules: Module 1 is used to obtain text data related to the policy announcement to be analyzed from the online platform; Module 2 is used to preprocess the collected text data; Module 3 is used to segment the preprocessed comment text from Module 2. Specific implementation Includes the following sub-modules: Submodule 3.1 is used to map text data into a graph structure using SDP or DEP semantic dependency algorithms, and to generate a semantic dependency graph for the text data to be analyzed. Submodule 3.2 is used to search for suitable linguistic units (LUs) on the semantic dependency graph using two graph search algorithms: depth-first search (SFS) and breadth-first search (BFS). Each linguistic unit (LU) is a word segmentation result. Submodule 3.3 is used to select language units LU={W1,W2,…W1} using the N-Gram language model and according to the principle of maximizing joint probability. n }; P (W 1:n ) represents the joint probability, specifically expressed as: ; Among them, W k Each sentence is a word unit within a language unit group, where k is the order of the word units, and n is an upper bound of k, where k = 1, 2, ..., n. The relationship between each sentence and its language unit group satisfies a Markov relation. Language units LU = {W1, W2, ..., Wn} are selected according to the principle of maximizing joint probability. n }; Each word unit W k They are not necessarily interconnected; Module 4 is used to identify online platform users whose information overlaps with policy announcements using an online platform user classification model; The network platform user classification model consists of a sentence transformation model SBERT, a word transformation model word2vec, and a zero-shot learning classifier. Module 5 is used to perform sentiment analysis on the comment text to be analyzed based on the constructed fine-grained sentiment lexicon and sentiment analysis rules.
9. A sentiment analysis device for online comments on policy announcements, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the policy announcement online comment sentiment analysis method as described in any one of claims 1 to 7.