Multi-level review analysis method based on stance detection

By constructing a multi-level comment analysis method, and using the Scrapy framework and deep learning models for Weibo data crawling and stance detection, the problem of insufficient stance analysis in existing technologies is solved, and multi-level stance analysis and model accuracy are improved to meet the needs of decision-makers.

CN119415759BActive Publication Date: 2025-12-05SOUTHEAST UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411318533.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-12-05
Estimated Expiration
2044-09-20

AI Technical Summary

Technical Problem

Existing position analysis methods are insufficient to comprehensively provide users' concerns and public opinion trends, and the model analysis content is limited, making it difficult to meet the needs of decision-makers.

Method used

A multi-level comment analysis method based on stance detection is constructed, including word cloud analysis, time series analysis, gender analysis, and geolocation analysis. Weibo data is crawled using the Scrapy framework, and stance detection is performed by combining BERT, Mamba, and BiLSTM models. The model accuracy is improved by multi-head attention mechanism and residual structure. User feedback data is used for model training.

Benefits of technology

It provides multi-level stance analysis, improves the accuracy of stance detection models and user experience, expands the dataset, meets the decision-makers' needs for analyzing public opinion trends and user concerns, and has commercial and academic value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415759B_ABST
    Figure CN119415759B_ABST
Patent Text Reader

Abstract

The application discloses a multi-level comment analysis method based on stance detection, and specifically as follows: comments published by users in a microblog are crawled, data cleaning is performed, and then a stance detection model constructed by the application is used to mark the comment stance. The application provides four kinds of analysis functions based on the stance, namely, a word cloud analysis based on the stance, a time sequence analysis based on the stance, a gender analysis based on the stance and a geographical position analysis based on the stance. According to the feedback of the user on the comment stance, the scheme can construct a new data set, and the new data set can be used to assist model training, so that the precision of the stance detection model is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application 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

[0002] As one of the active and open social platforms, microblog has a large user base and high user stickiness, and thus becomes a main platform for people to express their opinions and views. Users can enter the community in various ways and express their opinions in various ways, the most common of which are text and emoticons. These text data usually contain subjective inclinations of users on news, commodities, policies, services and the like, have high analysis value, and can provide data of attention points and opinions of the general public for decision makers.

[0003] The first analysis means is 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 begin to be applied in information analysis. Machine learning mainly uses support vector machines and naive Bayes, and deep learning mainly uses long short-term memory neural networks and convolutional neural networks. Due to the excellent performance of deep learning algorithms, the stance detection task usually uses a deep learning model.

[0004] Current stance analysis usually explores whether the stance expressed by a user on a topic is support, opposition or neutral. The analysis content given by the model is relatively limited, and it is difficult to provide the attention points and public opinion trends of the public for decision makers. Therefore, a system is needed to process and display user comment stance data from multiple levels. SUMMARY

[0005] The purpose of the application is to provide a multi-level comment analysis method based on stance detection, which provides users with a stance-based word cloud analysis, a stance-based time series analysis, a stance-based gender analysis and a stance-based geographic location analysis. This method can automatically crawl comment data on microblog for processing and collection, and can construct a new data set according to the feedback of users on the comment stance, further improve the accuracy of the stance detection model and promote the development of the stance detection field.

[0006] The application adopts the following technical solutions to solve the above technical problems:

[0007] The application provides a multi-level comment stance analysis method based on stance detection, and the specific steps are as follows:

[0008] Step 1, constructing a microblog crawler

[0009] 1.1, Get the public proxy IP and user agent in the network, build a proxy IP pool and a user agent pool using the Scrapy framework, and the Scrapy asynchronous crawler framework can efficiently perform data crawling, and each module has good scalability,

[0010] 1.2, analyze the microblog hot list page Ajax request, and construct an Ajax request for each microblog text and an Ajax request for the corresponding microblog comments according to the returned data;

[0011] 1.3, get the user's cookie, use the cookie as a parameter for the microblog comment Ajax request in 1.2, and send the remaining Ajax requests in 1.2 directly;

[0012] 1.4, microblog comments are dynamically loaded, so the request for flipping pages needs to be constructed, and the Ajax request for flipping pages of comments is constructed according to the microblog comment Json data obtained in 1.4;

[0013] 1.5, data cleaning, remove duplicates, special symbols, and URLs from the collected data, and convert the emoticons in the microblog to text;

