BERT-based text topic extraction and time-space evolution analysis method and system
By using BERT-based text topic extraction and spatio-temporal evolution analysis methods, combined with graph sorting, statistics, maximum edge correlation and topic models, the problems of inaccurate topic information extraction and neglect of spatio-temporal characteristics in the existing technology are solved, achieving more efficiency and accuracy. Text data analysis.
Patent Information
- Application Number
- CN202410435109.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-11
- Publication Date
- 2024-10-01
AI Technical Summary
Existing text analysis methods are difficult to extract accurate topic information and ignore the spatiotemporal characteristics of text data, resulting in low analysis accuracy.
BERT-based text topic extraction and spatio-temporal evolution analysis methods are used to extract key sentences through data preprocessing, graph sorting, statistics, maximum marginal correlation and topic models, and the classification results are optimized by combining confusion matrices and evaluation indicators to analyze the spatio-temporal evolution rules of the topic. .
It improves the accuracy of key information extraction and classification tasks, reduces classification errors, and enhances the reliability and efficiency of the model.
Smart Images

Figure CN118734826A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of flood disaster public opinion monitoring, and specifically to a BERT-based text topic extraction and spatiotemporal evolution analysis method and system. Background Art
[0002] Heavy rain and flood disasters have brought huge casualties and economic losses to all regions. The direct economic losses account for an average annual proportion of about 44.4% of the total direct economic losses caused by all meteorological disasters (including heavy rain and floods, droughts, strong winds, hail, lightning, tropical cyclones, low temperatures and freezing, and snowstorms). Compared with other disasters, heavy rain and flood disasters affect more areas and are more harmful. The acquisition and spatiotemporal analysis of disaster information can help relevant departments monitor and respond to public opinion in a timely manner, so the timeliness of information becomes particularly important. Nowadays, more and more studies use Weibo data, which has the characteristics of large data volume, strong real-time, and easy to obtain. Compared with remote sensing and ground observation data, Weibo data can reflect the actual situation more timely. It is of great significance to monitor sudden disaster events such as floods, especially to monitor traffic congestion, trapped people, water and power outages caused by floods, and analyze the trend of public opinion. Therefore, combining Weibo data to analyze the spatiotemporal evolution of topics during floods and rainstorms and to dig out more accurate and timely disaster information has important practical significance for disaster emergency response and disaster prevention and mitigation.
[0003] With the popularity of social media and online platforms, a large amount of text data is generated, which contains rich information and insights, especially in terms of public events and social dynamics. Therefore, it is particularly important to extract topics from these data and analyze their evolutionary patterns over time and place. Traditional text analysis methods face many challenges in processing such data, such as the difficulty in capturing complex semantic relationships, the high computational cost of processing large-scale datasets, and the inability to effectively combine text content with spatiotemporal factors.
[0004] Existing text analysis techniques have several major shortcomings when dealing with large-scale, unstructured social media text data. First, many traditional models are limited in their deep semantic understanding of text, making it difficult to effectively extract accurate topic information from complex text data. Second, existing techniques often ignore the spatiotemporal characteristics of text data and cannot fully utilize this information to analyze the evolution of topics over time and space. In addition, the handling of error-prone classifications is often not sophisticated enough, which may lead to inaccurate interpretation and analysis of specific topics. Summary of the invention
[0005] In view of the above-mentioned problems, the present invention is proposed.
[0006] Therefore, the technical problem solved by the present invention is that the existing text analysis methods are unable to extract accurate subject information, ignore the temporal and spatial characteristics of text data, have low precision, and have low analysis accuracy.
[0007] To solve the above technical problems, the present invention provides the following technical solutions: a BERT-based text topic extraction and spatiotemporal evolution analysis method, comprising collecting microblog text topic data for data preprocessing; extracting key sentences based on graph sorting, statistics, maximum edge correlation and topic model; extracting the topic of each data according to the BERT topic classification model; checking and merging easily misclassified categories through a confusion matrix; evaluating the model suitability based on evaluation indicators; and analyzing the overall and local topic evolution laws through time changes.
[0008] As a preferred solution of the BERT-based text topic extraction and spatiotemporal evolution analysis method of the present invention, wherein: the data preprocessing of collecting microblog text topic data includes, in terms of social media data, obtaining microblog data related to floods within the event occurrence period by combining a web crawler with an API and limiting conditions combining keywords and place names;
[0009] The microblog data fields include publishing time, microblog text content, and publishing location;
[0010] Through data cleaning, deduplication, Chinese word segmentation, and stop word removal preprocessing, a microblog flood corpus was formed, and microblog data with check-in locations were selected for microblog text topic extraction and spatiotemporal evolution analysis;
[0011] The data cleaning includes removing irrelevant information from the Weibo text, determining whether the text characters are UTF-8 encoded, removing the characters if they do not conform to the encoding format, changing commas in texts with less than 3 sentences into periods, and calling Baidu Map API to confirm location data, including latitude and longitude coordinates, based on the check-in location text information.
[0012] As a preferred solution of the BERT-based text topic extraction and spatiotemporal evolution analysis method described in the present invention, the key sentence extraction based on graph sorting, statistics, maximum edge correlation and topic model includes selecting TextRank, TF-IDF, MMR and LDA methods based on graph sorting, statistics, maximum edge correlation and topic model for key sentence extraction.
[0013] As a preferred solution of the BERT-based text topic extraction and spatiotemporal evolution analysis method of the present invention, wherein: the topic of each piece of data extracted according to the BERT topic classification model includes taking the extracted key sentences and experimental data as input, and extracting the topic of each piece of data based on the BERT topic classification model;
[0014] The main operation of the BERT layer is to extract the contextual semantic information of the text based on the word embedding, segmentation embedding and position embedding information of the text, insert the [CLS] symbol before the input text, and use the output vector as the semantic representation of the entire text, insert the [SEP] symbol between the two input sentences as a segmentation, pass the input sentence to the embedding layer and the Transformer layer, and the vector representation of the input text is expressed as:
[0015] Out=Transfomer(Embedding(Text))
[0016] Among them, Text represents the input sentence, Embedding represents the input layer of BERT, Transformer represents the feature extractor of BERT, and Out represents the feature vector of the input text;
[0017] A linear classifier is added after BERT to output the text classification result, which is expressed as:
[0018] Label=Softmax(Bert(Text)×W+b),Label∈{0,1,2,3}
[0019] Among them, Bert(Text) means applying BERT to the input text, W means the weight matrix, b means the bias vector, Softmax means the activation function, and Label means the output of the model.
[0020] As a preferred solution of the BERT-based text topic extraction and spatiotemporal evolution analysis method described in the present invention, wherein: the checking and merging of easily misclassified categories through the confusion matrix includes using the confusion matrix to check the easily misclassified categories, merging the easily misclassified categories, and the optimized categories meet the requirements. If there are hot events, the hot events are extracted. The category selection must meet the requirements of the event development process, and there is no obvious relationship of inclusion and being included between the categories, which is expressed as:
[0021]
[0022]
[0023]
[0024] Among them, v i and v j represents the vector representation of categories i and j in the feature space, Ω and Γ represent the feature space of categories i and j, I(t,x) represents the category influence value at the time and space point (t,x), D represents the speed and range of influence propagation, C * Indicates the degree of confusion between categories. It means to find the category set L′ that minimizes the expression on the category space manifold M. represents the closed path integral on the boundary B of the manifold M, R(L′) represents the function under the category set L′, L′ represents the optimized category set, represents the boundary of the manifold, and R and S represent functions defined in the category space.
[0025] As a preferred solution of the BERT-based text topic extraction and spatiotemporal evolution analysis method of the present invention, the model suitability evaluation based on the evaluation index includes dividing the microblog text according to the user type and the text length, and using the accuracy, precision, recall and F1 precision evaluation indicators to evaluate the model suitability, which is expressed as:
[0026]
[0027]
[0028] Where M represents the original confusion matrix, TP, FP, FN, TN represent the number of true positives, false positives, false negatives, and true negatives, R represents the confusion matrix after Riemann geometry transformation, C represents a curve on the complex plane, z and represents complex number and conjugate, Π represents comprehensive performance index, Represents the conversion confusion matrix R of the i-th category i The Riemann gradient of .
[0029] As a preferred solution of the BERT-based text topic extraction and spatiotemporal evolution analysis method of the present invention, the overall and local topic evolution laws analyzed by time change include outputting the topic heat value of each region, and the overall and local topic evolution laws analyzed by time change are expressed as:
[0030]
[0031] Among them, H represents the degree of attention paid by the region to flood and rainstorm events, COUNT represents the number of microblogs located at the check-in location of the region in a certain period of time, and PERSON represents the relative number of people aged 15 to 65 in the region;
[0032] Extract time nodes in the entire event and analyze the changes in the level of attention paid to the event in various regions over time.
[0033] Another object of the present invention is to provide a BERT-based text topic extraction and spatiotemporal evolution analysis system, which can solve the problem of low accuracy of topic classification in current text analysis methods by constructing a BERT topic classification model.
[0034] As a preferred solution of the BERT-based text topic extraction and spatiotemporal evolution analysis system described in the present invention, it includes: an initialization module, a key sentence extraction module, a topic extraction module, a category optimization module, a suitability evaluation module, and a topic spatiotemporal evolution analysis module;
[0035] The initialization module is used to collect microblog text topic data;
[0036] The key sentence extraction module is used to put the processed data into four algorithms, TextRank, MMR, TF-IDF and LDA, and select the top three sentences in the order of sentence importance under each algorithm to replace the text; the topic extraction module is used to take the extracted key sentences and experimental data as input, and extract the topic of each data based on the BERT topic classification model; the category optimization module is used to view the categories that are easily misclassified through the confusion matrix, and merge similar categories to improve the classification accuracy; the applicability evaluation module is used to divide the microblog text according to user type and text length, and use accuracy, precision, recall rate and F1 precision evaluation indicators to evaluate the model applicability; the topic spatiotemporal evolution analysis module is used to output the topic heat value of each region, and analyze the overall and local topic evolution laws through time changes.
[0037] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a BERT-based text topic extraction and spatiotemporal evolution analysis method.
[0038] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a BERT-based text topic extraction and spatiotemporal evolution analysis method.
[0039] Beneficial effects of the present invention: The BERT-based text topic extraction and spatiotemporal evolution analysis method provided by the present invention improves the accuracy and completeness of key information extraction by combining graph sorting, statistical analysis, maximum edge correlation and topic model technology, and applies a BERT-based topic classification model to accurately classify text content into different topics, thereby improving the accuracy and reliability of classification tasks, making the processing of large-scale microblog text data more efficient and accurate, and utilizing a confusion matrix to analyze and merge easily misclassified categories, thereby reducing classification errors and improving the reliability and accuracy of the model in practical applications. The present invention achieves better results in terms of efficiency, accuracy and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0041] Figure 1 An overall flow chart of a BERT-based text topic extraction and spatiotemporal evolution analysis method provided for the first embodiment of the present invention.
[0042] Figure 2 A data cleaning flow chart of a BERT-based text topic extraction and spatiotemporal evolution analysis method provided for the second embodiment of the present invention.
[0043] Figure 3 Prediction and true value confusion matrix display diagrams of five training methods for a BERT-based text topic extraction and spatiotemporal evolution analysis method provided for the first embodiment of the present invention: (a) TF-IDF-BERT display diagram (b) BERT prediction and true value confusion matrix display diagram (c) MMR-BERT prediction and true value confusion matrix display diagram (d) TextRank-BERT value confusion matrix display diagram (e) LDA-BERT prediction and true value confusion matrix display diagram
[0044] Figure 4 A schematic diagram of the evolution of topics over time in a BERT-based text topic extraction and spatiotemporal evolution analysis method provided in the first embodiment of the present invention.
[0045] Figure 5 An overall flow chart of a BERT-based text topic extraction and spatiotemporal evolution analysis system provided for the third embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0047] Example 1
[0048] Reference Figure 1-Figure 4, which is an embodiment of the present invention, provides a method for text topic extraction and spatiotemporal evolution analysis based on BERT, including: collecting microblog text topic data for data preprocessing; extracting key sentences based on graph sorting, statistics, maximum edge correlation and topic model; extracting the topic of each data according to the BERT topic classification model; checking the easily misclassified categories through the confusion matrix and merging them; evaluating the model applicability based on evaluation indicators; analyzing the overall and local topic evolution rules through time changes.
[0049] S1: Collect Weibo text topic data for data preprocessing.
[0050] Furthermore, in terms of social media data, we used a combination of web crawlers and APIs to obtain Sina Weibo data related to floods within a specific flood event period with the limiting conditions of combining keywords and place names. Weibo data fields include publishing time, Weibo text content, publishing location, etc. Through data cleaning, deduplication, Chinese word segmentation, and stop word removal preprocessing, we formed a Weibo flood corpus, and selected Weibo data with check-in locations for Weibo text topic extraction and spatiotemporal evolution analysis. The specific data cleaning criteria are as follows:
[0051] Remove irrelevant information from Weibo text: Emoji expressions, web links, L user’s videos, @ users, etc.
[0052] Determine whether the text characters are UTF-8 encoded. If they do not conform to the encoding format, remove the characters.
[0053] Change commas to periods in texts with less than 3 sentences;
[0054] Call Baidu Map API based on the check-in location text information to confirm the location data, including latitude and longitude coordinates.
[0055] S2: Key sentence extraction based on graph ranking, statistics, maximum edge correlation and topic model.
[0056] Furthermore, the processed data were put into four algorithms, namely TextRank, MMR, TF-IDF and LDA, and the top three sentences ranked by sentence importance under each algorithm were selected to replace the text.
[0057] It should be noted that in the key sentence extraction step, four methods, TextRank, TF-IDF, MMR, and LDA, are selected for key sentence extraction from four perspectives: graph ranking-based, statistics-based, maximum edge correlation-based, and topic model-based.
[0058] First, the TextRank method treats each sentence of the document as an independent part, and each sentence as a vertex of the graph. The relationship between every two sentences is connected by a line, thus forming a graph. The relationship between sentences is the degree of similarity between the two sentences. The similarity value is calculated by the algorithm, and it becomes the weight value of the edge in the graph. Then, the score value of each sentence is calculated according to the TextRank algorithm, and the sentences are sorted according to the score value to obtain the sentence importance sorting result of the text.
[0059] Second, the main idea of TF-IDF is that if a feature word appears with a high frequency TF in a Weibo text sentence and appears less frequently in other Weibo text sentences, it is considered that this feature word has a strong ability to distinguish categories and is suitable for classifying Weibo text sentences.
[0060] Third, the idea of the MMR algorithm is to first calculate the similarity between each sentence and the entire text and the similarity between each sentence, and then use the algorithm formula to iterate to get the ranking of the Weibo text sentence scores.
[0061] Fourth, the idea of the LDA algorithm is to first cluster the sentences in the Weibo text through similarity calculation to determine the number of topics and the probability that the sentences are for each topic, sort them according to the number of sentences contained in each topic, select the topic with the largest number of sentences, and sort the sentences in the topic by probability to obtain the sentence importance ranking result of the text.
[0062] S3: Extract the topic of each data based on the BERT topic classification model.
[0063] Furthermore, the extracted key sentences and original experimental data are used as input to extract the topic of each data based on the BERT topic classification model.
[0064] It should be noted that in the topic classification step of the BERT model, the main operation of the BERT layer is to extract the contextual semantic information of the text based on the word embedding, segmentation embedding, and position embedding information of the text. First, insert the [CLS] symbol before the input text, and use its corresponding output vector as the semantic representation of the entire text. In addition, insert the [SEP] symbol between the two input sentences as a segmentation, pass the input sentence to the embedding layer and the Transformer layer, and obtain the vector representation of the input text. The specific formula is as follows:
[0065] Out=Transfomer(Embedding(Text))
[0066] Among them, Text is the input sentence, Embedding is the input layer of BERT, Transformer is the feature extractor of BERT, and Out is the feature vector of the input text. Finally, a linear classifier is added after BERT to obtain the text classification result. The specific formula is as follows:
[0067] Label=Softmax(Bert(Text)×W+b),Label∈{0,1,2,3}
[0068] Among them, Bert(Text) means applying BERT to the input text, W means the weight matrix, b means the bias vector, Softmax means the activation function, and Label means the output of the model.
[0069] S4: Use the confusion matrix to check the misclassified categories and merge them.
[0070] Furthermore, category optimization: Use the confusion matrix to view categories that are easily misclassified, and merge similar categories to improve classification accuracy without affecting the analysis of topic evolution.
[0071] It should be noted that in the category optimization step, the confusion matrix is used to check the categories that are easily misclassified, and the categories that are easily misclassified are merged, or an important event is classified as one category (such as a hot event) according to the actual situation.
[0072] It should also be noted that the confusion matrix is used to check the categories that are easy to misclassify, and the categories that are easy to misclassify are merged. The optimized categories meet the requirements. If there are hot events, the hot events are extracted. The category selection must meet the requirements of the development process of the event. There is no obvious relationship between inclusion and inclusion between categories, which can be expressed as:
[0073]
[0074]
[0075]
[0076] Among them, v i and v j represents the vector representation of categories i and j in the feature space, Ω and Γ represent the feature space of categories i and j, I(t,x) represents the category influence value at the time and space point (t,x), D represents the speed and range of influence propagation, C * Indicates the degree of confusion between categories. It means to find the category set L′ that minimizes the expression on the category space manifold M. represents the closed path integral on the boundary B of the manifold M, R(L′) represents the function under the category set L′, L′ represents the optimized category set, represents the boundary of the manifold, and R and S represent functions defined in the category space.
[0077] S5: Evaluate the model suitability based on the evaluation indicators.
[0078] Furthermore, the microblog texts are divided according to user type and text length, and the model suitability is evaluated using accuracy evaluation indicators such as accuracy, precision, recall and F1.
[0079] It should be noted that Weibo is then divided into official media and personal media according to user types, and Weibo texts posted by personal media are divided into three types according to their length: (0,70], (70,140], and (140,+∞). The accuracy of BERT, TF-IDF+BERT, TextRank+BERT, MMR+BERT, and LDA+BERT on each type of Weibo text is counted respectively, and the best classification model for each type of Weibo text is obtained by comparison, which is used for spatiotemporal analysis of topic evolution.
[0080] It should also be noted that the microblog texts are divided according to user type and text length, and the model applicability is evaluated using accuracy, precision, recall and F1 precision evaluation indicators, which are expressed as:
[0081]
[0082]
[0083] Where M represents the original confusion matrix, TP, FP, FN, TN represent the number of true positives, false positives, false negatives, and true negatives, R represents the confusion matrix after Riemann geometry transformation, C represents a curve on the complex plane, z and represents complex number and conjugate, Π represents comprehensive performance index, Represents the conversion confusion matrix R of the i-th category i The Riemann gradient of .
[0084] S6: Analyze the overall and local theme evolution patterns through time changes.
[0085] Furthermore, the temporal and spatial evolution analysis of topics: calculate the topic popularity value in each region, and analyze the overall and local topic evolution patterns through time changes.
[0086] It should be noted that in the step of spatiotemporal analysis of topic evolution, the above-mentioned classification method is used to predict the topic results of all data.
[0087] First, we analyze the time evolution, determine the time interval, count the number of each topic in each time period, draw a schematic diagram of the topic evolution over time, analyze the topic evolution law of the entire event and the time node of the peak number of occurrences of each topic;
[0088] Secondly, the spatial evolution analysis was carried out. The number of people aged 15-65 in the study area was calculated according to the statistical yearbook, and the degree of attention paid to flood disasters in each region was calculated according to the following formula, where H represents the degree of attention paid to flood and rainstorm events in the region, COUNT represents the number of Weibo posts located at the check-in location in the region within a certain period of time, and PERSON represents the relative number of people aged 15-65 in the region:
[0089]
[0090] Example 2
[0091] An embodiment of the present invention provides a BERT-based text topic extraction and spatiotemporal evolution analysis method. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0092] First, data preprocessing. Microblog texts contain a lot of redundant information. Removing irrelevant information such as Emoji expressions, web links, L user videos, @ users, etc. can improve the concentration of text topics. Since users can use mobile terminals to post microblogs, and the expressions on mobile terminals are not in the Emoji library, it is necessary to segment the text, and then determine whether each character is UTF-8 encoded. After removing non-UTF-8 encoded characters and recombining the remaining characters, the expressions posted by the user terminal can be removed. When users post microblog texts, they often use colloquial expressions and do not pay attention to the logical structure of the entire paragraph. Therefore, commas are used frequently. In the data cleaning stage, commas in texts with less than 3 sentences need to be changed to periods to improve the efficiency of summary extraction.
[0093] By observing the text of microblogs, we can find that the character limit of ordinary microblogs is 140 characters, which is twice the character limit of SMS. This means that under normal circumstances, 70 characters can express simple semantics, and 140 characters can carry information about one thing. According to people's habit of expressing 30 words in a sentence, and the conclusion that the proportion of sentences that are very relevant to the text topic extracted in previous studies is 63%, it can be concluded that the public usually has three sentences talking about the same topic when expressing, so the number of key sentences extracted is set to three, which can ensure a certain amount of text and eliminate sentences that are not very related to the topic, so as to achieve the purpose of extracting key sentences.
[0094] The processed data were put into four algorithms, TextRank, MMR, TF-IDF and LDA, and the top three sentences ranked by sentence importance under each algorithm were selected to replace the text, and dataset 1, dataset 2, dataset 3 and dataset 4 were constructed respectively.
[0095] The BERT layer uses the word, word segmentation and position embedding in the topic classification task of a large amount of Sina Weibo data to extract contextual semantic information from the text. The model of this patent is trained on a large amount of Sina Weibo data sets. The pre-training input of BERT is the sum of three vectors: Token embedding layer, Segment embedding layer and Position embedding layer, where the Token embedding layer is to convert each word into a vector of fixed dimension, the Segment embedding layer is used to distinguish sentences, and the Position embedding layer is used to specify the position of words in the sequence. The learned position information is represented by the position vector. After the Weibo text is put into the BERT model training, the predicted category is output.
[0096] By performing confusion matrix analysis on the classification results of rainstorm events, we can see that the dataset is seriously misclassified, which affects the accuracy of the results of each method. Figure 3 As shown in (a)-(e), both the warning and guide categories are instructive. Although the rescue and help categories are distinguished from the active and passive perspectives, they usually appear together in the text. The semantic similarity will blur the boundaries between categories. Therefore, according to the actual situation, the warning and guide categories are merged into the prompt category, the disaster situation and the current situation are merged into the disaster situation category, the help and rescue are merged into the rescue category, and the prayer and irrelevant are merged into the emotion category. In addition, hot events are often the focus of the entire event and will be treated as a separate topic.
[0097] The results of the method applicability analysis based on the types of official media and personal Weibo users are shown in Table 1 below. The classification accuracy of various methods is higher for official Weibo than for ordinary public Weibo, among which BERT has the highest classification accuracy. For official Weibo, it is more informative and practical than personal Weibo, and the Weibo content has more accurate information, which is convenient for reference; the Weibo structure usually adopts the form of total score, and the topic tags must be closely related to the content, positioned in the front, and closely related to the text content. The first sentence of the content can express the theme of the entire Weibo content. At the same time, the text content is thematically concentrated without too much redundant information. Extracting part of the text will destroy the contextual connection between sentences, so the official text is suitable for direct classification processing.
[0098] As for microblogs posted by individuals, first of all, the text structure of microblogs is scattered. Different from the structure of official media, microblogs posted by individuals do not have a fixed structure. The theme sentence may exist in the first sentence, the middle of the text, or the last sentence. Secondly, microblog texts tend to express emotions. The content of microblogs posted by individuals focuses more on the views on an event or the expression of emotional tendencies. The theme category is mixed in with the emotions and is not easy to extract. Furthermore, the length of microblog texts posted by individuals is uncertain. According to statistics, most microblogs with less than 70 words and more than 140 words are posted by individual users.
[0099] Table 1 Results of method applicability analysis by user type
[0100]
[0101]
[0102] The microblog texts posted by individuals are divided into three sets S1, S2, and S3 according to the number of words. The sets are respectively microblog texts with no more than 70 words, more than 70 words and no more than 140 words, and more than 140 words. The three data sets are put into five models for accuracy testing. The results are shown in Table 2 below:
[0103] Table 2 Results of method applicability analysis based on the length of microblog text
[0104]
[0105] The results show that TF-IDF+BERT works better when the number of words is small or large, and LDA+BERT works better when the number of words is medium.
[0106] When the number of words is small, TF-IDF can effectively sort the importance of sentences in the text, and the sorting effect is better than the other three methods. After this operation, the data set is sent to the BERT model for training, and BERT can better learn the relationship between sentences; when the number of words is medium, LDA is the most commonly used clustering technology, and the vocabulary of Weibo text is more colloquial and less changing, so it can be clustered according to the topics expressed by each sentence in the text; when the number of words is large, there are many topics expressed between each sentence in the text, and it is not easy to classify. TF-IDF can not only take into account the number of words in each sentence, but also comprehensively consider the connection between each sentence based on the frequency of words appearing in each sentence.
[0107] Due to the suddenness of the incident, the first topics that attracted the attention of Weibo users were disaster information, followed by the early warning information issued by various counties and cities. Rescue information reached its peak about 2 days after the disaster, and its evolution basically conformed to the general law of "disaster information-warning-rescue". From the peak and valley values of each category, it can be seen that users' posts are basically concentrated in the daytime. In the entire Henan rainstorm event, emotional information ran throughout and accounted for a large proportion. At the same time, it was found that the peak of hot topic Weibo basically corresponded to the peak of the disaster.
[0108] By verifying the experimental results, we can make full use of the advantages of social media data, which are massive and timely, to make up for the lack of measured data such as remote sensing under extreme conditions when disasters occur. Using different algorithms for topic classification for different types of microblog texts can effectively improve the classification accuracy. Using microblog check-in data for topic spatiotemporal evolution analysis can analyze the trend of term popularity changes, capture specific disaster information during the flood process, sort out the spatiotemporal evolution characteristics of flood themes, and provide technical support for the emergency response of relevant departments.
[0109] Example 3
[0110] Reference Figure 5 , is an embodiment of the present invention, and provides a text topic extraction and spatiotemporal evolution analysis system based on BERT, including an initialization module, a key sentence extraction module, a topic extraction module, a category optimization module, a suitability evaluation module, and a topic spatiotemporal evolution analysis module.
[0111] The initialization module is used to collect microblog text topic data, the key sentence extraction module is used to put the processed data into four algorithms, TextRank, MMR, TF-IDF and LDA, and select the top three sentences in the order of sentence importance under each algorithm to replace the text. The topic extraction module is used to extract the topic of each data based on the BERT topic classification model using the extracted key sentences and experimental data as input. The category optimization module is used to view the categories that are easy to be misclassified through the confusion matrix and merge similar categories to improve the classification accuracy. The applicability evaluation module is used to divide the microblog text according to user type and text length, and use accuracy, precision, recall and F1 precision evaluation indicators to evaluate the model applicability. The topic spatiotemporal evolution analysis module is used to output the topic heat value of each region and analyze the overall and local topic evolution laws through time changes.
[0112] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0113] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0114] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.
[0115] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc. It should be noted that the above embodiments are only used to illustrate the technical solution of the present invention and are not limited. Although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
[0116] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A BERT-based text topic extraction and spatiotemporal evolution analysis method, characterized in that: include: Collect microblog text topic data for data preprocessing; Extract key sentences based on graph sorting, statistics, maximum edge correlation, and topic models; Extract the topic of each piece of data based on the BERT topic classification model; Use the confusion matrix to view and merge the misclassified categories; Evaluate the model suitability based on evaluation indicators; Analyze overall and local theme evolution patterns through temporal changes.
2. The BERT-based text topic extraction and spatiotemporal evolution analysis method according to claim 1, characterized in that: The data preprocessing of collecting microblog text topic data includes, in terms of social media data, obtaining microblog data related to floods within the event occurrence period by combining web crawlers and APIs with limiting conditions combining keywords and place names; The microblog data fields include publishing time, microblog text content, and publishing location; Through data cleaning, deduplication, Chinese word segmentation, and stop word removal preprocessing, a microblog flood corpus was formed, and microblog data with check-in locations were selected for microblog text topic extraction and spatiotemporal evolution analysis; The data cleaning includes removing irrelevant information from the Weibo text, determining whether the text characters are UTF-8 encoded, removing the characters if they do not conform to the encoding format, changing commas in texts with less than 3 sentences into periods, and calling Baidu Map API to confirm location data, including latitude and longitude coordinates, based on the check-in location text information.
3. The BERT-based text topic extraction and spatiotemporal evolution analysis method as claimed in claim 2, characterized in that: The key sentence extraction based on graph sorting, statistics, maximum edge relevance and topic model includes selecting four methods of TextRank, TF-IDF, MMR and LDA for key sentence extraction based on four perspectives of graph sorting, statistics, maximum edge relevance and topic model.
4. The BERT-based text topic extraction and spatiotemporal evolution analysis method as claimed in claim 3, characterized in that: The extracting the topic of each piece of data according to the BERT topic classification model includes taking the extracted key sentences and experimental data as input, and extracting the topic of each piece of data based on the BERT topic classification model; The main operation of the BERT layer is to extract the contextual semantic information of the text based on the word embedding, segmentation embedding and position embedding information of the text, insert the [CLS] symbol before the input text, and use the output vector as the semantic representation of the entire text, insert the [SEP] symbol between the two input sentences as a segmentation, pass the input sentence to the embedding layer and the Transformer layer, and the vector representation of the input text is expressed as: Out=Transfomer(Embedding(Text)) Among them, Text represents the input sentence, Embedding represents the input layer of BERT, Transformer represents the feature extractor of BERT, and Out represents the feature vector of the input text; A linear classifier is added after BERT to output the text classification result, which is expressed as: Label=Softmax(Bert(Text)×W+b),Label∈{0,1,2,3} Among them, Bert(Text) means applying BERT to the input text, W means the weight matrix, b means the bias vector, Softmax means the activation function, and Label means the output of the model.
5. The BERT-based text topic extraction and spatiotemporal evolution analysis method as claimed in claim 4, characterized in that: The method of checking the easily misclassified categories and merging them through the confusion matrix includes using the confusion matrix to check the easily misclassified categories, merging the easily misclassified categories, and optimizing the categories. If there are hot events, the hot events are extracted. The category selection must meet the development process of the event, and there is no obvious relationship between inclusion and inclusion between the categories, which is expressed as: Among them, v i and v j represents the vector representation of categories i and j in the feature space, Ω and Γ represent the feature space of categories i and j, I(t,x) represents the category influence value at the time and space point (t,x), D represents the speed and range of influence propagation, C * Indicates the degree of confusion between categories. It means to find the category set L′ that minimizes the expression on the category space manifold M. represents the closed path integral on the boundary B of the manifold M, R(L′) represents the function under the category set L′, L′ represents the optimized category set, represents the boundary of the manifold, and R and S represent functions defined in the category space.
6. The BERT-based text topic extraction and spatiotemporal evolution analysis method according to claim 5, characterized in that: The model suitability evaluation based on the evaluation index includes dividing the microblog text according to the user type and the text length, and using the accuracy, precision, recall and F1 precision evaluation indicators to evaluate the model suitability, which is expressed as: Where M represents the original confusion matrix, TP, FP, FN, TN represent the number of true positives, false positives, false negatives, and true negatives, R represents the confusion matrix after Riemann geometry transformation, C represents a curve on the complex plane, z and represents complex number and conjugate, Π represents comprehensive performance index, Represents the conversion confusion matrix R of the i-th category i The Riemann gradient of .
7. The BERT-based text topic extraction and spatiotemporal evolution analysis method according to claim 6, characterized in that: The analysis of the overall and local topic evolution laws through time changes includes outputting the topic heat value of each region, and the analysis of the overall and local topic evolution laws through time changes is expressed as: Among them, H represents the degree of attention paid by the region to flood and rainstorm events, COUNT represents the number of microblogs located at the check-in location of the region in a certain period of time, and PERSON represents the relative number of people aged 15 to 65 in the region; Extract time nodes in the entire event and analyze the changes in the level of attention paid to the event in various regions over time.
8. A system using the BERT-based text topic extraction and spatiotemporal evolution analysis method as described in any one of claims 1 to 7, characterized in that: It includes initialization module, key sentence extraction module, topic extraction module, category optimization module, applicability evaluation module, and topic spatiotemporal evolution analysis module; The initialization module is used to collect microblog text topic data; The key sentence extraction module is used to run the processed data into four algorithms: TextRank, MMR, TF-IDF and LDA, and select the top three sentences in the order of importance of each algorithm to replace the text; The topic extraction module is used to take the extracted key sentences and experimental data as input, and extract the topic of each data based on the BERT topic classification model; The category optimization module is used to check the categories that are easy to be misclassified through the confusion matrix, and merge similar categories to improve the classification accuracy; The applicability evaluation module is used to divide the microblog texts according to user type and text length, and use accuracy, precision, recall and F1 precision evaluation indicators to evaluate the model applicability; The topic spatiotemporal evolution analysis module is used to output the topic popularity value of each region and analyze the overall and local topic evolution rules through time changes.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the BERT-based text topic extraction and spatiotemporal evolution analysis method described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the BERT-based text topic extraction and spatiotemporal evolution analysis method described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Evolution analysis method and device for emerging technology and storage medium
CN120543328A
