Multi-level comment analysis method based on vertical field detection
By building Weibo crawler and deep learning models, multi-level analysis of Weibo comment data is achieved, and the problem of limited stance analysis content in the existing technology is solved, and more comprehensive user stance analysis and public opinion trend prediction is provided.
Patent Information
- Application Number
- CN202411318533.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-09-20
AI Technical Summary
The existing stance analysis technology is difficult to provide decision makers with public concerns and public opinion trends, and the analysis content given by the model is relatively limited.
Using a multi-level comment analysis method based on position detection, multi-level analysis of Weibo comment data is realized by constructing Weibo crawler and deep learning models, including word cloud analysis, time series analysis, gender analysis and geolocation analysis.
It provides a more comprehensive user position analysis to help decision makers better understand the public's concerns and public opinion trends, and continuously optimize the accuracy of the position detection model through user feedback.
Smart Images

Figure CN119415759A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a multi-level comment analysis method based on stance detection, and belongs to the technical field of data mining and natural language processing. Background Art
[0002] As one of the most active and open social platforms, Weibo has a huge user base and high user stickiness, making it a major platform for people to express their opinions and views. Users can enter the community in a variety of ways and express their opinions in a variety of ways, the most common of which are text and emoticons. These text data usually contain users' subjective inclinations towards news, products, policies, services, etc., and have high analytical value, which can provide decision makers with data on the concerns and opinions of the majority of users.
[0003] The initial analysis method was to use some simple algorithms to automatically process data, but with the continuous development of computer hardware and algorithms, machine learning and deep learning technologies began to be applied in information analysis. Machine learning mainly uses support vector machines and naive Bayes, etc., and deep learning mainly uses long short-term memory neural networks and convolutional neural networks, etc. Due to the excellent performance of deep learning algorithms, stance detection tasks usually use deep learning models.
[0004] Current stance analysis usually explores whether an individual user supports, opposes, or is neutral about a topic. The analysis provided by the model is relatively limited, and it is difficult to provide decision makers with the public's focus and public opinion trends. For this reason, a system is needed to process and display user comment stance data from multiple levels. Summary of the invention
[0005] The purpose of the present invention is to provide a multi-level comment analysis method based on stance detection, providing users with stance-based word cloud analysis, stance-based time series analysis, stance-based gender analysis, and stance-based geographic location analysis. This method can automatically crawl comment data on Weibo for processing and collection, and can construct a new data set based on user feedback on comment stances, further improving the accuracy of stance detection models and promoting the development of the stance detection field.
[0006] The present invention adopts the following technical solutions to solve the above technical problems:
[0007] The present invention provides a multi-level comment stance analysis method based on stance detection, and the specific steps are as follows:
[0008] Step 1: Build a Weibo crawler
[0009] 1.1, Get the public proxy IP and user agent (User-Agent) in the network, and use the Scrapy framework to build the proxy IP pool and user agent pool. The Scrapy asynchronous crawler framework can crawl data efficiently, and each module has good scalability;
[0010] 1.2, Analyze the Ajax request of the Weibo hot list page, and construct the Ajax request of each Weibo text and the corresponding Weibo comment according to the returned data;
[0011] 1.3, get the user's cookie, and use the cookie as the parameter of the Weibo comment Ajax request in 1.2. The rest of the Ajax requests in 1.2 can be sent directly;
[0012] 1.4, Weibo comments are loaded dynamically, so it is necessary to construct a page turning request. According to the Weibo comment Json data obtained in 1.4, an Ajax request for comment page turning is constructed;
[0013] 1.5, data cleaning, remove duplicates, special symbols, remove URLs from the collected data, and convert emoticons in Weibo into text;
[0014] 1.6, Data storage, all crawled data is written to the MySQL database in an asynchronous manner through Scrapy's pipeline, which can maximize the efficiency of the crawler and reduce the impact of data storage on the crawling speed.
[0015] Step 2: Model building and position analysis
[0016] 2.1, concatenate the microblog comments and microblog topics to get the model input sequence X = {x1, x2, ..., x n}, get EmbeddingH through Bert processing BERT ,in represents the contextual encoding representation of the input sequence X obtained by the BERT model, n is the sequence length, and d0 is the hidden layer dimension of Bert;
[0017] H BERT =BERT(X)
[0018] 2.2, Using Mamba to H BERT Modeling long-range dependencies, where It represents the output representation after the Mamba layer, and d1 is the output dimension of the Mamba layer;
[0019] H Mamba =Liner(Mamba(H BERT )
[0020] 2.3, contextual global information modeling is performed through bidirectional LSTM (BiLSTM), where and are the outputs of the forward and backward LSTMs, respectively. is the concatenated BiLSTM output,
[0021] d2 represents the hidden layer dimension after concatenation;
[0022]
[0023] 2.4, Modeling long-distance dependencies H Mamba and context modeling H BiLSTM In one dimension, the multi-head attention mechanism extracts the main key information from multiple levels, among which, is the weight matrix, d k is the dimension of each head, d in is the dimension of the input, is the output of the multi-head attention mechanism, and d3 is the output dimension of the attention mechanism;
[0024] X=H BiLSTM +H Mamba
[0025] Q=XW Q ,K=XW K ,V=XW V
[0026]
[0027] H Att =MultiHead(Q,K,V)=Concat(head1,…,head h )W O
[0028] 2.5, in order to retain low-level semantic information and prevent overfitting, the present invention adopts the residual structure fusion H BERT and H Att , the final fusion representation H Fusion Input to the fully connected layer, where is the final output of the model, d out is the dimension size of the output;
[0029] H Fusion =H BERT +H Att
[0030] O=FC(H Fusion )
[0031] 2.6. The loss function finally used in this paper is the cross entropy loss function. During training, Adam optimization is adopted and DropOut is added to the model.
[0032] 2.7, after training is completed, the system will read the data stored in 1.6 from the MySQL database and use the model to predict the stance label for each comment. The model uses the Mamba architecture, is good at processing long-distance dependencies, and retains information at different semantic levels through a multi-level residual structure. After the data is processed, the results will be fully written back to the MySQL database.
[0033] Step 3: Conduct a multi-level analysis of review positions
[0034] 3.1, Render the Weibo article data and Weibo comment data in the MySQL database to the front-end page through the Djnago3 template syntax. Users can select topics of interest, and add a paging function at the bottom of the page;
[0035] 3.2, Word cloud analysis based on stance. 3.1 After the user selects a topic, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The comments of the three stances are divided into words one by one through the Jieba word library, and the stop word list is used to remove redundant words. If the front end initiates an Ajax request, the four types of word graphs are returned to the front end in Json format, and the loading progress bar is displayed before receiving the Json data. This method can improve the user experience;
[0036] 3.3, time series analysis based on stance. After the user selects a topic in 3.1, all comment data under the topic is read out and classified into supporters, opponents and neutrals. The three types of comments are sorted from small to large according to the release time, and the number of users with three stances at each time point is counted. If the front end initiates an Ajax request, the stance data based on the time series is returned to the front end in Json format, and a loading progress bar is displayed before the Json data is received. This method can improve the user experience;
[0037] 3.4, gender analysis based on stance. After the user selects a topic in 3.1, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The number of men and women in each category is counted separately. If the front end initiates an Ajax request, the gender analysis data based on stance is returned to the front end in Json format, and a loading progress bar is displayed before the Json data is received. This method can improve the user experience;
[0038] 3.5, Geographic location analysis based on stance. After the user selects a topic in 3.1, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The number of people with three types of stances in each region is counted separately. If the front end initiates an Ajax request, the geographic location stance analysis data is returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data. This method can improve the user experience;
[0039] Step 4: Crawling data management and user feedback processing
[0040] 4.1, in 3.1, Weibo article data and Weibo comment data are displayed on the front end. If the user is not satisfied with the comment position marked by the model in step 2, he can click Feedback to fill in the position that the user thinks is correct. The feedback data will be summarized in the administrator interface and decided by the administrator. The feedback data marked by the administrator can be exported to facilitate the continued training of the model in step 2;
[0041] 4.2, for the data stored in MySQL in 1.6, a unified data dashboard is provided in the administrator interface. The data dashboard supports search, page turning, data addition, deletion, modification and other services;
[0042] As a further optimization scheme of the present invention, the software environment of the method is Django3 Web framework, Scrapy crawler framework and Python3.7 with a data analysis and processing package installed.
[0043] As a further optimization solution of the present invention, the front-end charts of different standpoints are dynamically loaded, and the back-end processes the data and returns it to the front-end in Json format, and then displays a loading progress bar before receiving the Json data. This method can improve the user experience.
[0044] As a further optimization solution of the present invention, the position data returned by the user will be summarized to the administrator, waiting for the administrator to finally decide the position of the comment.
[0045] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects: a multi-level comment analysis method and system based on stance detection is constructed, which can provide stance-based word cloud analysis, stance-based time series analysis, stance-based gender analysis and stance-based geographic location analysis, and provide users with multi-level stance analysis comments to facilitate users to make decisions, which has good commercial value. At the same time, the method can expand the existing stance detection data set based on user feedback on the stance of the comment, further improve the accuracy of the stance detection model, and has good academic value. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1A schematic diagram of a multi-level review analysis method and system based on stance detection;
[0047] Figure 2-1 Schematic diagram of the function of displaying comment stance data;
[0048] Figure 2-2 Schematic diagram of word cloud analysis function based on stance;
[0049] Figure 2-3 Schematic diagram of the position-based time series analysis function;
[0050] Figure 2-4 Schematic diagram of gender analysis functions based on stance;
[0051] Figure 2-5 Schematic diagram of the comment stance feedback processing function;
[0052] Figure 3 Structure diagram of stance detection model;
[0053] Figure 4 The crawled comment data;
[0054] Figure 5 Flowchart of Weibo crawler;
[0055] Figure 6 Flowchart of the stance detection model;
[0056] Figure 7 Flowchart of the multi-level stance analysis system. DETAILED DESCRIPTION
[0057] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention and to make the above-mentioned purposes, features and advantages of the embodiments of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
[0058] Example 1: See Figure 1 ,The multi-level comment analysis method and system based on stance detection has the following steps:
[0059] Step 1: Build a Weibo crawler
[0060] 1.1, obtain the public proxy IP and user agent (User-Agent) in the network, and use the Scrapy framework to build a proxy IP pool and user agent pool;
[0061] 1.2, Analyze the Ajax request of the Weibo hot list page, and construct the Ajax request of each Weibo text and the corresponding Weibo comment according to the returned data;
[0062] 1.3, get the user's cookie, and use the cookie as the parameter of the Weibo comment Ajax request in 1.2. The rest of the Ajax requests in 1.2 can be sent directly;
[0063] 1.4, Weibo comments are loaded dynamically, so it is necessary to construct a page turning request. According to the Weibo comment Json data obtained in 1.4, an Ajax request for comment page turning is constructed;
[0064] 1.5, data cleaning, remove duplicates, special symbols, remove URLs from the collected data, and convert emoticons in Weibo into text;
[0065] 1.6, Data storage, all crawled data is written to the MySQL database in an asynchronous manner through Scrapy's pipeline, which can maximize the efficiency of the crawler and reduce the impact of data storage on the crawling speed;
[0066] Step 2: Model building and position analysis
[0067] 2.1, concatenate the microblog comments and microblog topics to get the model input sequence X = {x1, x2, ..., x n}, get EmbeddingH through Bert processing BERT ,in represents the contextual encoding representation of the input sequence X obtained by the BERT model, n is the sequence length, and d0 is the hidden layer dimension of Bert;
[0068] H BERT =BERT(X)
[0069] 2.2, Using Mamba to H BERT Modeling long-range dependencies, where It represents the output representation after the Mamba layer, and d1 is the output dimension of the Mamba layer;
[0070] H Mamba =Liner(Mamba(H BERT ))
[0071] 2.3, contextual global information modeling is performed through bidirectional LSTM (BiLSTM), where and are the outputs of the forward and backward LSTMs, respectively. is the concatenated BiLSTM output,
[0072] d2 represents the hidden layer dimension after concatenation;
[0073]
[0074]
[0075] 2.4, Modeling long-distance dependencies H Mamba and context modeling H BiLSTM In one dimension, the multi-head attention mechanism extracts the main key information from multiple levels, among which, is the weight matrix, d k is the dimension of each head, d in is the dimension of the input, is the output of the multi-head attention mechanism, and d3 is the output dimension of the attention mechanism;
[0076] X=H BiLSTM +H Mamba
[0077] Q=XW Q ,K=XW K ,V=XW V
[0078]
[0079] H Att =MultiHead(Q,K,V)=Concat(head1,…,head h )W O
[0080] 2.5, in order to retain low-level semantic information and prevent overfitting, the present invention adopts the residual structure fusion H BERT and H Att , the final fusion representation H Fusion Input to the fully connected layer, where is the final output of the model, d out is the dimension size of the output;
[0081] H Fusion =H BERT +H Att
[0082] O=FC(H Fusion )
[0083] 2.6. The loss function finally used in this paper is the cross entropy loss function. During training, Adam optimization is adopted and DropOut is added to the model.
[0084] 2.7, after training is completed, the system will read the data stored in 1.6 from the MySQL database and use the model to predict the stance label for each comment. The model uses the Mamba architecture, is good at processing long-distance dependencies, and retains information at different semantic levels through a multi-level residual structure. After the data is processed, the results will be fully written back to the MySQL database;
[0085] Step 3: Conduct a multi-level analysis of review positions
[0086] 3.1, Render the Weibo article data and Weibo comment data in the MySQL database to the front-end page through the Djnago3 template syntax. Users can select topics of interest, and add a paging function at the bottom of the page;
[0087] 3.2, Word cloud analysis based on stance. 3.1 After the user selects a topic, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The comments of the three stances are divided into words one by one through the Jieba word library, and the stop word list is used to remove redundant words. If the front end initiates an Ajax request, the four types of word graphs are returned to the front end in Json format, and the loading progress bar is displayed before receiving the Json data. This method can improve the user experience;
[0088] 3.3, time series analysis based on stance. After the user selects a topic in 3.1, all comment data under the topic is read out and classified into supporters, opponents and neutrals. The three types of comments are sorted from small to large according to the release time, and the number of users with three stances at each time point is counted. If the front end initiates an Ajax request, the stance data based on the time series is returned to the front end in Json format, and a loading progress bar is displayed before the Json data is received. This method can improve the user experience;
[0089] 3.4, gender analysis based on stance. After the user selects a topic in 3.1, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The number of men and women in each category is counted separately. If the front end initiates an Ajax request, the gender analysis data based on stance is returned to the front end in Json format, and a loading progress bar is displayed before the Json data is received. This method can improve the user experience;
[0090] 3.5, Geographic location analysis based on stance. After the user selects a topic in 3.1, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The number of people with three types of stances in each region is counted separately. If the front end initiates an Ajax request, the geographic location stance analysis data is returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data. This method can improve the user experience;
[0091] Step 4: Crawling data management and user feedback processing
[0092] 4.1, in 3.1, Weibo article data and Weibo comment data are displayed on the front end. If the user is not satisfied with the comment position marked by the model in step 2, he can click Feedback to fill in the position that the user thinks is correct. The feedback data will be summarized in the administrator interface and decided by the administrator. The feedback data marked by the administrator can be exported to facilitate the continued training of the model in step 2;
[0093] 4.2, for the data stored in MySQL in 1.6, a unified data dashboard is provided in the administrator interface. The data dashboard supports search, page turning, data addition, deletion, modification and other services;
[0094] The software environment of this method is Django3 Web framework, Scrapy crawler framework and Python3.7 with data analysis package installed. The charts of different stance analysis on the front end are all loaded dynamically. The stance data returned by the user will be summarized to the administrator, waiting for the administrator to finally decide the stance of the comment. Specific embodiment:
[0096] The schematic diagram of the multi-level comment analysis method and system based on stance detection proposed in the present invention is as follows: Figure 1 As shown in the figure. The figure mainly consists of three parts: data crawling, stance detection model and system function. The core of the data crawling part is dynamic loading content processing, which mainly responds to the anti-crawler mechanism and provides efficient and stable data collection functions. The stance detection part mainly provides an efficient stance detection model to mark the stance of the crawled Weibo comments. The system function part mainly provides users with multi-level and fast stance analysis services.
[0097] Figure 2-1 Comment position data display function, Figure 2-2 Word cloud analysis function based on stance, Figure 2-3 Position-based time series analysis function, Figure 2-4 Gender analysis function based on standpoint, Figure 2-5 Comment stance feedback processing function.
[0098] Experimental environment: The computer configuration is Intel(R) processor (3.2GHz) and 8GB random access memory (RAM), Windows10 64-bit operating system. The software environment is; Django3 Web framework, Scrapy crawler framework and Python3.7 with data analysis and processing package installed.
[0099] Experimental steps:
[0100] The experimental steps are divided into three parts: Figure 5 , Figure 6 and Figure 7 shown.
[0101] Figure 5 The process of Weibo crawler is as follows:
[0102] 101. Build a proxy IP proxy pool and a user proxy pool. First, collect free proxy IPs from major websites, conduct usability tests on the obtained IPs, and write the available IPs into the IP proxy pool. Obtain the open user agent (User-Agent) on the Internet and write it into the user agent pool;
[0103] 102. Dynamically loaded content processing. For data dynamically loaded using ajax in web pages, you need to analyze the URL parameters first. For public URL addresses, directly send a request to obtain the returned JSON data. For comment URL addresses that require user cookies, send a request with user cookies, and splice the page-turning URL address based on the fields in the obtained JSON, and continue crawling until there are no new comments;
[0104] 103. Clean the crawled data uniformly, convert all URL addresses embedded in Weibo into text, and convert all emoticons into text;
[0105] 104. Data persistence. All the processed data in 103 are written to the MySQL database asynchronously through the Scrapy pipeline, which can maximize the efficiency of the crawler and reduce the impact of data storage on the crawling speed;
[0106] Figure 6 The flowchart of the stance detection model implemented by the present invention is as follows:
[0107] 201. Construct and train a stance detection model. The structure of the stance detection model constructed by the present invention is as follows: Figure 3 As shown, the embedding is mainly constructed based on the Bert model, the Mamba model is used to establish long-distance dependencies, and the BiLSTM is used to build context sequence modeling. The present invention is trained on a public data set and retains the weight with the best F1 index. ;
[0108] 202. Load the stance detection model. Load the best model trained in 201;
[0109] 203. Process the data in the database. Read the comment data stored in the database in 104, and concatenate the topic name and the comment content as the input of the stance detection model in 202. After the stance detection model gives the marked stance, the data is written into the MySQL data. Repeat marking the comments until all the data is marked;
[0110] Figure 6 The flowchart of the multi-level position analysis system implemented by the present invention is as follows:
[0111] 301. Comment position data display. The Weibo article data and Weibo comment data in the MySQL database are rendered to the front-end page through the Djnago3 template syntax. Users can select topics of interest, and a paging function is added at the bottom of the page. ;
[0112] 302. Comment stance feedback processing. In 301, if the user is not satisfied with the comment stance marked by the model, he can click Feedback to fill in the stance that the user thinks is correct. The feedback data will be summarized in the administrator interface and the administrator will make the decision. The feedback data marked by the administrator can be exported to facilitate the continued training of the stance detection model in step 201;
[0113] 303. Word cloud analysis based on stance. After the user selects a topic in 301, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The comments of the three stances are divided into words one by one through the Jieba word library, and the stop word list is used to remove redundant words. If the front end initiates an Ajax request, the four types of word graphs are returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data. This method can improve the user experience;
[0114] 304. Time series analysis based on stance. After the user selects a topic in 301, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The three types of comments are sorted from small to large according to the release time, and the number of users with three stances at each time point is counted. If the front end initiates an Ajax request, the stance data based on time series is returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data;
[0115] 305. Gender analysis based on stance. After the user selects a topic in 301, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The number of males and females in each category is counted separately. If the front end initiates an Ajax request, the gender analysis data based on stance is returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data;
[0116] 306. Geographic location analysis based on stance. After the user selects a topic in 301, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The number of people with three types of stances in each region is counted separately. If the front end initiates an Ajax request, the geographic location stance analysis data is returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data;
[0117] The above is a preferred implementation mode of the present experiment. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that it is still possible to modify the technical solutions described in the aforementioned embodiments, or to make equivalent replacements for some of the technical features therein; and these modifications or replacements should also be regarded as the scope of protection of the present invention.
Claims
1. A multi-level review analysis method based on stance detection, characterized in that: The method comprises the following steps: Step 1, build a Weibo crawler; Step 2, construct model and position analysis; Step 3, conduct a multi-level analysis of the review stance; Step 4: crawl data management and user feedback processing.
2. The multi-level comment analysis method based on stance detection as claimed in claim 1, characterized in that: Step 1: Build a Weibo crawler, as follows: 1.1, obtain the public proxy IP and user agent (User-Agent) in the network, and use the Scrapy framework to build a proxy IP pool and user agent pool; 1.2, Analyze the Ajax request of the Weibo hot list page, and construct the Ajax request of each Weibo text and the corresponding Weibo comment according to the returned data; 1.3, get the user's cookie, use the cookie as the parameter of the Weibo comment Ajax request in step 1.2, and send the rest of the Ajax requests in step 1.2 directly; 1.4, Weibo comments are loaded dynamically, so it is necessary to construct a page turning request. According to the Weibo comment Json data obtained in 1.4, an Ajax request for comment page turning is constructed; 1.5, data cleaning, remove duplicates, special symbols, remove URLs from the collected data, and convert emoticons in Weibo into text; 1.6, Data storage, all crawled data is written to the MySQL database in an asynchronous manner through Scrapy's pipeline.
3. The multi-level comment analysis method based on stance detection as claimed in claim 1, characterized in that: Step 2, build the model and position analysis, as follows: 2.1, concatenate the microblog comments and microblog topics to get the model input sequence X = {x1, x2, ..., x n }, get EmbeddingH through Bert processing BERT ,in represents the contextual encoding representation of the input sequence X obtained by the BERT model, n is the sequence length, and d0 is the hidden layer dimension of Bert; H BERT =BERT(X) 2.2, Using Mamba to H BERT Modeling long-range dependencies, where It represents the output representation after the Mamba layer, and d1 is the output dimension of the Mamba layer; H Mamba =Liner(Mamba(H BERT ) 2.3, contextual global information modeling is performed through bidirectional LSTM (BiLSTM), where and are the outputs of the forward and backward LSTMs, respectively. is the concatenated BiLSTM output, d2 represents the hidden layer dimension after concatenation; 2.4, Modeling long-distance dependencies H Mamba and context modeling H BiLSTM In one dimension, the multi-head attention mechanism extracts the main key information from multiple levels, among which, is the weight matrix, d k is the dimension of each head, d in is the dimension of the input, is the output of the multi-head attention mechanism, and d3 is the output dimension of the attention mechanism; X=H BiLSTM +H Mamba Q=XW Q ,K=XW K ,V=XW V H Att =MultiHead(Q,K,V)=Concat(head1,…,head h )W O 2.5, in order to retain low-level semantic information and prevent overfitting, the present invention adopts the residual structure fusion H BERT and H Att , the final fusion representation H Fusion Input to the fully connected layer, where is the final output of the model, d out is the dimension size of the output; H Fusion =H BERT +H Att O=FC(H Fusion ) 2.
6. The loss function finally used in this paper is the cross entropy loss function. During training, Adam optimization is adopted and DropOut is added to the model. 2.
7. After the training is completed, the system will read the data stored in step 1.6 from the MySQL database and use the model to predict the stance label for each comment. The model adopts the Mamba architecture, is good at processing long-distance dependencies, and retains information at different semantic levels through a multi-level residual structure. After the data is processed, the results will be written back to the MySQL database in full.
4. The multi-level comment analysis method based on stance detection as claimed in claim 1, characterized in that: Step 3: Conduct a multi-level analysis of the review stance, as follows: 3.1, Render the Weibo article data and Weibo comment data in the MySQL database to the front-end page through the Djnago3 template syntax, and the user selects the topic of interest, and the paging function is added at the bottom of the page; 3.2, Word cloud analysis based on stance. 3.1 After the user selects a topic, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The comments of the three stances are divided into words one by one through the Jieba word library, and the stop word list is used to remove redundant words. If the front end initiates an Ajax request, the four types of word graphs are returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data. 3.3, time series analysis based on stance. After the user selects a topic in 3.1, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The three types of comments are sorted from small to large according to the release time, and the number of users with three stances at each time point is counted. If the front end initiates an Ajax request, the stance data based on time series is returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data. 3.4, gender analysis based on stance. After the user selects a topic in 3.1, all the comment data under the topic is read out and classified into supporters, opponents and neutrals. The number of males and females in each category is counted respectively. If the front end initiates an Ajax request, the gender analysis data based on stance is returned to the front end in Json format. A loading progress bar is displayed before receiving the Json data. 3.5, Geographic location analysis based on stance. After the user selects a topic in 3.1, all comment data under the topic is read out and classified into supporters, opponents and neutrals. The number of people with three types of stances in each region is counted separately. If the front end initiates an Ajax request, the geographic location stance analysis data is returned to the front end in Json format, and a loading progress bar is displayed before receiving the Json data.
5. The multi-level comment analysis method based on stance detection as claimed in claim 1, characterized in that: Step 4: crawl data management and user feedback processing, as follows: 4.
1. In 3.1, both Weibo article data and Weibo comment data are displayed on the front end. If the user is not satisfied with the comment position marked by the model in step 2, click Feedback to fill in the position that the user thinks is correct. The feedback data will be summarized in the administrator interface, and the administrator will decide whether to export the feedback data marked by the administrator to facilitate the continued training of the model in step 2. 4.2, for the data stored in MySQL in 1.6, a unified data dashboard is provided in the administrator interface, which supports search, page turning, and data addition, deletion, modification and query services.
Citation Information
Patent Citations
Microblog rumor standpoint detection method based on hierarchical attention
CN108804608A
Sample vertical field detection method and device based on hierarchical comparative learning
CN116414979A
Automatically generating training data sets for object recognition
US20210406595A1