[0014] 1.6, data storage, use the asynchronous method of Scrapy pipeline to write all the crawled data into the MySQL database, which can maximize the efficiency of the crawler and reduce the impact of data storage on the crawling speed.

[0015] Step 2, model construction and stance analysis

[0016] 2.1, concatenate the microblog comments and microblog topics to obtain the input sequence X = {x1, x2, …, xn} of the model, and obtain Embedding H n through Bert processing BERT , where represents the context encoding representation of the input sequence X obtained through 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, use Mamba to model the long-distance dependence of H BERT , where represents the output representation of 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 is modeled using a bidirectional LSTM (BiLSTM), where... and These are the outputs of the forward and reverse LSTM, respectively. The output of the spliced ​​BiLSTM is shown.

[0021] d2 represents the dimension of the hidden layer after concatenation;

[0022]

[0023] 2.4, Modeling Long-Distance Dependencies H Mamba and context modeling H BiLSTM In one dimension, information is superimposed and extracted from multiple levels using a multi-head attention mechanism, where... It is the weight matrix, d k It is the dimension of each head, d in For the input dimension, d3 represents the output of the multi-head attention mechanism, and d3 represents 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 To preserve low-level semantic information and prevent overfitting, this invention employs a residual structure to fuse H... BERT and H Att The final fusion represents H Fusion The input is fed into the fully connected layer, where, For the final output of the model, d out It refers to the size of the output dimension;

[0029] H Fusion =H BERT +H Att

[0030] O=FC(H Fusion )

[0031] 2.6 The loss function used in this paper is the cross-entropy loss function. During training, the Adam optimization method is adopted, and DropOut is added to the model.

[0032] 2.7 After training, 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 adopts the Mamba architecture, which excels at handling long-distance dependencies and preserves information at different semantic levels through a multi-level residual structure. After data processing, the results will be written back to the MySQL database in their entirety.

[0033] Step 3: Conduct multi-level analysis of commentary stances.

[0034] 3.1 The Weibo article data and Weibo comment data in the MySQL database are rendered onto the front-end page using Djnago3 template syntax. Users can select topics of interest, and pagination functionality is added to the bottom of the page.

[0035] 3.2, Position-Based Word Cloud Analysis. 3.1 After a user selects a topic, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The Jieba word segmentation library is used to divide the comments into individual words for each of the three positions, and a stop word list is used to remove redundant words. If the frontend initiates an Ajax request, the four types of word clouds are returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received. This approach improves the user experience.

[0036] 3.3, Time Series Analysis Based on Stance. After a user selects a topic in 3.1, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The comments of each type are then sorted by posting time from earliest to latest, and the number of users holding each stance at each time point is counted. If the frontend initiates an Ajax request, the time series-based stance data is returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received. This approach improves the user experience.

[0037] 3.4, Position-Based Gender Analysis. After a user selects a topic in 3.1, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The number of males and females in each category is counted separately. If the frontend initiates an Ajax request, the position-based gender analysis data is returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received. This approach improves the user experience.

[0038] 3.5, Location-Based Perspective Analysis. After a user selects a topic in 3.1, all comments under that topic are retrieved and categorized as supporters, opponents, and neutrals. The number of people holding each of the three perspectives is counted for each region. If the frontend initiates an Ajax request, the location-based perspective analysis data is returned to the frontend in JSON format, with a loading progress bar displayed until the JSON data is received. This approach improves the user experience.

[0039] Step 4: Crawled data management and user feedback processing

[0040] 4.1 In section 3.1, both Weibo article data and Weibo comment data are displayed on the front end. If a user is not satisfied with the comment stance marked by the model in step 2, they can click "Feedback" and fill in their opinion on the correct stance. The feedback data will be aggregated in the administrator interface, where the administrator will make the final decision. The feedback data marked by the administrator can be exported for further training of the model in step 2.

[0041] 4.2 For data stored in MySQL as described in 1.6, a unified data dashboard is provided in the administrator interface. The data dashboard supports services such as searching, pagination, and data CRUD operations.

[0042] As a further optimization of the present invention, the software environment of the method is the Django3 Web framework, the Scrapy web crawling framework, and Python 3.7 with data analysis and processing packages installed.

[0043] As a further optimization of this invention, the charts analyzing different perspectives on the front end are all dynamically loaded. After the back end processes the data, it 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.

