# Research on Sentiment Analysis of Online Public Opinion Based on RoBERTa-BiLSTM-Attention Model
## 4 Empirical Analysis  
### Data Crawling and Pre-Processing  
In terms of data crawling, this study selected the public opinion event of a college as a research case and used Python-based crawling tools (e.g., Requests and Selenium) to collect the microblog text data from 1 June to 28 June 2023 related to an event on Weibo. Considering that the public is accustomed to posting comments with hot search or topic tags when online public opinion is published, this paper first crawled the first-level comments under the relevant hot searches of the event. At the same time, in order to obtain more comprehensive comment data, the keyword 'rat head duck neck' (a four-letter phrase in Chinese) was also used to supplement the crawling to obtain relevant microblog information. In addition, the first- and second-level comments of each microblog were also crawled to obtain the real public sentiment information. For data preprocessing, this study started by removing comment nulls and duplicate comments. Then, special characters were removed from the initial text using regular expressions, such as using re.compile ('</? \w+ [>]*>') to remove links, tags, symbols, etc., from the comment text. In addition, this study also set noise to filter the crawled data to exclude spam content; the specific noise information is shown in Table 1. Then, this study used the exact mode of the jieba participle and specified in the jieba.posseg participle function that only nouns, other proper nouns, and gerunds were to be retained; then, a list of current, commonly used deletion words was integrated to remove meaningless deletions in the experiments, which contained a total of 1599 deletion words. After eliminating duplicate fields and deleting null values and invalid data from the crawled data, 4564 hot search-related microblogs and 32,002 microblog comments were retained, resulting in a total of 36,566 microblog text data, with the data dimensions, including comment ID, posting time, user's nickname, user's city, user's fans, user's attention, user's gender, user's type, number of comment likes, number of comment replies, comment content, etc. In addition, this study only collected publicly released data and anonymised data involving personal information to protect user privacy. We strictly adhered to ethical norms for data collection and ensured that all data were used in accordance with relevant laws and regulations and platform policies. In order to show the correspondence between the data trend and the key time points of the incident, this study plotted the trend of public opinion volume to show the correlation \begin{table}
\begin{tabular}{l l} \hline \hline
**Noise** & **Reasons** \\ \hline
**\#** & duplicate tag \\
**@** & reminder labels, no substance \\
**[**]** & hot keywords, duplicate content \\ Re: & comment user response, meaningless \\ additional text & ‘Web link’, microblogging video’, ‘retweeted microblogging’, etc. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Noise contents. between the daily data volume, Baidu index, and the progress of the incident, as shown in Figure 3. Analysis of this figure shows that the trend of comment data volume was similar to the trend of the Baidu index, which indicated that the crawled data could be used to analyse public opinion. Combined with the analysis of the progress of the incident, it can be seen that from 2 June, when students reported the presence of foreign objects in the meal, to 3 June, when the school issued a briefing that the foreign object was a duck neck, to 4 June, when the Market Supervision Bureau confirmed that it was a duck neck, a series of investigations into the misconduct triggered the continued attention of netizens, and the number of comments on related microblogs continued to grow, with the volume of voices showing an upwards trend. On 6 June, experts in rodent research expressed that they thought that the foreign object was the head of a mouse. Professionals spoke out to affirm netizens' views, and the volume of public opinion reached its first peak here.