A social event context generation method based on double-layer structure entropy graph clustering
By employing a two-layer entropy graph clustering method, combined with keyword co-occurrence frequency and the SentenceBERT model, the problem of low efficiency in traditional social media data clustering is solved, generating a clear event timeline and improving the accuracy and efficiency of social event detection.
Patent Information
- Application Number
- CN202411437841.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-10-15
AI Technical Summary
Traditional social media data clustering algorithms are inefficient when processing large-scale data and cannot effectively identify the dynamic development of events. In particular, they do not adequately consider semantic edge selection and temporal impact, leading to the omission of important information.
A two-layer entropy graph clustering method is adopted, which combines coarse-grained and fine-grained clustering, uses keyword co-occurrence frequency and SentenceBERT model to calculate similarity, constructs a social message graph, and takes into account time span to generate event summaries.
It improves the accuracy and efficiency of social event detection, generates a clear timeline of events, allows users to intuitively understand the development of events, and enhances the effectiveness of complex social media data analysis.
Smart Images

Figure CN119441632B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural language processing technology, specifically relating to a method for generating social event context based on two-layer entropy graph clustering. Background Technology
[0002] In today's rapidly developing information age, social media platforms such as Twitter, Facebook, and Instagram have become the main channels for people to communicate and share information daily. These platforms are characterized by their massive user base and rapid information dissemination. Within this vast amount of data lies a wealth of information related to social events and trending topics. In-depth mining and analysis of social media data can effectively identify the dynamic development of social events, especially the spread and impact of emergencies. However, accurately extracting relevant information from massive amounts of social media data, identifying the evolution of events, and generating intuitive timelines is no easy task. This requires not only the use of artificial intelligence algorithms but also a deep understanding of language, context, and the complexity of events. The massive amounts of data generated by these platforms contain rich information about social events; how to identify the dynamic development of events from this data has significant practical implications for crisis management, public opinion monitoring, and decision-making.
[0003] This task is typically divided into a date selection subtask and a date summarization subtask. The date selection subtask focuses on identifying dates from text that are relevant to key events. These dates can be explicitly marked (e.g., "September 8, 2023") or implicit time information (e.g., "yesterday" or "last month"). Through date selection, the system determines which dates are directly related to the events described in the article. The date summarization subtask aims to generate a concise event description for each selected date, highlighting the core events surrounding those dates in the article. By generating a timeline, the system helps users better understand the sequence of events and their relevance. Traditional clustering algorithms suffer from low clustering efficiency, especially when dealing with large-scale data. Furthermore, traditional graphing methods, in their semantic edge selection strategies, fail to distinguish the influence of different nodes, leading to the omission of some important information and neglecting the impact of time. Therefore, they still have certain shortcomings. Summary of the Invention
[0004] To address the aforementioned technical challenges, this invention presents a social event timeline generation method based on a two-layer structural entropy graph clustering approach. This method employs a two-layer, structural entropy-based clustering approach, using coarse-grained clustering for topic clustering and fine-grained event clustering to form event nodes. A large model is then used to generate summaries of these event nodes. Furthermore, the graph construction considers not only keyword co-occurrence frequency but also semantic similarity calculations using SentenceBERT, and edge pruning based on the time span between messages. This approach constructs a robust social message graph, thereby improving graph clustering performance and enabling better analysis of social event timelines.
[0005] To achieve the above-mentioned technical effects, this invention discloses a method for generating social event context based on two-layer entropy graph clustering, comprising the following steps:
[0006] S1. Preprocess social media data;
[0007] S2. Apply the KeyBERT model to each message to be processed to extract keywords;
[0008] S3. Construct a keyword graph and perform coarse-grained topic clustering using a structural entropy-based clustering algorithm. Specifically, when two keywords appear in the same message, traverse the keywords of each message and calculate the co-occurrence frequency of each keyword pair. Use the deduplicated keywords from S2 as nodes to construct a keyword co-occurrence graph, and construct an edge between nodes with a co-occurrence frequency greater than a threshold (usually 2). After the graph is constructed, apply a structural entropy-based community detection algorithm to the graph to perform coarse-grained topic clustering.
[0009] S4. Based on the results of S3, perform community selection for messages on social media;
[0010] S5. Construct a graph of the messages and, based on the results of S4, perform fine-grained event clustering within each community; specifically:
[0011] S5.1: Treat each message as a node and construct a message graph; first, construct it based on keyword frequency. Based on the keywords extracted from each message in S2, if the number of identical keywords in two messages is greater than or equal to 2, then construct an edge for the two nodes.
[0012] S5.2: Then use SentenceBert to calculate the similarity between each pair of messages. If the similarity between two messages is less than 0.3 and there is an edge between the two messages, delete the existing edge; if the similarity is greater than 0.7 and there is no edge between the two messages, add an edge; if the similarity is between 0.3 and 0.7, do not make any changes.
[0013] S5.3: Based on community matching in S4, extract subgraphs from the messages within each community, and apply an event detection algorithm based on structural entropy within the community;
[0014] S6. Extract the event occurrence time and generate multi-document summaries of multiple messages of the event using a large model;
[0015] S7. Sort each event by time to generate an event timeline, which is to output the summary and content generated in S6 by time.
[0016] Furthermore, in S4, after applying the community detection algorithm to the keyword co-occurrence graph in S3, each community is obtained as a bag-of-words model. Each community is regarded as a document, the similarity between each message and the community is calculated, and the community with the highest similarity is selected for the message, i.e., community matching.
[0017] Furthermore, in S6,
[0018] S6.1: Based on S5, messages are divided into multiple clusters within the community. Each cluster of messages represents an event, and each message corresponds to its publication time or timestamp. These are then uniformly converted into timestamps. The timestamps of the messages in each cluster are summed and averaged, and then converted into a time accurate to year, month, and day, which is used as the occurrence time of the event.
[0019] S6.2: For generating a summary for each cluster, the large model is used to concatenate the message contents of the k nodes with the highest degree within the cluster, separating each message with "||". The concatenated content is then truncated according to the maximum number of input tokens supported by the large model. GPT3.5-turbo-16k supports a maximum of 16384 tokens, and any excess is truncated. An effective prompt is then constructed: "You are a helpful assistant. Three quotation marks inside is a Chinese multi-document article collection. Each article is separated by a '||' separator. Please provide a Chinese summarization for the multi-document article set, within 20 words."
[0020] Furthermore, in S2, a pre-trained BERT model is used, and a set of keywords that best represents the topic of the message is generated in combination with the content of the message; then, the keywords of all messages are put into a set to remove duplicates, which are used as nodes in the co-occurrence graph.
[0021] Furthermore, in S1,
[0022] S1.1: For the collected social media data, filter out the valid content, that is, the content with more than 20 characters in the message, because short messages are usually regarded as noise or irrelevant information, which is not conducive to event detection and timeline construction;
[0023] S1.2: After the message filtering is completed, the text is segmented using a word segmentation algorithm.
[0024] The beneficial effects of this invention are:
[0025] This invention designs a social event context generation method based on two-layer entropy graph clustering. Through two-layer entropy clustering, social media messages can be effectively classified at both coarse-grained and fine-grained levels, thereby extracting potential events and topics and significantly improving the accuracy of event detection. This method utilizes keyword co-occurrence frequency to construct a graph and calculates the similarity weighting between messages using the SentenceBERT model to more accurately capture the semantic relationships between messages.
[0026] Furthermore, considering the impact of time span on message relationships ensures that the constructed social message graph is more representative, resulting in more comprehensive analysis results. Using a large model for multi-document summarization and event sorting effectively extracts key information from each event, providing a concise and clear event overview and generating a clear timeline, allowing users to intuitively understand the development process and chronological order of events. In contrast, traditional clustering algorithms are less efficient when processing large-scale data, making them unsuitable for practical applications. The community detection algorithm based on structural entropy, however, improves the efficiency and accuracy of clustering through a more efficient data processing mechanism, making it particularly suitable for complex social media data analysis. Attached Figure Description
[0027] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below.
[0028] Figure 1 This is a flowchart of a social event context generation method based on two-layer entropy graph clustering. Detailed Implementation
[0029] Example 1
[0030] This invention discloses a method for generating social event contexts based on two-layer entropy graph clustering, comprising the following steps:
[0031] Step 1: For the collected social media data, first filter it to select valid content, that is, content with more than 20 characters. This is because short messages are usually regarded as noise or irrelevant information, which is not conducive to event detection and timeline construction.
[0032] Step 1.2: After the message filtering is completed, the text is segmented using a word segmentation algorithm.
[0033] Step 2: Apply the KeyBERT model to each message to be processed to extract keywords. KeyBERT is a keyword extraction algorithm based on the BERT model. It leverages BERT's powerful semantic representation capabilities to extract the most representative keywords from text. A pre-trained BERT model is used, combined with the message content, to generate a set of keywords that best represent the message's theme.
[0034] Step 2.1: We put all the keywords of the messages into a set to remove duplicates, and use them as nodes in the co-occurrence graph.
[0035] Step 3: When two keywords appear in the same message at the same time, it is called a co-occurrence. Iterate through the keywords of each message and calculate the co-occurrence frequency of each keyword pair.
[0036] Step 3.1: We construct a keyword co-occurrence graph using the deduplicated keywords from Step 2.1 as nodes. We then create an edge between nodes whose co-occurrence frequency is greater than a threshold (typically 2). After constructing the graph, we apply a community detection algorithm based on structural entropy to perform coarse-grained topic clustering.
[0037] Step 4: After applying the community detection algorithm to the keyword co-occurrence graph in Step 3, we obtain that each community is actually a bag-of-words model. We treat each community as a document, calculate the similarity between each message and the community, and select the community with the highest similarity for the message, which is community matching.
[0038] Step 5: We treat each message as a node and construct a message graph. First, we construct the graph using keyword frequency. In Step 2, we extracted keywords from each message. If two messages share two or more identical keywords, we create an edge between the two nodes. Then, we use SentenceBERT to calculate the pairwise similarity between messages. If the similarity between two messages is less than 0.3 and they share an edge, we delete that edge. If the similarity is greater than 0.7 and they do not share an edge, we add an edge. If the similarity is between 0.3 and 0.7, we leave it unchanged.
[0039] Step 5.1: After community matching in Step 4, extract subgraphs based on messages within each community, and apply an event detection algorithm based on structural entropy within each community.
[0040] Step 6: In Step 5, we divided the messages into multiple clusters within the community. Each cluster of messages represents an event. Each message has its own publication time or timestamp. We uniformly convert these to timestamps, sum the timestamps of the messages in each cluster, calculate the average, and then convert it back to a time accurate to the year, month, and day, which serves as the event's occurrence time.
[0041] Step 6.1: To generate a summary for each cluster, we use a large model. We concatenate the message contents of the k nodes with the highest degree within the cluster, separating each message with "||". Then, based on the maximum number of input tokens supported by the large model, we truncate the concatenated content. GPT3.5-turbo-16k supports a maximum of 16384 tokens; any excess is truncated. We then construct a valid prompt: "You are a helpful assistant. Three quotation marks inside is a collection of Chinese multi-document articles. Each article is separated by a '||' separator. Please provide a Chinese summarization for the multi-document article set, within 20 words." The concatenated content can then be passed into the prompt.
[0042] Step 7: Sort the summary and content generated in Step 6 by time and output the results.
[0043] In this embodiment, the feasibility of the above method is verified through further practical operation; specific experiments are conducted, and the results are shown in Tables 1 and 2 below:
[0044] Table 1 shows the first set of output results verified in the experiment.
[0045]
[0046] Table 2 shows the second set of output results verified in the experiment.
[0047]
[0048] Tables 1 and 2 above are the direct output results. Now, taking the results in Table 1 as an example, the specific operation process is as follows:
[0049] The input is as follows. Each message will include a timestamp of when it was published. Besides messages about Singles' Day and the NBA as shown in Examples 1 and 2, there are many other topics, such as telecom fraud and the Champions League. Each message will include... Figure 1 The node document d in the table is shown in Table 1.1 below.
[0050] Table 1.1 Original timestamps and message inputs
[0051]
[0052] After the first layer of clustering, related messages will be in the same cluster; that is, messages related to Singles' Day, NBA, and the Champions League will be in different clusters. (See attached image.) Figure 1 After subgraph extraction, the documents are divided into different clusters (two categories are shown in the example in the figure). After this step, the Double Eleven related messages in the input will be clustered into one cluster, as shown in Table 1.2 below:
[0053] Table 1.2 Document Clustering After Subgraph Extraction
[0054]
[0055]
[0056] Next, we perform fine-grained clustering within this cluster, that is, clustering nodes related to Double Eleven. After clustering, messages describing the same event will be grouped into a new small cluster, as shown in the attached diagram. Figure 1 After being detected by the community's internal event monitoring system, document d appears in different colors, with each color representing a small cluster. In the table above, the first and second messages each form a cluster, and the last three messages form another cluster, i.e., three events e.
[0057] Finally, a time and summary are generated for each event (cluster). The timestamps of each message in the cluster are summed, averaged, and then converted into a time format to represent the event's occurrence time. For summary generation, taking a cluster with three messages as an example, the three messages are sorted in descending order of node degree, and then concatenated together in this order. Based on the maximum number of input tokens in the large model used, the top_k nodes are selected. After truncation, the constructed prompt is fed into the large model to obtain the summary as follows: "Double Eleven shopping festival sales hit record highs, e-commerce in Jingzhou and Qinghai performed outstandingly, and sales of Three Squirrels and Wenzhou footwear and apparel companies increased significantly." After performing this process for each event cluster, sorting by time yields the event timeline.
[0058] The contents of Table 2 can also be obtained in the same way. After performing this process on each event cluster, sorting them by time will give the timeline of the events. This will not be repeated here.
[0059] The experiments clearly demonstrate that using large models for multi-document summarization and event sorting can effectively extract key information from each event, providing a concise and clear event overview and generating a clear event timeline. This allows users to intuitively understand the development process and chronological order of events. Furthermore, the community detection algorithm based on structural entropy improves the efficiency and accuracy of clustering through a more efficient data processing mechanism, making it particularly suitable for complex social media data analysis.
[0060] The preferred embodiments of the present invention disclosed above are only for the purpose of illustrating the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation described.
Claims
1. A method for generating social event context based on two-layer entropy graph clustering, characterized in that, Includes the following steps: S1. Preprocess social media data; S2. Apply the KeyBERT model to each message to be processed to extract keywords; S3. Construct a keyword graph and perform coarse-grained topic clustering using a clustering algorithm based on structural entropy. Specifically, when two keywords appear in the same message, traverse the keywords of each message and calculate the co-occurrence frequency of each keyword pair. Construct a keyword co-occurrence graph using the deduplicated keywords from S2 as nodes, and build an edge between nodes with a co-occurrence frequency greater than a threshold. After the graph is constructed, a community detection algorithm based on structural entropy is applied to the graph to perform coarse-grained topic clustering. S4. Based on the results of S3, perform community selection for messages on social media; S5. Construct a graph of the messages and, based on the results of S4, perform fine-grained event clustering within each community; specifically: S5.1: Treat each message as a node and construct a message graph; first, construct it based on keyword frequency. Based on the keywords extracted from each message in S2, if the number of identical keywords in two messages is greater than or equal to 2, then construct an edge for the two nodes. S5.2: Then use SentenceBert to calculate the similarity between each pair of messages. If the similarity between two messages is less than 0.3 and there is an edge between the two messages, delete the existing edge; if the similarity is greater than 0.7 and there is no edge between the two messages, add an edge; if the similarity is between 0.3 and 0.7, do not make any changes. S5.3: Based on community matching in S4, extract subgraphs from the messages within each community, and apply an event detection algorithm based on structural entropy within the community; S6. Extract the event occurrence time and generate multi-document summaries of multiple messages of the event using a large model; S7. Sort each event by time to generate an event timeline, which is to sort the summary and content generated in S6 by time and output the results. S6.1: Based on S5, messages are divided into multiple clusters within the community. Each cluster of messages represents an event, and each message corresponds to its publication time or timestamp. These are then uniformly converted into timestamps. The timestamps of the messages in each cluster are summed and averaged, and then converted into a time accurate to year, month, and day, which is used as the occurrence time of the event. S6.2: For generating a summary for each cluster, use the large model to generate the message content of the k nodes with the highest degree within the cluster, and use "||" to separate each message. Then, truncate the concatenated content according to the maximum number of input tokens supported by the large model, and construct an effective prompt word.
2. The method for generating social event context based on two-layer entropy graph clustering according to claim 1, characterized in that, In step S4, after applying the community detection algorithm to the keyword co-occurrence graph in step S3, each community is obtained as a bag-of-words model. Each community is treated as a document, the similarity between each message and the community is calculated, and the community with the highest similarity is selected for the message, i.e., community matching.
3. The method for generating social event context based on two-layer entropy graph clustering according to claim 1, characterized in that, In step S2, a pre-trained BERT model is used, and a set of keywords that best represents the topic of the message is generated in combination with the content of the message. Then, the keywords of all messages are put into a set to remove duplicates and used as nodes in the co-occurrence graph.
4. The method for generating social event context based on two-layer entropy graph clustering according to claim 1, characterized in that, In S1, S1.1: For the collected social media data, filter out the valid content, that is, the content with more than 20 characters in the message, because short messages are usually regarded as noise or irrelevant information, which is not conducive to event detection and timeline construction; S1.2: After the message filtering is completed, the text is segmented using a word segmentation algorithm.
Citation Information
Patent Citations
Network public opinion topic feature extraction method and system
CN112926305A
Event context generation method and system integrated with deep semantic relationship classification
CN114265932A
Social media event detection method combining deep learning classification and graph clustering
CN117974340A