[0044] As a further optimization of the present invention, the stance data returned by the user will be aggregated to the administrator, who will then make the final decision on the stance of the comment.

[0045] Compared with existing technologies, the present invention, employing the above technical solution, has the following technical advantages: It constructs a multi-level comment analysis method and system based on stance detection, which can provide stance-based word cloud analysis, stance-based time series analysis, stance-based gender analysis, and stance-based geographic location analysis. This provides users with multi-level stance analysis comments to facilitate decision-making and has significant commercial value. Furthermore, this method can expand the existing stance detection dataset based on user feedback on comment stances, further improving the accuracy of the stance detection model and thus possessing significant academic value. Attached Figure Description

[0046] Figure 1This is a schematic diagram of a multi-level comment analysis method and system based on stance detection;

[0047] Figure 2-1 A diagram illustrating the comment stance data display function;

[0048] Figure 2-2 A schematic diagram of the position-based word cloud analysis function;

[0049] Figure 2-3 A schematic diagram of position-based time series analysis functionality;

[0050] Figure 2-4 A schematic diagram of position-based gender analysis functionality;

[0051] Figure 2-5 A diagram illustrating the comment feedback processing function;

[0052] Figure 3 Stance detection model structure diagram;

[0053] Figure 4 The crawled comment data;

[0054] Figure 5 Flowchart of a Weibo crawler;

[0055] Figure 6 Flowchart of the stance detection model;

[0056] Figure 7 Flowchart of a multi-level position analysis system. Detailed Implementation

[0057] 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 objectives, features and advantages of the embodiments of the present invention more apparent and understandable, the technical solutions in the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0058] Example 1: See Figure 1 A multi-level comment analysis method and system based on stance detection, the specific steps of which are as follows:

[0059] Step 1: Build a Weibo crawler

[0060] 1.1 Obtain public proxy IPs and user agents in the network, and use the Scrapy framework to build a proxy IP pool and a user agent pool;

[0061] 1.2 Analyze the Ajax requests on the Weibo Hot List page, and construct the Ajax requests for each Weibo post and the corresponding Weibo comments based on the returned data;

[0062] 1.3 Obtain the user's cookie and use it as a parameter in the Weibo comment Ajax request in 1.2. Other Ajax requests can be sent directly.

[0063] 1.4 Since Weibo comments are dynamically loaded, a pagination request needs to be constructed. Based on the Weibo comment JSON data obtained in 1.4, an Ajax request for comment pagination is constructed.

[0064] 1.5 Data cleaning: The collected data is deduplicated, special characters are removed, URLs are removed, and emoticons in Weibo posts are converted into text;

[0065] 1.6 Data storage: By using Scrapy's pipeline to asynchronously write all crawled data to a MySQL database, the efficiency of the crawler can be maximized and the impact of data storage on crawling speed can be reduced.

[0066] Step 2, Model Building and Position Analysis

[0067] 2.1 The input sequence of the model is obtained by concatenating the Weibo comments and Weibo topics X = {x1, x2, ..., x}. n}, obtained by BERT processing, EmbeddingH BERT ,in This represents the context encoding representation of the input sequence X obtained through the BERT model, where 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 access H BERT Perform long-distance dependency modeling, where This represents the output representation after the Mamba layer, where d1 is the output dimension of the Mamba layer.

[0070] H Mamba =Liner(Mamba(H BERT ))

[0071] 2.3 Contextual global information is modeled using a bidirectional LSTM (BiLSTM), where... and These are the outputs of the forward and reverse LSTM, respectively. The output of the spliced ​​BiLSTM is shown.

[0072] d2 represents the dimension of the hidden layer after concatenation;

[0073]

[0074]

[0075] 2.4, Modeling Long-Distance Dependencies H Mamba and context modeling H BiLSTM In one dimension, information is superimposed and extracted from multiple levels using a multi-head attention mechanism, where... It is the weight matrix, d k It is the dimension of each head, d in For the input dimension, d3 represents the output of the multi-head attention mechanism, and d3 represents 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 To preserve low-level semantic information and prevent overfitting, this invention employs a residual structure to fuse H... BERT and H Att The final fusion represents H Fusion The input is fed into the fully connected layer, where, For the final output of the model, d out It refers to the size of the output dimension;

[0081] H Fusion =H BERT +H Att

