Event site detection method and system based on background information and label fusion
By integrating background information and labels in event position detection and generating target models for analysis, the problem of insufficient utilization of background knowledge during event position detection in the prior art is solved, and the accuracy of detection and fine-grained analysis capabilities are improved.
Patent Information
- Application Number
- CN202411502812.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-04-04
Smart Images

Figure CN119761318A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a method and system for event stance detection based on background information and label fusion. Background Art
[0002] With the development of artificial intelligence technology, stance detection tasks have been gradually optimized. Stance detection aims to determine the stance of a given text on a target. The stance of a given text on a target includes approval, opposition, and neutrality. It plays an important role in many applications. With the development of the Internet, stance detection on social media has attracted more attention. Similar to other tasks in natural language processing, stance detection methods usually include: (1) graph neural network methods based on relationship nodes between texts, suitable for long texts or multiple texts; (2) transfer learning-based methods trained with data from other fields for zero-sample or few-sample scenarios.
[0003] In the related technologies, the methods based on graph neural networks have the problem of high model complexity. Since the connection relationship between nodes in the graph needs to be modeled, more computing resources and time are required. The methods based on transfer learning rely on the quality of the source domain data, and the transfer effect is unstable. In different fields, tasks and data sets, the effect of transfer learning will be affected by many factors, resulting in unstable transfer generalization performance.
[0004] Related technologies have certain limitations when processing events on social platforms. The stance judgment of events on social platforms often needs to consider multiple aspects such as support, neutrality or opposition, but the model may not be able to clearly distinguish whether the target of the judgment is the target specified by the task. This may cause the model to make misjudgments or confusions when judging the stance of the event, affecting the accuracy and reliability of the judgment. In addition, the text of social platform events often contains rich background knowledge of the event, which is different from the background knowledge obtained from platforms such as Wikipedia; related technologies are difficult to fully utilize the background knowledge of the event itself to assist in judgment, and are insufficient in the ability to understand and analyze the stance of the event. Summary of the invention
[0005] In view of the shortcomings of the existing technology, the present application provides an event stance detection method and system based on background information and label fusion, which solves the problem that the related technology has too many limitations when performing stance detection on events on social platforms.
[0006] To achieve the above objectives, this application is implemented through the following technical solutions:
[0007] In the first aspect, an embodiment of the present application provides an event stance detection method based on background information and label fusion, and the event stance detection method includes: obtaining mutually related first comment information, first target information and first background information; extracting a first stance label from the first target information based on a heuristic rule; according to a preset large language model, inputting instructions and extracting brief second background information from the first background information using a multi-round dialogue method; splicing and merging the first comment information, the first target information, the first stance label and the second background information to obtain the target information; inputting the target information into an initial model framework based on BERT, and obtaining a target model through training and learning; obtaining second comment information to be subjected to stance detection and second target information corresponding to the second comment information; analyzing the second comment information and the second target information through the target model to obtain a second stance label to characterize the event stance of the second comment information regarding the second target information.
[0008] According to the first aspect of the embodiment of the present application, the aforementioned method of extracting the first stance label from the first target information based on the heuristic rule may specifically include the following steps: processing the first target information through a preset Stanford NLP tool to obtain a part-of-speech tag sequence; extracting stance information from the part-of-speech tag sequence using a preset template to obtain the first stance label.
[0009] According to the first aspect of the embodiment of the present application, the aforementioned splicing and merging of the first comment information, the first target information, the first stance label and the second background information to obtain the target information may specifically include the following steps: grouping the first comment information and the first target information to obtain a first target sequence; merging the first stance label and the second background information to obtain a second target sequence; connecting the second target sequence to the end of the first target sequence by splicing to obtain the target information, so that the model can achieve effective interaction of the four sequences during the encoding process and pay attention to each other to capture contextual information.
[0010] According to the first aspect of the embodiment of the present application, the aforementioned target information is expressed as: [CLS]c; t[SEP]ek; sl[SEP]; wherein c is the first comment information, t is the first target information, ek is the second background information, and sl is the first stance label; [SEP] represents the interval, and [CLS] is used for semantic encoding.
[0011] According to the first aspect of the embodiment of the present application, the initial model framework is composed of a plurality of layers of transformer encoders stacked together, and each layer of the encoder includes a multi-head attention layer and a feedforward neural network layer; the multi-head attention layer re-encodes the target word by evaluating the correlation between the target word and all the words in the sentence.
[0012] According to the first aspect of the embodiment of the present application, the target information is input into the BERT-based initial model framework, and the target model is obtained through training and learning. Specifically, the following steps may be included: truncating the target information into multiple input vectors with a maximum dimension of 512; calculating, normalizing and weighted summing the input vectors through a multi-head attention layer to obtain a new vector with a lower dimension; based on the obtained new vector, training the model for up to 50 epochs using an AdamW optimizer with a batch size of 16; searching within the learning rate range {2e-5, 5e-5}, and fine-tuning the hyperparameters of the first four layers of the encoder to optimize the training effect and obtain the target model.
[0013] According to the first aspect of the embodiment of the present application, the aforementioned calculation, normalization and weighted summation of the input vector through the multi-head attention layer to obtain a new vector with lower dimension can specifically include the following steps: linearly transform the input vector through three preset weight matrices to generate three sequence vectors; the three sequence vectors include a query vector, a key vector and a value vector; multiply the query vector of each word with the key vectors of all words in the sequence to obtain the association between the words; normalize the weights through a preset softmax function, and weighted sum the normalized weights with the value vector to obtain a new code corresponding to each word to generate a new vector.
[0014] In the second aspect, an embodiment of the present application provides an event stance detection system based on background information and label fusion, the event stance detection system comprising: a first acquisition module, a first extraction module, a second extraction module, a splicing and merging module, a training module, a second acquisition module and an analysis module; wherein the first acquisition module is used to acquire mutually related first comment information, first target information and first background information; the first extraction module is used to extract a first stance label from the first target information based on a heuristic rule; the second extraction module is used to input instructions according to a preset large language model and extract brief second background information from the first background information using a multi-round dialogue method; the splicing and merging module is used to splice and merge the first comment information, the first target information, the first stance label and the second background information to obtain the target information; the training module is used to input the target information into an initial model framework based on BERT, and obtain a target model through training and learning; the second acquisition module is used to acquire the second comment information to be subjected to stance detection and the second target information corresponding to the second comment information; the analysis module is used to analyze the second comment information and the second target information through the target model to obtain a second stance label to characterize the event stance of the second comment information regarding the second target information.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the event stance detection method based on background information and label fusion in the aforementioned first aspect is implemented.
[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a program or instruction. When the program or instruction is executed by a processor, the event stance detection method based on background information and label fusion in the aforementioned first aspect is implemented.
[0017] This application provides an event stance detection method and system based on background information and label fusion. Compared with the prior art, it has the following beneficial effects:
[0018] This application constructs stance detection as a classification task. In order to improve the accuracy and reliability of stance detection, in addition to obtaining the interrelated first comment information and first target information, the corresponding first background information is also obtained and a clear first stance label is extracted from the first target information. Event background knowledge and clear label information can be introduced to fully understand the text content and event background; in multi-label tasks, the use of clear labels helps the model to better understand and distinguish different stances, and improves the accuracy of discrimination and fine-grained analysis capabilities. Since BERT is usually used to process a maximum of two sequences, but in the task of this technology, the model needs to process 4 sequences, so this application splices and merges the first comment information, the first target information, the first stance label and the second background information to obtain the target information, and then trains to obtain the target model; the second comment information and the second target information are analyzed by the target model to effectively distinguish different stances; this technology pays attention to stance labels and event backgrounds. Clear stance labels provide clear goals for the model, enabling it to understand the user's stance more specifically. At the same time, brief second background information provides contextual information for the model, helping the model to better understand the events involved in the comments, thereby more accurately determining the user's point of view. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 It is a flow chart of an event stance detection method based on background information and label fusion provided in an embodiment of the present application;
[0021] Figure 2 yes Figure 1 An exemplary flow chart of S140;
[0022] Figure 3 It is a structural diagram of an event stance detection system based on background information and label fusion provided in an embodiment of the present application;
[0023] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0026] The embodiments of the present application provide a method and system for event stance detection based on background information and tag fusion, thereby solving the problem that the related technologies have too many limitations when performing stance detection on events on social platforms.
[0027] The technical solution in the embodiment of the present application is to solve the above technical problems, and the overall idea is as follows:
[0028] With the development of artificial intelligence technology, stance detection tasks have been gradually optimized. Stance detection can extract and analyze the stance tendency of a target event from a text, and is a branch application of text analysis technology. Stance detection aims to determine the stance of a given text on a target. The stance of a given text on a target includes approval, opposition, and neutrality. It plays an important role in many applications. With the development of the Internet, stance detection on social media has attracted more attention. Similar to other tasks in natural language processing, stance detection methods usually include: (1) graph neural network methods based on relationship nodes between texts, suitable for long texts or multiple texts; (2) transfer learning-based methods trained with data from other fields for zero-sample or few-sample scenarios.
[0029] Methods based on graph neural networks mainly use the relationship between nodes in the graph to perform information reasoning and prediction. Compared with methods based on neural networks, graph neural networks are more interpretable and more suitable for capturing complex associations between texts. By observing the connections between nodes in the graph, we can better understand the prediction results of the model, especially in long text or multi-text tasks. However, methods based on graph neural networks also have some problems, such as: the model complexity is higher, because the connection relationship between nodes in the graph needs to be modeled, more computing resources and time are required.
[0030] The transfer learning-based method improves the prediction effect of the target task by training the model on the source domain and fine-tuning it on the target domain. The transfer learning method can be used for small sample problems. In addition, by using the model trained with the source domain data to initialize the model of the target domain, the learning efficiency can be effectively improved, and training time and computing resources can be saved. However, there are also some problems with the transfer learning-based method, such as: the model depends on the quality of the source domain data; how to choose the appropriate source domain data and model parameters for transfer learning is a key issue, which requires expert knowledge; in addition, the transfer effect is unstable. In different fields, tasks and data sets, the effect of transfer learning will be affected by many factors, resulting in unstable transfer generalization performance.
[0031] Existing technologies have certain limitations when processing events on social platforms, and more in-depth research and improvements are needed to target event targets.
[0032] The judgment of the stance of events on social platforms often needs to consider multiple aspects such as support, neutrality or opposition, but the model may not be able to clearly distinguish whether the target of the judgment is the target specified by the task. This may cause the model to misjudge or confuse the event stance, affecting the accuracy and reliability of the judgment. In addition, the text of social platform events often contains rich background knowledge of the event, which is different from the background knowledge obtained from platforms such as Wikipedia. Therefore, the existing technology needs to make better use of the background knowledge of the event itself to assist in judgment, so as to improve the understanding and analysis of the event stance.
[0033] Therefore, in order to better apply stance detection technology in social platforms, we need to conduct in-depth research on event targets and improve the model to better handle the diverse stance judgment needs. At the same time, we need to improve the model's ability to understand and utilize event background knowledge to more accurately grasp the stance and emotional tendency of the event. Only in this way can we better cope with the challenges of stance detection tasks in social platforms and provide users with more accurate and comprehensive information analysis and judgment services.
[0034] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0035] The following first introduces an event stance detection method based on background information and label fusion provided in an embodiment of the present application.
[0036] The present application embodiment provides a flow chart of an event stance detection method based on background information and label fusion, such as Figure 1 As shown, the event stance detection method may include the following steps S110-S170.
[0037] S110: Acquire mutually related first comment information, first target information, and first background information.
[0038] S120 : extracting a first stance label from the first target information based on a heuristic rule.
[0039] S130: According to a preset large language model, input instructions and use a multi-round dialogue method to extract brief second background information from the first background information.
[0040] S140: The first comment information, the first target information, the first position label and the second background information are combined to obtain target information.
[0041] S150: Input the target information into the BERT-based initial model framework, and obtain the target model through training and learning.
[0042] S160: Acquire second comment information to be subjected to stance detection and second target information corresponding to the second comment information.
[0043] S170 , analyzing the second comment information and the second target information through the target model to obtain a second stance label to characterize the event stance of the second comment information with respect to the second target information.
[0044] The above is a specific implementation method of an event stance detection method based on background information and label fusion provided in an embodiment of the present application. It can be understood that for stance detection tasks on social media, the target is usually an event. The main challenge faced by stance detection in social media is the need to reason about complex comment-target-event-stance relationships, which also means the need to integrate event knowledge. However, relying solely on additional information obtained from social media platforms is not the ultimate solution to all problems. Since the target may contain multiple complex events with opposite stances, normal stance labels may cause confusion to the model, that is, the model does not know what the pro-stance actually supports. The above problems make this article realize that when the model understands user opinions, clear stance labels are also a factor that cannot be ignored.
[0045] In order to improve the accuracy and reliability of stance detection, this application, in addition to obtaining the mutually related first comment information and first target information, also obtains the corresponding first background information and extracts a clear first stance label from the first target information, which can introduce event background knowledge and clear label information to fully understand the text content and event background; in multi-label tasks, the use of clear labels helps the model to better understand and distinguish different stances, and improve the accuracy of discrimination and fine-grained analysis capabilities.
[0046] It should be noted that this application focuses on stance labels and event backgrounds. Clear stance labels provide a clear goal for the model, enabling it to understand the user's stance more specifically. At the same time, brief secondary background information provides contextual information for the model, helping the model to better understand the events involved in the comments, thereby more accurately determining the user's point of view. This application significantly improves the overall performance of event stance detection by integrating background knowledge and clear labels. It has high practical value and broad application prospects, and can provide strong technical support for information analysis and user public opinion management on social platforms.
[0047] It should also be noted that the target model proposed in this application focuses on the application of pre-trained models in its design. Pre-trained models can learn the complex relationship between comments, targets and events, and can more effectively determine stances through fine-tuning. The introduction of this pre-trained model enables the proposed model to have a more powerful representation learning ability, which can better capture information in the context, thereby improving the performance of stance detection.
[0048] In some embodiments, the foregoing first stance label is extracted from the first target information based on heuristic rules, that is, the foregoing S120 may specifically include the following steps:
[0049] S210. Process the first target information through a preset Stanford NLP tool to obtain a part-of-speech tagging sequence.
[0050] S220. Extract stance information from the part-of-speech tagging sequence using a preset template to obtain the first stance label.
[0051] In the embodiments of the present application, it can be understood that this technology uses heuristic rules to extract stance labels from the target. Specifically, for the given first target information, first use Stanford NLP to obtain the part-of-speech tagging sequence POS sequence; then use the template to extract the first stance label. For example, if the first target information is in the form of "be + V" or "suffer + V", where V represents the action in the event, the support stance label is "deserve to be + V", and the opposing stance label is "should not be + V". Table 1 shows the first stance labels extracted for five first target information.
[0052] Table 1 First target information and extracted first stance labels
[0053]
[0054]
[0055] In some embodiments, as Figure 2 shown, the foregoing splicing and merging of the first comment information, the first target information, the first stance label, and the second background information to obtain the target information, that is, the foregoing S140 may specifically include the following steps:
[0056] S310. Group the first comment information and the first target information to obtain the first target sequence.
[0057] S320. Merge the first stance label and the second background information to obtain the second target sequence.
[0058] S330. Connect the second target sequence to the end of the first target sequence in a splicing manner to obtain the target information, so that the model can effectively interact with and pay attention to the four sequences during the encoding process to capture context information.
[0059] In one example, the target information is represented as: [CLS]c;t[SEP]ek;sl[SEP];
[0060] Among them, c is the first comment information, t is the first target information, ek is the second background information, sl is the first stance label; [SEP] represents the interval, and [CLS] is used for semantic encoding.
[0061] In the embodiments of the present application, it can be understood that since BERT is usually used to process a maximum of two sequences, but in the task of the present technology, the model needs to process 4 sequences, so the present application adopts a clever strategy to splice and merge the first comment information, the first target information, the first stance label and the second background information to obtain the target information, and then train the target model; the design of this structure allows the model to achieve effective interaction of the 4 sequences during the encoding process, so that the first comment information, the first target information, the first stance label and the second background information can pay attention to each other, thereby better capturing contextual information.
[0062] In some embodiments, the initial model framework is composed of multiple layers of transformer encoders stacked together, and each layer of the encoder includes a multi-head attention layer and a feedforward neural network layer; the multi-head attention layer re-encodes the target word by evaluating the association between the target word and all words in the sentence.
[0063] In some embodiments, the target information is input into the BERT-based initial model framework, and the target model is obtained through training and learning, that is, the aforementioned S150 may specifically include the following steps:
[0064] S410: truncate the target information into multiple input vectors with a maximum dimension of 512.
[0065] S420: Calculate, normalize and weighted sum the input vector through a multi-head attention layer to obtain a new vector with lower dimension.
[0066] S430. Based on the obtained new vector, the model is trained for a maximum of 50 epochs using the AdamW optimizer with a batch size of 16.
[0067] S440. Search within the learning rate range of {2e-5, 5e-5} and fine-tune the hyperparameters of the first four layers of the encoder to optimize the training effect and obtain the target model.
[0068] In the embodiment of the present application, it can be understood that the main task of each multi-head attention layer is to re-encode the target word by evaluating the relevance of the target word to all words in the sentence. Calculating each multi-head attention layer includes three steps: calculating the relevance between words, normalizing the relevance, and performing weighted summation of the relevance and the encoding of all words to obtain the new encoding of the target word.
[0069] In one example, the aforementioned multi-head attention layer is used to calculate, normalize and weighted sum the input vector to obtain a new vector with a lower dimension, that is, the aforementioned S420 may specifically include the following steps:
[0070] S510 , linearly transform the input vector using three preset weight matrices to generate three sequence vectors; the three sequence vectors include a query vector, a key vector, and a value vector.
[0071] S520: Multiply the query vector of each word by the key vectors of all words in the sequence to obtain the correlation between the words.
[0072] S530, weight normalization is performed using a preset softmax function, and the normalized weight is weightedly summed with the value vector to obtain a new code corresponding to each word to generate a new vector.
[0073] In some embodiments, the initial model framework can select BERT, RoBERTa and BERTweet. BERT is a model obtained by Google through pre-training of large-scale unlabeled Chinese text. This article believes that BERT can handle Chinese Weibo short texts well and understand the deep meaning of the text. RoBERTa has made improvements in training data and hyperparameter settings based on the BERT model, and may have better performance in this task. BERTweet is trained using texts from the English social media platform Twitter. Although the training corpus is in English, these corpuses come from Twitter short text social platforms similar to Weibo. Therefore, the BERTweet model can better overcome the difficulties of Weibo texts being short, incomplete, and lacking information.
[0074] By using these three models at the same time, we can fully consider the text features on Chinese and English social media platforms, so as to more comprehensively understand and handle the Weibo stance detection task. Such a multi-model selection strategy helps to better find a model that adapts to the stance detection needs of Weibo, a specific social media platform; all three models are implemented in PyTorch.
[0075] In other embodiments, in addition to adopting the BERT-based initial model framework, the present application can also adopt SKEP and mT5 models as basic models. In view of the close connection between stance detection and sentiment analysis tasks, and the stance detection task is evolved from sentiment analysis, a classic sentiment analysis pre-training model SKEP can be selected for comparison. The mT5 model is also considered. Unlike BERT, mT5 adopts a more general framework, integrates natural language processing tasks into text-to-text conversion tasks, and is pre-trained on large-scale data. The comparative experiment introducing these two models can reveal their advantages and disadvantages in processing Weibo event stance detection tasks by comparing and analyzing the performance of different models and other field models in stance detection tasks, which helps to provide a more comprehensive and in-depth argumentation, thereby providing a more convincing conclusion for the research in this chapter.
[0076] During training, the mT5 model used the Adafactor optimizer with a batch size of 4 and 12 iterations. For hyperparameter tuning, the learning rate was set to 2e-4 and adjusted using the learning rate regulator. In the SKEP model, the input was truncated to a maximum of 224 words and the model was trained for 12 epochs using the Adam optimizer with a batch size of 16. Regarding hyperparameters: the learning rate was 2e-5 and the decay weight was 5e-4.
[0077] In some embodiments, the present application provides an event stance detection system 600 based on background information and label fusion, such as Figure 3 As shown, the event stance detection system 600 may include the following modules:
[0078] A first acquisition module 610 is used to acquire mutually related first comment information, first target information and first background information;
[0079] A first extraction module 620, configured to extract a first stance label from the first target information based on a heuristic rule;
[0080] The second extraction module 630 is used to extract brief second background information from the first background information by inputting instructions and adopting a multi-round dialogue method according to a preset large language model;
[0081] A splicing and merging module 640 is used to splice and merge the first comment information, the first target information, the first position label and the second background information to obtain the target information;
[0082] A training module 650 is used to input the target information into the BERT-based initial model framework and obtain the target model through training learning;
[0083] A second acquisition module 660 is used to acquire second comment information to be subjected to stance detection and second target information corresponding to the second comment information;
[0084] The analysis module 670 is used to analyze the second comment information and the second target information through the target model to obtain a second stance label to characterize the event stance of the second comment information with respect to the second target information.
[0085] According to an embodiment of the present application, any multiple modules among the first acquisition module 610, the first extraction module 620, the second extraction module 630, the splicing and merging module 640, the training module 650, the second acquisition module 660 and the analysis module 670 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module.
[0086] In some embodiments, the first extraction module 620 may be specifically used to:
[0087] Processing the first target information through a preset Stanford NLP tool to obtain a part-of-speech tag sequence;
[0088] Use the preset template to extract stance information from the part-of-speech tag sequence to obtain the first stance label.
[0089] In some embodiments, the splicing and merging module 640 may be specifically used to:
[0090] Grouping the first comment information and the first target information to obtain a first target sequence;
[0091] Combine the first position label and the second background information to obtain a second target sequence;
[0092] The second target sequence is concatenated to the end of the first target sequence to obtain the target information, so that the model can achieve effective interaction of the four sequences during the encoding process and pay attention to each other to capture contextual information.
[0093] In some embodiments, the training module 650 may specifically include:
[0094] A truncation unit 651, used to truncate the target information into multiple input vectors with a maximum dimension of 512;
[0095] A calculation processing unit 652 is used to calculate, normalize and weighted sum the input vector through a multi-head attention layer to obtain a new vector with lower dimension;
[0096] A training unit 653, used to train the model for a maximum of 50 epochs using an AdamW optimizer with a batch size of 16 based on the obtained new vectors;
[0097] The fine-tuning unit 654 is used to search within the learning rate range {2e-5, 5e-5} and fine-tune the hyperparameters of the first four layers of the encoder to optimize the training effect and obtain the target model.
[0098] In some embodiments, the computing processing unit 652 may be specifically configured to:
[0099] The input vector is linearly transformed through three preset weight matrices to generate three sequence vectors; the three sequence vectors include query vector, key vector and value vector;
[0100] Multiply the query vector of each word with the key vectors of all words in the sequence to get the correlation between words;
[0101] The weights are normalized using the preset softmax function, and the normalized weights are weighted summed with the value vector to obtain the new encoding corresponding to each word to generate a new vector.
[0102] Figure 3 Each module in the system shown has the function of implementing each step in the aforementioned event stance detection method based on background information and label fusion, and can achieve its corresponding technical effect. For the sake of concise description, it will not be repeated here.
[0103] In some embodiments, the present application provides an electronic device, the structure diagram of the electronic device is as follows Figure 4 shown.
[0104] The electronic device may include a processor 710 and a memory 720 storing computer program instructions.
[0105] Specifically, the processor 710 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0106] The memory 720 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 720 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 720 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 720 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 720 is a non-volatile solid-state memory.
[0107] The memory 720 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory 720 includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it can perform the operations described in any of the event stance detection methods based on background information and label fusion in the above-mentioned embodiments.
[0108] The processor 710 reads and executes the computer program instructions stored in the memory 720 to implement any one of the event stance detection methods based on background information and label fusion in the above embodiments.
[0109] In one example, the electronic device may further include a communication interface 730 and a bus 700. Figure 4 As shown, the processor 710, the memory 720, and the communication interface 730 are connected via a bus 700 and communicate with each other.
[0110] The communication interface 730 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0111] Bus 700 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 700 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0112] In addition, in combination with the event stance detection method based on background information and label fusion in the above embodiments, the present application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any event stance detection method based on background information and label fusion in the above embodiments is implemented.
[0113] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0114] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. 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 application 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 by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0115] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0116] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0117] In summary, compared with the prior art, this application has the following beneficial effects:
[0118] 1. This application constructs stance detection as a classification task and implements it using a pre-training and fine-tuning framework. It can introduce event background knowledge and clear label information to fully understand the text content and event background. In multi-label tasks, the use of clear labels helps the model better understand and distinguish different stances, improving the accuracy of discrimination and fine-grained analysis capabilities.
[0119] 2. This application focuses on stance labels and event backgrounds. Clear stance labels provide a clear goal for the model, enabling it to understand the user's stance more specifically. At the same time, brief secondary background information provides contextual information for the model, helping the model to better understand the events involved in the comments, thereby more accurately judging the user's views. The integration of background knowledge enables the model to consider more contextual information when dealing with complex social platform events, reducing misjudgments and biases.
[0120] 3. The technical solution of the present invention can effectively distinguish and judge multiple positions such as support, neutrality, opposition, etc. In multi-label tasks, the use of clear labels helps the model to better understand and distinguish different positions, and improves the accuracy of discrimination and fine-grained analysis capabilities. By integrating real-time background knowledge and labels, the present invention improves the model's ability to respond to dynamic events, so that position detection can timely and accurately reflect the latest developments of events.
[0121] 4. This application integrates background knowledge and clear labels. Clear position labels provide a clear goal for the model, enabling it to understand the user's position more specifically. At the same time, the brief event background provides contextual information for the model, helping the model to better understand the events involved in the comments, thereby more accurately determining the user's point of view, and providing strong technical support for information analysis and user public opinion management on social platforms.
[0122] 5. The model proposed in this application focuses on the application of pre-trained models in its design. Therefore, it is believed that the pre-trained model can learn the complex relationship between comments, targets and events, and can more effectively determine the stance through fine-tuning. The introduction of this pre-trained model enables the proposed model to have a more powerful representation learning ability, which can better capture the information in the context, thereby improving the performance of stance detection.
[0123] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An event stance detection method based on background information and label fusion, characterized in that: include: Acquire mutually related first comment information, first target information and first background information; Extracting a first stance label from the first target information based on a heuristic rule; According to the preset large language model, input instructions and use a multi-round dialogue method to extract brief second background information from the first background information; The first comment information, the first target information, the first position label and the second background information are combined to obtain target information; Input the target information into the BERT-based initial model framework, and obtain the target model through training and learning; Acquire second comment information to be subjected to stance detection and second target information corresponding to the second comment information; The second comment information and the second target information are analyzed by the target model to obtain a second stance label to characterize the event stance of the second comment information with respect to the second target information.
2. The event stance detection method based on background information and label fusion as claimed in claim 1, characterized in that: The extracting a first stance label from the first target information based on a heuristic rule includes: Processing the first target information by using a preset Stanford NLP tool to obtain a part-of-speech tag sequence; The stance information is extracted from the part-of-speech tag sequence using a preset template to obtain a first stance label.
3. The event stance detection method based on background information and label fusion as claimed in claim 1 or 2, characterized in that: The step of combining the first comment information, the first target information, the first position label and the second background information to obtain the target information includes: Grouping the first comment information and the first target information to obtain a first target sequence; Combining the first position label and the second background information to obtain a second target sequence; The second target sequence is connected to the end of the first target sequence by splicing to obtain target information, so that the model can realize effective interaction of the four sequences during the encoding process and pay attention to each other to capture contextual information.
4. The event stance detection method based on background information and label fusion as claimed in claim 3, characterized in that: The target information is expressed as: [CLS]c; t[SEP]ek; sl[SEP]; Among them, c is the first comment information, t is the first target information, ek is the second background information, sl is the first stance label; [SEP] represents the interval, and [CLS] is used for semantic encoding.
5. The event stance detection method based on background information and label fusion as claimed in claim 1 or 2, characterized in that: The initial model framework is composed of multiple layers of transformer encoders, each of which includes a multi-head attention layer and a feedforward neural network; the multi-head attention layer re-encodes the target word by evaluating the association between the target word and all words in the sentence.
6. The event stance detection method based on background information and label fusion as claimed in claim 5, characterized in that: The target information is input into the initial model framework based on BERT, and the target model is obtained through training and learning, including: Truncating the target information into multiple input vectors of up to 512 dimensions; The input vector is calculated, normalized and weighted summed by the multi-head attention layer to obtain a new vector with lower dimension; Based on the obtained new vectors, the model is trained for up to 50 epochs using the AdamW optimizer with a batch size of 16; A search is performed within the learning rate range of {2e-5, 5e-5} to fine-tune the hyperparameters of the first four layers of the encoder to optimize the training effect and obtain the target model.
7. The event stance detection method based on background information and label fusion as claimed in claim 6, characterized in that: The step of calculating, normalizing and weighted summing the input vector through the multi-head attention layer to obtain a new vector with a lower dimension includes: The input vector is linearly transformed by three preset weight matrices to generate three sequence vectors; the three sequence vectors include a query vector, a key vector and a value vector; Multiply the query vector of each word by the key vectors of all words in the sequence to obtain the correlation between words; The weights are normalized by a preset softmax function, and the normalized weights are weighted summed with the value vector to obtain a new code corresponding to each word to generate a new vector.
8. An event stance detection system based on background information and label fusion, characterized in that: include: A first acquisition module, used to acquire mutually related first comment information, first target information and first background information; A first extraction module, configured to extract a first stance label from the first target information based on a heuristic rule; A second extraction module is used to extract brief second background information from the first background information by inputting instructions and adopting a multi-round dialogue method according to a preset large language model; a splicing and merging module, configured to splice and merge the first comment information, the first target information, the first position label and the second background information to obtain target information; A training module, used to input the target information into an initial model framework based on BERT, and obtain a target model through training and learning; A second acquisition module, used to acquire second comment information to be subjected to stance detection and second target information corresponding to the second comment information; The analysis module is used to analyze the second comment information and the second target information through the target model to obtain a second stance label to characterize the event stance of the second comment information with respect to the second target information.
9. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the event stance detection method based on background information and label fusion as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the event stance detection method based on background information and label fusion as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Event site detection method and system based on retrieval enhancement generation and multi-view verification
CN121880567A