Network event context generation method and device, storage medium and program product
Generate network event contexts through pre-training language models and context rewriters, solving the problem of high hardware computing power demand and achieving efficient and accurate event context generation.
Patent Information
- Application Number
- CN202510568609.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-04-30
Smart Images

Figure CN120494092A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, storage medium and program product for generating a network event context. Background Art
[0002] Cyber incidents refer to various behaviors and phenomena occurring online, including but not limited to verbal attacks, personal attacks, privacy exposure, malicious defamation, and other forms of online violence, as well as other forms such as the spread of false information, the manipulation of public opinion, and social movements. These behaviors and phenomena can cause personal mental harm or reputational damage, and can also have widespread social impacts. With the widespread adoption of the internet and the development of social media, various cyber incidents have become increasingly frequent, posing numerous challenges and negative impacts on society. To effectively address these issues, the need for fast and efficient solutions for generating cyber incident contexts is becoming increasingly urgent.
[0003] Currently, traditional methods for generating network event context include those based on unsupervised learning, graph neural networks, and large language models. These solutions extract information through empirical learning and require high computing power. When high accuracy is required, they place high demands on hardware and deployment solutions. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a network event context generation method, device, storage medium, and program product to eliminate or improve one or more defects existing in the prior art, and to solve the problem that the prior art requires high hardware computing power during the network event context generation process and is difficult to deploy in actual applications.
[0005] One aspect of the present invention provides a method for generating a network event context, the method comprising the following steps:
[0006] Obtaining at least one event post by a target user regarding a target event and its corresponding posting time on multiple network platforms;
[0007] Input the event post into the pre-trained language model to obtain the vector representation of each word;
[0008] Extract the extractive summary corresponding to each event post respectively, and add sentence tags to the summary sentences in the extractive summary in order;
[0009] Based on semantic matching, the summary sentence is associated and matched to the event sentence in each event post, and the sentence identifier of the summary sentence corresponding to the word element tag in the event sentence is used as a group tag;
[0010] The group tag of each word is vectorized to obtain the corresponding group tag embedding, and then combined with the vector representation of each word to obtain the word representation;
[0011] The word-gram representation of each word in each event post is input into the preset context rewriter, which outputs the rewritten summary text of each event post; the context rewriter is a decoder based on the Transformer architecture;
[0012] The rewritten summary text is filtered for semantic similarity and sorted by publication time to obtain the event context corresponding to the target event.
[0013] In some embodiments of the present invention, obtaining at least one event posting by a target user regarding a target event and its corresponding posting time on multiple network platforms includes:
[0014] According to the event ID of the target event and the user ID of the target user, the initial event post, the social interaction data corresponding to the initial event post, and the posting time are screened across multiple network platforms;
[0015] Based on the social interaction data and the pre-assigned weights for each piece of social interaction data, a weighted calculation is performed to obtain the social interaction features corresponding to each initial event post;
[0016] Sort the initial event posts by their corresponding posting time, and use the corresponding social interaction features as dependent variables to construct a curve graph;
[0017] The initial event post corresponding to the peak in the curve graph is retained to obtain at least one event post.
[0018] In some embodiments of the present invention, after retaining the initial event post corresponding to the peak in the curve graph and obtaining at least one event post, the method further includes:
[0019] Multiply the mean of the social interaction features corresponding to the initial event post by the preset coefficient to obtain the feature threshold;
[0020] The retained event posts are further screened using the feature threshold, and event posts whose social interaction features are greater than the feature threshold are retained.
[0021] In some embodiments of the present invention, the training process of the context rewriter includes:
[0022] Obtain sample training data; the sample training data includes sample text and corresponding sample summary; word units in the sample text are added with group tags;
[0023] Vectorize the group tag of each word in the sample text to obtain the corresponding group tag embedding, and combine it with the vector representation corresponding to each word to obtain the sample word representation;
[0024] Input the sample word unit representation into the initial Transformer model to obtain the rewriting result;
[0025] Input the rewriting result and sample summary into the preset loss function to obtain the loss result;
[0026] The loss results are used to iterate the parameters of the initial Transformer model until the model converges to obtain the context rewriter.
[0027] In some embodiments of the present invention, performing semantic similarity filtering on the rewritten summary text includes:
[0028] The rewritten summary text is input into the pre-trained semantic similarity model in the form of a text pair, and a similarity label is output; the similarity label is used to indicate the degree of semantic similarity of the input text pair; the semantic similarity model includes an input embedding layer, an output encoding layer, and an angle difference acquisition layer; the input embedding layer is used to receive the input text pair and generate the real embedding and imaginary embedding corresponding to each word in the text pair; the output encoding layer is used to input the real embedding and imaginary embedding into the pre-trained language model to obtain the encoding output; the angle difference acquisition layer is used to construct a complex representation of the input text pair based on the encoding output, calculate the angle difference between the two complex representations through complex division, and determine the similarity label of the input text pair;
[0029] The text pairs with the same semantics indicated by the similarity labels are selected and retained.
[0030] In some embodiments of the present invention, the pre-training process of the semantic similarity model includes:
[0031] Obtain training data; the training data includes sample text pairs and corresponding sample similarity labels; the sample text pairs include positive sample text pairs and negative sample text pairs;
[0032] Input the sample text pairs into the initial semantic similarity model to obtain the training results;
[0033] Input the training results and sample similarity labels into the preset loss function to obtain the loss result; the preset loss function includes the angle target loss function and the supervised contrast learning target loss function;
[0034] The initial semantic similarity model is iteratively trained based on the loss results, and the model parameters are updated until the model converges to obtain a language similarity model.
[0035] In some embodiments of the present invention, performing semantic similarity filtering on the rewritten summary text includes:
[0036] Input the rewritten summary text into the pre-trained language model to obtain the vector representation corresponding to each rewritten summary text;
[0037] Determine the similarity between each pair of rewritten summary texts based on the vector representation corresponding to each rewritten summary text and a preset similarity algorithm;
[0038] The similarity between each rewritten summary text pair is compared with a preset similarity threshold, and one of the texts in the rewritten summary text pair whose similarity is greater than the preset similarity threshold is selected and retained.
[0039] Another aspect of the present invention provides a network event context generation device, comprising a processor, a memory, and a computer program / instruction stored in the memory, wherein the processor is configured to execute the computer program / instruction. When the computer program / instruction is executed, the device implements the steps of the network event context generation method described above.
[0040] Another aspect of the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, which implements the steps of the network event context generation method as described above when the computer program / instruction is executed by a processor.
[0041] Another aspect of the present invention provides a computer program product, comprising a computer program / instruction, which implements the steps of the above-mentioned method for generating a network event context when executed by a processor.
[0042] The beneficial effects of the present invention include at least:
[0043] The network event context generation method and device of the present invention are used to solve the problem that the existing technology requires high hardware computing power during the network event context generation process and is difficult to deploy in practical applications; by using the pre-trained language model BERT to generate vector representations of word units in each event post, extracting the extractive summary corresponding to each event post, associating the summary sentence in the extractive summary with the event sentence in the corresponding event post and marking the word units in the event sentence with group tags, and embedding the vector representation of the word units with the group tags corresponding to the group tags to guide the subsequent summary text generation; the word unit representation corresponding to each event post is input into a lightweight context rewriter. The small model outputs the rewritten summary text, and finally filters out the semantically repeated summary text and sorts it by time to obtain the event context. In this way, through extractive summarization and lightweight small models, event context can be generated without deploying complex large language models. It can significantly reduce the demand for hardware performance and simplify the deployment process. It can run efficiently in resource-limited scenarios and achieve high-precision event context generation. At the same time, through the precise target user and target event screening mechanism, a large number of irrelevant noise posts in social media can be effectively filtered out, ensuring that the generated event context focuses on truly valuable event information, thereby improving the accuracy and relevance of the generated event context.
[0044] In addition, by integrating the three social interaction data of likes, reposts and comments of all initial event posts, we can determine the social interaction characteristics, construct a curve chart by sorting the posts by posting time, and accurately extract the event posts corresponding to the peaks in the event development process. Taking into account the overall trend of the development of the target event, we can more comprehensively capture all the key nodes from the beginning to the end of the event, so that the final event context is complete and meaningful.
[0045] In addition, in order to more accurately extract event posts at key nodes, it is also necessary to determine a feature threshold based on the social interaction characteristics, and further filter the event posts corresponding to the peaks, and filter out the event posts corresponding to the peaks whose social interaction characteristics are less than the feature threshold. In this way, those event posts that are truly highly influential can be effectively identified and retained, so that the final event context can more truly reflect the development dynamics of the event and its social repercussions.
[0046] In addition, a small model is used to perform semantic similarity filtering on the rewritten summary text to remove redundant text with the same semantics, thereby improving the conciseness and readability of the final generated event context.
[0047] Additional advantages, objects, and features of the present invention will be set forth in part in the following description and will become apparent to those skilled in the art upon examination of the following or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained by the structures particularly pointed out in the description and drawings.
[0048] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present invention are not limited to the above specific descriptions, and the above and other purposes that can be achieved by the present invention will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention. In the drawings:
[0050] Figure 1 This is a flow chart of a method for generating a network event context provided by one embodiment of the present invention.
[0051] Figure 2 A schematic diagram of a framework of a method for generating a network event context provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0053] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, the accompanying drawings only show structures and / or processing steps closely related to the solutions according to the present invention, while other details that are not closely related to the present invention are omitted.
[0054] It should be emphasized that the term "include / comprises" when used herein refers to the existence of features, elements, steps or components, but does not exclude the existence or addition of one or more other features, elements, steps or components.
[0055] It should also be noted that, unless otherwise specified, the term "connection" herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.
[0056] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0057] The following is a detailed introduction to the channel reconstruction method based on a multi-probe microwave darkroom provided by this application.
[0058] This embodiment provides a channel reconstruction method based on a multi-probe microwave darkroom, such as Figure 1 As shown, the method at least includes the following steps S101 to S107:
[0059] Step S101: obtaining at least one event post of a target user regarding a target event and its corresponding posting time from multiple network platforms.
[0060] The target event is the event whose context needs to be organized. The target user is the social platform user (such as an authoritative news media or a large enterprise) who posts text content about the target event on multiple social platforms. The event post is the news, announcement, or post about the target event published by the target user on multiple online platforms.
[0061] In some embodiments of the present invention, obtaining posts related to a target event posted by a target user on a social platform includes at least the following two stages:
[0062] The first stage is the official publication acquisition stage, in which the official publication is obtained by querying the user ID of the target user and the event ID of the target event.
[0063] The event identifier uniquely identifies the target event, and different target events correspond to different event identifiers. The event identifier can be a keyword or combination of keywords related to the target event; alternatively, the event identifier can be an identifier consisting of numbers, letters, or characters. This embodiment does not limit the implementation of the event identifier.
[0064] User identification refers to an identifier used to indicate the identity of a user, including identifiers used to uniquely indicate the identity of a user on multiple social platforms (such as user name, user ID, email address used by the user when registering on a social platform, or other forms of identifiers, etc.) or identifiers used to indicate the user category (such as authentication identifiers for media, enterprises, students, etc.).
[0065] On every social platform, user IDs are typically used to distinguish different user categories. User categories will influence the subsequent determination of key event posts. Therefore, it is necessary to use user category identification to obtain a more comprehensive set of event posts that are conducive to event path extraction, completely filtering out irrelevant posts and obtaining the initial event posts.
[0066] For example, consider a user ID that is a number, including 1-6. 1 represents an enterprise user, 2 represents a media organization, 3 represents a campus user, 4 represents a website user, 5 represents an application user, and 6 represents a group. At the official post acquisition stage, the user ID can be set to 1 or 2, and combined with the event ID of the target event, the key event post corresponding to the target event can be retrieved and saved.
[0067] Specifically, official posts are filtered out using the user ID of the target user and the event ID of the target event, including: searching for user posts corresponding to the target event in multiple social platforms using the event ID and user ID; or, user posts in multiple social platforms are pre-stored in a designated database (such as a MySQL or Oracle database), and user posts related to the target event are queried in the database using the event ID and user ID.
[0068] The second stage is the official post screening stage, where official posts are screened based on social interaction data.
[0069] Among them, social interaction data refers to various data generated when users post and interact with other users on social platforms, which is used to reflect other users' interest and participation in the content and the dissemination effect of the content.
[0070] Because highly interactive event posts can quickly gather a large number of comments, shares, and likes, they become real-time indicators of event progress, providing first-hand information for constructing a complete event context, better reflecting changes in public opinion and sentiment, and more accurately grasping the overall development of the event and its impact. Based on this, in some embodiments of the present invention, initial event posts are screened using social interaction data, and event posts with high social interaction data are selected as key posts.
[0071] The initial event posts obtained by querying the event identifier of the target event and the user identifier of the target user are further screened through social interaction data to find event posts with high social activity data.
[0072] For example: Reference Figure 2 First, event posts corresponding to the target event are screened out on the social platform, including event posts m1 to m6. Among event posts m1 to m6, they are screened according to the target user identifier to obtain event posts m1, m3, m5, and m6 about the target event published by the target user. Then, they are further screened according to the social interaction data to obtain key event posts, including event posts m1, m5, and m6.
[0073] In some embodiments of the present invention, the social interaction data includes the number of reposts, the number of likes and / or the number of comments.
[0074] Specifically, at least one event post of a target user regarding a target event and its corresponding posting time are obtained in multiple network platforms, including: according to the event identifier of the target event and the user identifier of the target user, screening the initial event post, the social interaction data corresponding to the initial event post, and the posting time in multiple network platforms; comparing the forwarding volume in the social interaction data with a preset forwarding volume threshold, and retaining the initial event post whose forwarding volume is greater than the preset forwarding volume threshold; and / or, comparing the like volume in the social interaction data with a preset like volume threshold, and retaining the initial event post whose like volume is greater than the preset like volume threshold; and / or, comparing the comment volume in the social interaction data with a preset comment volume threshold, and retaining the initial event post whose comment volume is greater than the preset comment volume threshold.
[0075] In other embodiments of the present invention, different weights are assigned to the three characteristic variables of the number of likes, forwarding and comments of official posts, and the social interaction features are obtained by adding and fusing them to serve as the basis for screening.
[0076] The weights of likes, reposts, and comments can be the same or different. For example, the weights of likes, reposts, and comments can be 1, 0.5, and 0.5, respectively; or, the weights of likes, reposts, and comments can be 0.7, 0.4, and 0.6, respectively. This embodiment does not limit the weights of likes, reposts, and comments.
[0077] After calculating the social interaction features corresponding to each initial event post, each initial event post is arranged in chronological order according to the posting time, and a curve graph is formed with the social interaction features as the dependent variable. The initial event post corresponding to the peak in the curve graph is identified as the key event post.
[0078] Specifically, at least one event post of a target user regarding a target event and its corresponding posting time are obtained in multiple network platforms, including: screening the initial event post, the social interaction data corresponding to the initial event post, and the posting time in multiple network platforms according to the event identifier of the target event and the user identifier of the target user; performing weighted calculation based on the social interaction data and the pre-assigned weight of each item of social interaction data to obtain the social interaction features corresponding to each initial event post; sorting the initial event posts according to the corresponding posting time, and constructing a curve graph with the corresponding social interaction features as the dependent variable; retaining the initial event post corresponding to the peak in the curve graph to obtain at least one event post.
[0079] In actual implementation, the social interaction data may also include the number of reports, the number of favorites, or the length of reading, etc. This embodiment does not limit the implementation method of the social interaction data.
[0080] In addition, in order to screen out key event posts that have the greatest public attention and social influence, while avoiding the misselection of unrepresentative event posts due to short-term abnormal activity, and to ensure the accuracy and effectiveness of event context generation, after determining the social interaction characteristics of the initial event post, it is also necessary to combine all social interaction characteristics to calculate a feature threshold suitable for the target event, so as to further screen the event posts corresponding to the peaks in the curve graph.
[0081] By filtering out event posts corresponding to peaks whose social interaction features are less than the feature threshold, we can effectively identify and retain truly influential event posts, thereby further optimizing the quality of the final event post collection and making the final event posts more truly reflect the development dynamics of the event and its social repercussions.
[0082] In some embodiments of the present invention, the feature threshold is calculated by multiplying the mean social interaction feature value corresponding to the initial event post by a preset coefficient. The preset coefficient may include 0.7, 0.8, or 0.9. In actual implementation, the preset coefficient can be flexibly adjusted according to different target events so that the calculated feature threshold can adapt to different target events. This embodiment does not limit the value of the preset coefficient.
[0083] Specifically, the initial event posts are further screened based on the curve graph, and the initial event posts corresponding to the peaks in the curve graph are retained. After obtaining the at least one event post, it also includes: multiplying the mean of the social interaction characteristics corresponding to the initial event post by a preset coefficient to obtain a feature threshold; using the feature threshold to further screen the retained event posts, and retaining event posts whose social interaction characteristics are greater than the feature threshold.
[0084] In actual implementation, the event posts corresponding to the peaks in the graph can also be further filtered by percentage, for example, only the top 80% or 90% of the event posts corresponding to the peaks are retained. This embodiment does not limit the implementation method of further filtering the event posts corresponding to the peaks in the graph.
[0085] Step S102: Input the event post into a pre-trained language model to obtain a vector representation of each word therein.
[0086] In some embodiments of the present invention, the pre-trained language model BERT is used to encode the original event post, and the semantic capture capability of the BERT model is used to deeply understand the text content of the event post and convert it into a high-dimensional vector representation.
[0087] In the process of obtaining vector representations through the pre-trained language model, by adjusting the hyperparameters of the BERT model, the number of sentences extracted from event posts can be flexibly controlled according to actual needs to achieve better recall rates or adapt to the needs of specific tasks.
[0088] Step S103 : extracting the extractive summary corresponding to each event post respectively, and adding sentence tags to the summary sentences in the extractive summary in order.
[0089] Among them, extractive summarization refers to a summary formed by selecting sentences or phrases from the original event post. It is easy to implement and stable. Because it directly uses sentences from the original text, it will not cause grammatical errors or deviation from the topic.
[0090] In some embodiments of the present invention, extractive summaries may be extracted from each event post using word, word frequency, and position statistics.
[0091] In actual implementation, other natural language processing technologies, such as abstract summarization, semantic analysis, keyword extraction, etc., can also be used to extract the summaries corresponding to each event post.
[0092] After obtaining the extractive summaries corresponding to each event post, sentence identifiers are sequentially added to the summary sentences in each extractive summary. The sentence identifiers can be any one or a combination of numbers, letters, or characters. This embodiment does not limit the implementation of sentence identifiers.
[0093] For example, taking the extractive summary including summary m1 and summary m5 as an example, summary m1 includes sentence a and sentence b, sentence a is marked as 1 and sentence b is marked as 2; summary m5 includes sentence c, sentence c is marked as 1.
[0094] Step S104 : Associating and matching the summary sentence with the event sentence in each event post based on semantic matching, and using the sentence identifier of the summary sentence corresponding to the word element tag in the event sentence as a group tag.
[0095] By semantically matching the summary sentences in the extractive summary with the event sentences in the original event post, and adding the same sentence identifiers as the corresponding summary sentences to the original event post's tokens as group tags, a direct connection between the extractive summary and the original event post is established. This allows for more accurate positioning during the subsequent rewriting process through group tags. This effectively improves the quality of the subsequent rewritten summary text and reduces algorithmic complexity without using reinforcement learning or replication mechanisms.
[0096] For example: take the extractive summary n5 and its corresponding event post m5 as an example; the extractive summary n5 includes sentence d and sentence e, the sentence identifier of sentence d is 4, and the sentence identifier of sentence e is 5; the event post m5 includes sentence D and sentence E; perform semantic matching on the extractive summary n5 and the event post m3, and label the group 4 for sentence D and each word in sentence D, and label the group 5 for sentence E and each word in sentence E.
[0097] In some embodiments of the present invention, the similarity between the summary sentence in the extractive summary and the event sentence in the event post is calculated using cosine similarity or other similarity metrics, and the extractive summary and the event post are semantically matched. For each summary sentence, the event sentence with the highest similarity is selected as the matching result.
[0098] In step S105 , the group tag of each word unit is vectorized to obtain a corresponding group tag embedding, and the embedding is combined with the vector representation of each word unit to obtain a word unit representation.
[0099] In some embodiments of the present invention, the group tag embedding corresponding to a word-gram can be obtained through a group tag query. For each group tag, a fixed-dimensional group tag vector is initialized as the group tag embedding for that group tag. The group tag embedding and vector representation of the same word-gram are in the same vector space.
[0100] Specifically, the group tag of each word is vectorized to obtain the corresponding group tag embedding, including: querying and obtaining the group tag embedding corresponding to the group tag of each word through a preset mapping relationship between the group tag and the group tag embedding.
[0101] In actual implementation, the group tag embedding can also be pre-initialized using parameters in a pre-trained language model. This embodiment does not limit the implementation method of the group tag vectorization of each word.
[0102] The group tag embedding of each word is combined with the corresponding vector representation to obtain the word-unit representation corresponding to each word.
[0103] In some embodiments of the present invention, a word-gram representation is obtained by directly concatenating the group tag embedding with the vector representation. This preserves more of the original information. For example, if the vector representation of a word-gram is 768-dimensional and the corresponding group tag embedding is also 768-dimensional, the resulting concatenated word-gram representation will be 1536-dimensional.
[0104] In other embodiments of the present invention, the group tag embedding is directly added to the vector representation via vector addition to obtain the word-gram representation to simplify operations. For example, if the vector representation is a 768-dimensional vector and the corresponding group tag embedding is also a 768-dimensional vector, then these two vectors can be directly added, and the result is still a 768-dimensional vector, which serves as the word-gram representation of the word.
[0105] Step S106 : inputting the word-gram representation of each word-gram in each event post into a preset context rewriter, and outputting a rewritten summary text of each event post.
[0106] The context rewriter is a decoder based on the Transformer architecture and is trained based on a pre-set Transformer model.
[0107] Specifically, the training process of the context rewriter includes: obtaining sample training data, which includes sample text and corresponding sample summaries; adding group tags to the word units in the sample text; vectorizing the group tags of each word unit in the sample text to obtain the corresponding group tag embedding, and combining it with the vector representation corresponding to each word unit to obtain the sample word unit representation; inputting the sample word unit representation into the initial Transformer model to obtain the rewriting result; inputting the rewriting result and the sample summary into the preset loss function to obtain the loss result; using the loss result to iterate the parameters of the initial Transformer model until the model converges to obtain the context rewriter.
[0108] The preset loss function includes but is not limited to a cross-entropy loss function or a contrastive loss function.
[0109] After the word-unit representations, enhanced with group tag embeddings, are fed into the context rewriter, they are decoded using its Transformer architecture. During decoding, each sentence is treated as an independent group. During the context rewriter's beam search, the group tag embeddings guide the context rewriter in real time as it generates the next word or sentence. Each time the context rewriter selects the next word, it not only considers the probability distribution of the current sequence but also references the group tag of the current path to decide whether to continue constructing sentences belonging to the same group. This ensures that the rewritten summary reflects the structure of the original text while improving coherence and accuracy.
[0110] Furthermore, when rewriting the summary using group token embeddings, the contextual rewriter's attention mechanism is constrained to ensure that the k-th sentence generated corresponds to the k-th summary text in the original event post. The rewritten summary begins with a special marker [BOS], separates sentences with [SEP], and ends with [EOS]. This allows for effective compression and rewriting of the summary text while maintaining the completeness and accuracy of the summary content, thereby improving the conciseness and readability of the rewritten summary text.
[0111] For example: Reference Figure 2 . The lemma representation of each lemma in the event post m1 is input into the context rewriter to obtain the rewritten summary text n1; the lemma representation of each lemma in the event post m5 is input into the context rewriter to obtain the rewritten summary text n5; the lemma representation of each lemma in the event post m6 is input into the context rewriter to obtain the rewritten summary text n6.
[0112] Step S107 , filtering the rewritten summary texts for semantic similarity and sorting them by posting time to obtain the event context corresponding to the target event.
[0113] Since some parts of the rewritten summary text may have similar semantics, after obtaining the rewritten summary text through the context rewriter, it is necessary to perform semantic similarity filtering on the rewritten summary text to remove redundant text with repeated semantics, thereby improving the conciseness and readability of the final generated event context.
[0114] For example: Reference Figure 2 . Take the semantic similarity filtering of rewritten summary text n1, rewritten summary text n5 and rewritten summary text n6 as an example; when the semantics of rewritten summary text n1 and rewritten summary text n6 are similar, rewritten summary text n1 is retained, and the final event context is constructed based on rewritten summary text n1 and rewritten summary text n5; or, when the semantics of rewritten summary text n5 and rewritten summary text n6 are similar, rewritten summary text n5 is retained, and the final event context is constructed based on rewritten summary text n1 and rewritten summary text n5.
[0115] In some embodiments of the present invention, the rewritten summary text is input into a pre-trained small model, the language similarity model, in the form of a text pair. The language similarity model performs deep semantic similarity judgment on the input text pair based on angle-optimized embedding, and outputs a similarity label for the input text pair.
[0116] The similarity tag is used to indicate the semantic similarity between the input text pairs. According to the semantic similarity indicated by the similarity tag, redundant summary texts with similar semantics are filtered out, so that each filtered rewritten summary text is semantically unique.
[0117] Specifically, the rewritten summary text is subjected to semantic similarity filtering, including: inputting the rewritten summary text into a pre-trained semantic similarity model in the form of a text pair, outputting a similarity label; and retaining one of the text pairs whose similarity labels indicate the same semantics.
[0118] In some embodiments of the present invention, the semantic similarity model includes an input embedding layer, an output encoding layer, and an angle difference acquisition layer.
[0119] The input embedding layer receives text pairs and generates real and imaginary embeddings for each word in the pair. By decomposing text embeddings into real and imaginary parts, we can use the real part to learn surface differences and the imaginary part to learn subtle semantic differences, thereby better exploring the similarity of embeddings between sentences.
[0120] The output encoding layer is used to input the real embedding and the imaginary embedding into the pre-trained language model (BERT model) to obtain the encoded output, including the real text embedding and the imaginary text embedding.
[0121] In actual implementation, the output encoding layer can also obtain the encoding corresponding to the real embedding and the imaginary embedding through other methods, such as inputting the real embedding and the imaginary embedding into other language models (such as Large Language Model MetaAI) to obtain the corresponding encoding output.
[0122] The angle difference layer constructs the complex representation of the input text pair based on the encoding output, calculates the angle difference between the two complex representations through complex division, and determines the similarity label of the input text pair.
[0123] Among them, taking the text pair including text A and text B as an example, the plural form of text A is represented by z A and text B pluralizes z B , can be expressed by the following formulas:
[0124] Z A =x A +iy A
[0125] Z B =x B +iy B
[0126] Where x A represents the real text embedding of text A; y A represents the imaginary text embedding of text A; x B represents the real text embedding of text B; y B represents the imaginary text embedding of text B; i represents the imaginary unit.
[0127] Complex number division calculates the angle difference between two complex numbers and can be expressed as follows:
[0128]
[0129] Where x A represents the real text embedding of text A; y A represents the imaginary text embedding of text A; x B represents the real text embedding of text B; y B Represents the imaginary text embedding of text B.
[0130] In some embodiments of the present invention, the semantic similarity model is trained using a supervised contrastive loss function as an auxiliary objective, combined with the angle objective and the auxiliary objective as the final loss function. Specifically, the final loss function can be expressed as follows:
[0131] L=w1·L angle+w2·L cl
[0132] Where, L angle Indicates the angle target; L cl represents the supervised contrastive learning objective; w1 represents the weight of the angle objective; w2 represents the weight of the supervised contrastive learning objective.
[0133] The angle objective is used to minimize the angle difference between text pairs with high similarity, while maximizing the angle difference between text pairs with low similarity. This helps to reflect subtle semantic differences in the cosine saturation region and alleviate the negative impact of gradient vanishing. Specifically, the angle objective L angle It can be expressed by the following formula:
[0134]
[0135] Where s ij Represents the sample text pair for training (x i , x j ) similarity; Δθ ij Represents a sample text pair (x i , x j ) angle difference; s mn Represents a sample text pair (x m , x n ) similarity; Δθ mn Represents a sample text pair (x m , x n ); τ represents the temperature hyperparameter.
[0136] Supervised contrastive learning objective L cl It can be expressed by the following formula:
[0137]
[0138] Where τ represents the temperature hyperparameter; b represents the bth training batch; n represents the number of positive sample texts; N represents the size of each training batch; Represents the i-th sample text in the b-th training batch; express Corresponding positive sample text; Represents sample text The corresponding positive sample text.
[0139] By comprehensively learning text embeddings from multiple perspectives, the overall performance of the model is improved, enabling it to perform well on different tasks and datasets. At the same time, defining angular targets in a complex space can more effectively reflect the subtle semantic differences between embedding pairs in the cosine saturation region, alleviate the negative impact of gradient vanishing, and enable the model to better learn semantic similarity.
[0140] Specifically, the pre-training process of the semantic similarity model includes: obtaining training data; the training data includes sample text pairs and corresponding sample similarity labels; the sample text pairs include positive sample text pairs and negative sample text pairs; the sample text pairs are input into the initial semantic similarity model to obtain training results; the training results and sample similarity labels are input into a preset loss function to obtain loss results; the training results and sample similarity labels are input into a preset loss function to obtain loss results; the preset loss function includes sorting, angle target loss function and supervised contrastive learning target loss function; the initial semantic similarity model is iteratively trained based on the loss results, and the model parameters are updated until the model converges to obtain a language similarity model.
[0141] In other embodiments of the present invention, a vector representation corresponding to each rewritten summary text is extracted through the pre-trained language model BERT, and the similarity between different rewritten summary texts is determined based on a preset similarity algorithm to remove redundant summary texts with repeated semantics.
[0142] The preset similarity algorithm includes, but is not limited to, a cosine similarity algorithm, an Euclidean distance, or a Manhattan distance. This embodiment does not limit the similarity algorithm.
[0143] Specifically, the rewritten summary text is subjected to semantic similarity filtering, including: inputting the rewritten summary text into a pre-trained language model to obtain a vector representation corresponding to each rewritten summary text; determining the similarity between each rewritten summary text pair based on the vector representation corresponding to each rewritten summary text and a preset similarity algorithm; comparing the similarity between each rewritten summary text pair with a preset similarity threshold, and selecting and retaining one of the texts in the rewritten summary text pair whose similarity is greater than the preset similarity threshold.
[0144] In summary, the network event context generation method provided by this embodiment is used to solve the problem that the existing technology requires high hardware computing power in the process of network event context generation and is difficult to be deployed in actual applications; by using the pre-trained language model BERT to generate vector representations of the word units in each event post, extracting the extractive summary corresponding to each event post, associating the summary sentence in the extractive summary with the event sentence in the corresponding event post and marking the word units in the event sentence with group tags, and embedding the vector representation of the word units through the group tags corresponding to the group tags to guide the subsequent summary text generation; the word unit representation corresponding to each event post is input into the context rewriter, a lightweight A small model at the same level is used to output the rewritten summary text. Finally, the semantically repeated summary text is filtered out and the event context is obtained by sorting it in time. In this way, event context can be generated through extractive summarization and lightweight small models without deploying complex large language models. It can significantly reduce the demand for hardware performance and simplify the deployment process. It can run efficiently in scenarios with limited resources and achieve high-precision event context generation. At the same time, through the precise target user and target event screening mechanism, a large number of irrelevant noise posts in social media can be effectively filtered out, ensuring that the generated event context focuses on truly valuable event information, thereby improving the accuracy and relevance of the generated event context.
[0145] In addition, by integrating the three social interaction data of likes, reposts and comments of all initial event posts, we can determine the social interaction characteristics, construct a curve chart by sorting the posts by posting time, and accurately extract the event posts corresponding to the peaks in the event development process. Taking into account the overall trend of the development of the target event, we can more comprehensively capture all the key nodes from the beginning to the end of the event, so that the final event context is complete and meaningful.
[0146] In addition, in order to more accurately extract event posts at key nodes, it is also necessary to determine a feature threshold based on the social interaction characteristics, and further filter the event posts corresponding to the peaks, and filter out the event posts corresponding to the peaks whose social interaction characteristics are less than the feature threshold. In this way, those event posts that are truly highly influential can be effectively identified and retained, so that the final event context can more truly reflect the development dynamics of the event and its social repercussions.
[0147] In addition, a small model is used to perform semantic similarity filtering on the rewritten summary text to remove redundant text with the same semantics, thereby improving the conciseness and readability of the final generated event context.
[0148] Corresponding to the above method, the present invention also provides a network event context generation device, which includes a computer device, the computer device includes a processor and a memory, the memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the network event context generation method as described above.
[0149] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the aforementioned network event context generation method. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the art.
[0150] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the aforementioned network event context generation method when executed by a processor.
[0151] It should be understood by those skilled in the art that the various exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is specifically performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0152] It should be understood that the present invention is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted. In the above embodiments, several specific steps are described and illustrated as examples. However, the method of the present invention is not limited to the specific steps described and illustrated. Those skilled in the art may make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present invention.
[0153] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or replace features of other embodiments.
[0154] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations to the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A method for generating a network event context, characterized in that: The method comprises the following steps: Obtaining at least one event post by a target user regarding a target event and its corresponding posting time on multiple network platforms; Input the event post into a pre-trained language model to obtain a vector representation of each word; Extracting extractive summaries corresponding to each event post respectively, and adding sentence identifiers to the summary sentences in the extractive summaries in order; Associating and matching the summary sentence with the event sentences in each of the event posts based on semantic matching, and using the sentence identifier of the summary sentence corresponding to the word meta-tag in the event sentence as a group tag; Vectorizing the group tags of each word unit to obtain a corresponding group tag embedding, and combining it with the vector representation of each word unit to obtain a word unit representation; Inputting the word-gram representation of each word-gram in each event post into a preset context rewriter, and outputting a rewritten summary text of each event post; the context rewriter is a decoder based on the Transformer architecture; The rewritten summary texts are filtered for semantic similarity and sorted according to the posting time to obtain the event context corresponding to the target event.
2. The method according to claim 1, characterized in that The step of obtaining at least one event posting by a target user regarding a target event and its corresponding posting time on multiple network platforms includes: According to the event identifier of the target event and the user identifier of the target user, screening the multiple network platforms to obtain the initial event post, the social interaction data corresponding to the initial event post, and the posting time; Based on the social interaction data and the weights pre-assigned to each item of social interaction data, a weighted calculation is performed to obtain the social interaction features corresponding to each initial event post; Sort the initial event post pairs according to the corresponding posting time, and construct a curve graph with the corresponding social interaction features as dependent variables; The initial event post corresponding to the peak in the curve graph is retained to obtain the at least one event post.
3. The method according to claim 2, characterized in that After retaining the initial event post corresponding to the peak in the curve graph and obtaining the at least one event post, the method further includes: Multiplying the mean of the social interaction features corresponding to the initial event post by a preset coefficient to obtain a feature threshold; The feature threshold is used to further screen the retained event posts, and event posts with social interaction features greater than the feature threshold are retained.
4. The method according to claim 1, wherein The training process of the context rewriter includes: Acquire sample training data; the sample training data includes sample text and corresponding sample summary; word units in the sample text are added with group tags; Vectorizing the group tag of each word in the sample text to obtain a corresponding group tag embedding, and combining it with the vector representation corresponding to each word to obtain a sample word representation; Inputting the sample word unit representation into the initial Transformer model to obtain a rewriting result; Inputting the rewriting result and the sample summary into a preset loss function to obtain a loss result; The parameters of the initial Transformer model are iterated using the loss result until the model converges to obtain the context rewriter.
5. The method according to claim 1, wherein The performing semantic similarity filtering on the rewritten summary text includes: The rewritten summary text is input into a pre-trained semantic similarity model in the form of a text pair, and a similarity label is output; the similarity label is used to indicate the semantic similarity of the input text pair; the semantic similarity model includes an input embedding layer, an output encoding layer, and an angle difference acquisition layer; the input embedding layer is used to receive the input text pair and generate a real embedding and an imaginary embedding corresponding to each word in the text pair; the output encoding layer is used to input the real embedding and the imaginary embedding into the pre-trained language model to obtain an encoding output; the angle difference acquisition layer is used to construct a complex representation of the input text pair based on the encoding output, calculate the angle difference between the two complex representations by complex division, and determine the similarity label of the input text pair; The text pairs with the same semantics indicated by the similarity labels are selected and retained.
6. The method according to claim 5, characterized in that The pre-training process of the semantic similarity model includes: Acquire training data; the training data includes sample text pairs and corresponding sample similarity labels; the sample text pairs include positive sample text pairs and negative sample text pairs; Inputting the sample text pairs into an initial semantic similarity model to obtain a training result; Inputting the training results and the sample similarity labels into a preset loss function to obtain a loss result; the preset loss function includes an angle target loss function and a supervised contrast learning target loss function; The initial semantic similarity model is iteratively trained based on the loss result, and model parameters are updated until the model converges to obtain the language similarity model.
7. The method according to claim 1, characterized in that The performing semantic similarity filtering on the rewritten summary text includes: Inputting the rewritten summary text into the pre-trained language model to obtain a vector representation corresponding to each rewritten summary text; Determine the similarity between each pair of rewritten summary texts based on the vector representation corresponding to each rewritten summary text and a preset similarity algorithm; The similarity between each rewritten summary text pair is compared with a preset similarity threshold, and one of the texts in the rewritten summary text pair whose similarity is greater than the preset similarity threshold is selected and retained.
8. A network event context generation device, comprising a processor, a memory, and a computer program / instruction stored in the memory, characterized in that: The processor is configured to execute the computer program / instructions. When the computer program / instructions are executed, the device implements the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Hybrid text abstract generation method and system, terminal and storage medium
CN112464657A
Text abstract model production method and device, equipment and medium
CN115129819A
Text abstract generation method and system based on BART-BiGRU-LAAM
CN118364096A
Text classification method based on event tags
CN118733777A
Error positioning method for retrieval enhancement generation system, electronic equipment and medium
CN119474276A