[0082] O=FC(H Fusion )

[0083] 2.6 The loss function used in this paper is the cross-entropy loss function. During training, the Adam optimization method is adopted, and DropOut is added to the model.

[0084] 2.7 After training, 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 adopts the Mamba architecture, which excels at handling long-distance dependencies and preserves information at different semantic levels through a multi-level residual structure. After data processing, the results will be written back to the MySQL database in their entirety.

[0085] Step 3: Conduct multi-level analysis of commentary stances.

[0086] 3.1 The Weibo article data and Weibo comment data in the MySQL database are rendered onto the front-end page using Djnago3 template syntax. Users can select topics of interest, and pagination functionality is added to the bottom of the page.

[0087] 3.2, Position-Based Word Cloud Analysis. 3.1 After a user selects a topic, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The Jieba word segmentation library is used to divide the comments into individual words for each of the three positions, and a stop word list is used to remove redundant words. If the frontend initiates an Ajax request, the four types of word clouds are returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received. This approach improves the user experience.

[0088] 3.3, Time Series Analysis Based on Stance. After a user selects a topic in 3.1, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The comments of each type are then sorted by posting time from earliest to latest, and the number of users holding each stance at each time point is counted. If the frontend initiates an Ajax request, the time series-based stance data is returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received. This approach improves the user experience.

[0089] 3.4, Position-Based Gender Analysis. After a user selects a topic in 3.1, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The number of males and females in each category is counted separately. If the frontend initiates an Ajax request, the position-based gender analysis data is returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received. This approach improves the user experience.

[0090] 3.5, Location-Based Perspective Analysis. After a user selects a topic in 3.1, all comments under that topic are retrieved and categorized as supporters, opponents, and neutrals. The number of people holding each of the three perspectives is counted for each region. If the frontend initiates an Ajax request, the location-based perspective analysis data is returned to the frontend in JSON format, with a loading progress bar displayed until the JSON data is received. This approach improves the user experience.

[0091] Step 4: Crawled data management and user feedback processing

[0092] 4.1 In section 3.1, both Weibo article data and Weibo comment data are displayed on the front end. If a user is not satisfied with the comment stance marked by the model in step 2, they can click "Feedback" and fill in their opinion on the correct stance. The feedback data will be aggregated in the administrator interface, where the administrator will make the final decision. The feedback data marked by the administrator can be exported for further training of the model in step 2.

[0093] 4.2 For data stored in MySQL as described in 1.6, a unified data dashboard is provided in the administrator interface. The data dashboard supports services such as searching, pagination, and data CRUD operations.

[0094] The software environment for this method is the Django 3 web framework, the Scrapy web crawling framework, and Python 3.7 with data analysis packages installed. The charts analyzing different viewpoints on the front end are dynamically loaded. User-returned viewpoint data is aggregated and sent to the administrator, who then makes the final decision on the viewpoint of each comment. Specific implementation examples:

[0096] A schematic diagram of the multi-level comment analysis method and system based on stance detection proposed in this invention is shown below. Figure 1 As shown in the diagram, this system mainly consists of three parts: data crawling, a stance detection model, and system functionality. The core of the data crawling part is dynamic content loading, a mechanism primarily designed to counter anti-crawler mechanisms and provide efficient and stable data collection. The stance detection part mainly provides an efficient stance detection model to label the stance of crawled Weibo comments. The system functionality part primarily provides users with multi-layered and convenient stance analysis services.

[0097] Figure 2-1 Comment stance data display function Figure 2-2 Position-based word cloud analysis function Figure 2-3 Position-based time series analysis function Figure 2-4 Position-based gender analysis function Figure 2-5 Comment feedback processing function.

[0098] Experimental environment: The computer was configured with an Intel(R) processor (3.2GHz) and 8GB of RAM, running Windows 10 64-bit operating system. The software environment consisted of the Django 3 web framework, the Scrapy web crawling framework, and Python 3.7 with data analysis and processing packages installed.

[0099] Experimental steps:

[0100] The experimental procedure is divided into three parts, as follows: Figure 5 , Figure 6 and Figure 7 As shown.

[0101] Figure 5 The process of crawling Weibo is as follows:

[0102] 101. Construct a proxy IP pool and a user agent pool. First, collect free proxy IPs from various websites, perform availability tests on the obtained IPs, and add usable IPs to the IP proxy pool. Then, obtain publicly available user agents online and add them to the user agent pool.

[0103] 102. Dynamic Content Loading Handling. For data dynamically loaded via AJAX on web pages, the URL parameters need to be analyzed first. For public URLs, a request is sent directly to retrieve the returned JSON data. For comment URLs that require user cookies, the request is sent with the user's cookie, and the pagination URL is constructed based on the fields in the retrieved JSON. This process continues until no new comments are found.

[0104] 103. Clean the crawled data in a unified manner, convert all the URLs embedded in the Weibo posts into text, and also convert all the emoticons into text;

[0105] 104. Data Persistence. All the data processed in step 103 is asynchronously written to a MySQL database via Scrapy's pipeline. This maximizes the efficiency of the crawler and minimizes the impact of data storage on crawling speed.

[0106] Figure 6 The flowchart of the position detection model implemented in this invention is as follows:

[0107] 201. Constructing and training the stance detection model. The structure of the stance detection model constructed in this invention is as follows: Figure 3 As shown, the embedding is mainly built based on the BERT model, long-distance dependencies are established using the Mamba model, and contextual sequence modeling is constructed using BiLSTM. This invention is trained on a public dataset and retains the weight with the best F1 score.

[0108] 202. Load the stance detection model. Load the best-trained model from step 201;

[0109] 203. Process the data in the database. Read the comment data stored in the database (104), concatenate the topic name and comment content as input to the stance detection model (202). After the stance detection model assigns a stance, write the data to the MySQL database. Repeat the process of labeling comments until all data has been labeled.

[0110] Figure 6 The flowchart of the multi-level position analysis system implemented in this invention is as follows:

[0111] 301. Display of Comment Stance Data. Weibo post and comment data from the MySQL database are rendered onto the front-end page using Djnago3 template syntax. Users can select topics of interest, and pagination functionality is added to the bottom of the page.

[0112] 302. Comment Stance Feedback Processing. In step 301, if a user is dissatisfied with the comment stance marked by the model, they can click "Feedback" and fill in their preferred stance. Feedback data will be aggregated in the administrator interface for the administrator's decision. The feedback data marked by the administrator can be exported for continued training of the stance detection model in step 201.

[0113] 303. Position-Based Word Cloud Analysis. After the user selects a topic in step 301, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The Jieba word segmentation library is used to break down the comments into individual words for each position, and a stop word list is used to remove redundant words. If the frontend initiates an Ajax request, the four types of word clouds are returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received. This approach improves the user experience.

[0114] 304. Time Series Analysis Based on Stance. After a user selects a topic in step 301, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The comments of each type are sorted in ascending order of publication time, and the number of users holding each stance at each time point is counted. If the frontend initiates an Ajax request, the time series-based stance data is returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received.

[0115] 305. Position-Based Gender Analysis. After a user selects a topic in step 301, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The number of males and females in each category is counted separately. If the frontend initiates an Ajax request, the position-based gender analysis data is returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received.

[0116] 306. Position-Based Geographic Location Analysis. After a user selects a topic in step 301, all comment data under that topic is retrieved and categorized into supporters, opponents, and neutrals. The number of people holding each of the three position types in each region is counted. If the frontend initiates an Ajax request, the geographic location position analysis data is returned to the frontend in JSON format, with a loading progress bar displayed before the JSON data is received.

[0117] The above description is a preferred embodiment of this experiment. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions should also be considered within 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, constructing a micro-blog crawler; Step 2, constructing a model and stance analysis; Step 3, performing multi-level comment stance analysis; Step 4, data crawling management and user feedback processing; In step 2, constructing a model and stance analysis, the following is specifically true, 2.1, splice the micro-blog comments and micro-blog topics to obtain the input sequence X = {x1, x2, …, x n} of the model, and obtain EmbeddingH BERT through Bert processing, wherein represents the context encoding representation of the input sequence X obtained through the BERT model, n is the sequence length, and d0 is the hidden layer dimension of Bert; H BERT = BERT(X) 2.2, H BERT Modeling long-range dependencies, where represents the output representation through the Mamba layer, di is the output dimension of the Mamba layer; H Mamba = Liner(Mamba(H BERT )) 2.3 Contextual global information modeling by bidirectional LSTM (BiLSTM) where and are the outputs of the forward and backward LSTM respectively, is the concatenated BiLSTM output, d2 represents the dimension of the spliced hidden layer; 2.4 Modeling long-range dependencies H Mamba and context modeling H BiLSTM In one dimension and superimposed, the main key information is extracted from multiple levels by multi-head attention mechanism, wherein, is a 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, d3 is the output dimension of the attention mechanism; X = H BiLSTM + H Mamba Q = XW Q K = WX K V = XW V H Att = MultiHead(Q, K, V) = Concat(head1,..., head h )W O 2.5, To preserve low-level semantic information and prevent overfitting, the present application adopts a residual structure to fuse H BERT and H Att The final fused representation H Fusion is input to a 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, in the training, the Adam optimization method is adopted, and the DropOut is added in 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 of each comment, the model uses Mamba architecture, which is good at processing long-distance dependence, and retains the information of different semantic levels through multi-level residual structure, after the data processing is completed, the results will be written back to the MySQL database; Step 3, performing multi-level comment stance analysis, the following is specifically true, 3.1, render the micro-blog article data and micro-blog comment data in the MySQL database to the front-end page through the template syntax of Djnago3, the user selects the topic of interest, and the page bottom adds the function of page division; 3.2, based on the word cloud analysis of the stance, after the user selects the topic in 3.1, all the comment data under the topic is read out, classified according to the supporters, opponents and neutral, the three kinds of stance comments are divided into one by one through Jieba word segmentation library, and the redundant words are removed using the stop word table, if the front-end initiates an Ajax request, the four kinds of word graphs are returned to the front-end in the form of Json, and the loading progress bar is displayed before the Json data is accepted, 3.3, based on the time series analysis of the stance, after the user selects the topic in 3.1, all the comment data under the topic is read out, classified according to the supporters, opponents and neutral, the three kinds of comments are sorted according to the publishing time from small to large, and the number of users of the three kinds of stance 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 the form of Json, and the loading progress bar is displayed before the Json data is accepted, 3.4, based on the gender analysis of the stance, after the user selects the topic in 3.1, all the comment data under the topic is read out, classified according to the supporters, opponents and neutral, the number of men and women in each category is counted, if the front-end initiates an Ajax request, the gender analysis data based on the stance is returned to the front-end in the form of Json, and the loading progress bar is displayed before the Json data is accepted, 3.5, based on the geographical position analysis of the stance, after the user selects the topic in 3.1, all the comment data under the topic is read out, classified according to the supporters, opponents and neutral, the number of people of the three kinds of stance in each province of China is counted, if the front-end initiates an Ajax request, the stance analysis data of the geographical position is returned to the front-end in the form of Json, and the loading progress bar is displayed before the Json data is accepted.

2. The multi-level comment analysis method based on stance detection according to claim 1, wherein, Step 1, build a micro-blog crawler, as follows: 1.1, obtain public proxy IP and user agent (User-Agent) in the network, and build a proxy IP pool and a user agent pool using a Scrapy framework; 1.2, analyze micro-blog hot list page Ajax requests, and construct an Ajax request for each micro-blog text and an Ajax request for corresponding micro-blog comments according to returned data; 1.3, obtain a user's cookie, and use the cookie as a parameter for the micro-blog comment Ajax request in step 1.2, and directly send the remaining Ajax requests in 1.2; 1.4, micro-blog comments are dynamically loaded, so it is necessary to construct a request for comment paging, and an Ajax request for comment paging is constructed according to the micro-blog comment Json data obtained in 1.4; 1.5, data cleaning, remove duplicates, special symbols, URLs, and convert emoticons in micro-blog into text from collected data; 1.6, data storage, write all the crawled data into a MySQL database in an asynchronous manner through a Scrapy pipeline.

3. The multi-level comment analysis method based on stance detection according to claim 1, wherein, Step 4, data crawling management and user feedback processing, as follows, 4.1, in 3.1, micro-blog article data and micro-blog comment data are displayed on the front end, and if a user is not satisfied with the comment stance marked by the model in step 2, clicks a feedback to fill in the correct stance that the user thinks is correct, and the feedback data is summarized to an administrator interface, and the administrator decides, and the feedback data marked by the administrator is exported, facilitating the model in step 2 to continue training; 4.2, for the data stored in the MySQL in 1.6, a data dashboard is provided on the administrator interface, and the data dashboard supports search, paging, and data add, delete, modify, 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