Two-stage modeling method and device for social media attack speech detection model and medium
Through a two-stage modeling method, the personal opinions of annotators are used to detect social media attack speeches, which solves the problem of difficulty in identifying obscure attack speeches with existing technology and improves the performance and accuracy of the detection model.
Patent Information
- Application Number
- CN202410554852.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-07
- Publication Date
- 2024-09-20
AI Technical Summary
It is difficult for existing social media attack speech detection models to identify obscure attack speeches because these speeches blur the boundaries between normal speech and attack speech, and models based on machine learning or deep learning lack the ability to analyze speech from multiple angles, resulting in poor detection results. good.
A two-stage modeling method is used to first build annotators' personal opinion prediction model and generate annotators' personal opinion pool, and then build a personal opinion fusion decision-making model, which integrates and weights the opinions of multiple annotators to generate the final detection results.
It improves the detection ability of obscure offensive speech, can understand the potential offensive risk of speech from multiple angles, enhances the performance of the detection model, and effectively curbs offensive speech on social media.
Smart Images

Figure CN118673127A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of media attack speech detection, and in particular to a two-stage modeling method, device and medium for a social media attack speech detection model. Background Art
[0002] Offensive speech refers to the use of insulting, malicious or hostile language to attack others on social media, which may cause psychological harm to the victim, destroy the healthy atmosphere of social networks, and even lead to violent incidents. Therefore, detecting and preventing offensive speech is an important task for social media platforms.
[0003] At present, the detection of offensive speech on social media mainly relies on natural language processing (NLP) technology, which determines whether there is offensive speech by analyzing the vocabulary, syntax, semantics and other features in the text content. Generally speaking, offensive speech detection can be divided into the following levels: 1) Binary classification: Determine whether a text contains offensive speech, yes or no. 2) Multi-classification: Determine the type of offensive speech contained in a text, such as abuse, threat, discrimination, etc. 3) Target identification: Determine which targets the offensive speech in a text is directed at, such as individuals, groups, organizations, etc. 4) Severity assessment: Determine the severity of the offensive speech in a text, such as mild, moderate, severe, etc.
[0004] In order to achieve the above-mentioned attack speech detection task, researchers have proposed many models based on machine learning or deep learning, such as support vector machine (SVM), naive Bayes (NB), logistic regression (LR), convolutional neural network (CNN), recurrent neural network (RNN), attention mechanism (Attention), etc. These models usually require a large amount of labeled data for training and testing, so the construction and quality of the data set is also a key factor in attack speech detection.
[0005] As existing technologies are increasingly capable of detecting offensive speech on social media, social media users now deliberately use some means to avoid being identified by the system when making offensive speech, so as to successfully attack the other party. One of the more effective means is to blur the offensiveness of their speech and attack the other party through indirect means such as ridicule, rather than directly attacking the user as in the past. This practice blurs the boundary between normal speech and offensive speech, making it difficult to detect such obscure offensive speech. At the same time, it also makes it a very subjective task to determine whether a speech is offensive speech. Because each user has different life experiences, their values and prejudices will also be different. When faced with whether a speech is offensive speech, different people may give different opinions. For example, the statement "*** should stay in the kitchen" is considered a normal statement by some users, but for other users, it is a very obvious discriminatory offensive speech. Existing detection technologies are difficult to handle for this type of cryptic attacking speech, because machine learning or deep learning-based models only learn the final labels of speech samples during the learning process, without learning the possible degree of controversy and opinions of different groups in the samples, and lack the ability to analyze speech from multiple different angles, which makes it difficult for existing detection models to identify many cryptic attacking speeches.
[0006] Datasets play a very important role in machine learning. In the general process of data set construction, multiple labelers are hired to label all samples for learning machine learning models. At the same time, in order to ensure the correctness of the labels, most data sets will use multiple different labelers to label the same sample, and then select a correct label from these labels through majority voting and other methods. This approach has a good effect in objective tasks, which can improve the labeling quality of the data set and greatly reduce the wrong labeling caused by the personal mistakes of the labelers. However, this approach has problems when applied to the detection of offensive speech. The judgment of offensive speech is a very subjective task, especially for implicit offensive speech, which does not have a clear judgment standard like objective tasks. Previous studies have found that for such subjective tasks, it is difficult for labelers to reach a consensus on many samples. In this case, everyone's labeling, that is, everyone's opinion, is valuable and basically reflects the information of the speech from some aspect. In this case, it is not a safe approach to let the model learn only a single opinion of each sample. Summary of the invention
[0007] In order to solve at least one of the technical problems existing in the prior art to a certain extent, the present invention aims to provide a two-stage modeling method, device and medium for a social media attack speech detection model based on personal opinion.
[0008] The first technical solution adopted by the present invention is:
[0009] A two-stage modeling method for a social media attack speech detection model includes the following steps:
[0010] Obtain the original data set and construct the annotator's personal opinion data set;
[0011] Based on the constructed personal opinion dataset, a personal opinion prediction model for annotators is constructed and trained;
[0012] For each sample in the original dataset, use the trained personal opinion prediction model to predict each annotator’s personal opinion on the sample and generate an annotator’s personal opinion pool;
[0013] Based on the original data set and the annotator's personal opinion pool, a decision model that integrates the annotators' personal opinions is constructed and trained.
[0014] Furthermore, the step of constructing the annotator's personal opinion dataset includes:
[0015] For each sample in the original data set, a corresponding number of personal samples are generated according to the number of annotators involved in the annotation. The label of each personal sample is the personal label of the corresponding annotator.
[0016] Add an annotator identifier to each individual sample to indicate to the model whose individual opinion needs to be predicted.
[0017] Furthermore, the step of constructing and training a personal opinion prediction model for annotators based on the constructed personal opinion dataset includes:
[0018] Use the language pre-training model as the basic model, input a sequence consisting of annotator identifiers and sample text, and output each annotator's personal opinion on the sample, that is, the probability value of the two categories (offensive speech, ordinary speech).
[0019] Furthermore, for each sample in the original data set, the trained personal opinion prediction model is used to predict the personal opinion of each annotator on the sample, and a personal opinion pool of the annotators is generated, including:
[0020] After completing the training of the personal opinion prediction model, freezing the parameters of the model;
[0021] For each original sample, a number of derived samples is generated that is the same as the number of all annotators, and a different annotator identifier is inserted in front of each derived sample;
[0022] All these derived personal samples are input into the trained personal opinion prediction model to obtain each annotator's personal opinion prediction for the sample, forming an opinion pool for the sample;
[0023] Among them, a personal opinion contains the predicted output, that is, the probability value of the two categories (offensive speech, ordinary speech), and the ID of the corresponding annotator.
[0024] Furthermore, the process of constructing and training annotator personal opinion fusion decision model based on the original data set and the annotator personal opinion pool includes:
[0025] Use the language pre-training model as the basic model, input a sequence consisting of sample texts, and output a mask vector and a weight vector, which are used to select and integrate the personal opinions of all annotators, respectively, to obtain the final output of the model, that is, the probability value of the binary classification;
[0026] Among them, the lengths of the mask vector and the weight vector are both equal to the number of annotators. The elements of the mask vector are 0 or 1, indicating whether the opinion of the annotator is considered. The elements of the weight vector are non-negative real numbers, indicating the weight of the annotator's opinion. The final output of the model is the sum of the products of personal opinions and the corresponding weights, and the probability value of the two categories is obtained after normalization.
[0027] Furthermore, the annotator personal opinion prediction model uses a language pre-training model based on the Transformer architecture as a basic model of the personal opinion module;
[0028] The annotator's personal opinion fusion decision model uses a language pre-training model based on the Transformer architecture as the basic model of the global opinion module.
[0029] Furthermore, the annotator personal opinion prediction model and the annotator personal opinion fusion decision model are implemented using a convolutional neural network CNN, a hidden Markov model HMM or a recurrent neural network RNN.
[0030] The second technical solution adopted by the present invention is:
[0031] A two-stage modeling device for a social media attack speech detection model, comprising:
[0032] The dataset construction module is used to obtain the original dataset and construct the annotator's personal opinion dataset;
[0033] The personal opinion module is used to build and train the annotator's personal opinion prediction model based on the constructed personal opinion dataset;
[0034] The opinion pool construction module is used to predict the personal opinion of each annotator on each sample in the original data set using the trained personal opinion prediction model, and generate the annotator's personal opinion pool;
[0035] The global opinion module is used to build and train annotator's personal opinion fusion decision model based on the original data set and the annotator's personal opinion pool.
[0036] The third technical solution adopted by the present invention is:
[0037] A two-stage modeling device for a social media attack speech detection model, comprising:
[0038] at least one processor;
[0039] at least one memory for storing at least one program;
[0040] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0041] The fourth technical solution adopted by the present invention is:
[0042] A computer-readable storage medium stores a program executable by a processor, wherein the program executable by the processor is used to execute the method described above when executed by the processor.
[0043] The beneficial effect of the present invention is that the present invention can start from personal opinions and allow a model based on machine learning or deep learning to learn multiple personal opinions on a certain speech, and understand the risk of each speech that may offend a certain group of users from multiple aspects and angles, thereby improving the detection model's ability to detect implicit attacking speech and effectively curbing the emergence of attacking speech on social media today. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the embodiments of the present invention or the drawings of related technical solutions in the prior art are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 is an overall architecture diagram of a social media attack speech detection model in an embodiment of the present invention;
[0046] Figure 2 is a flow chart of the two-stage modeling work in an embodiment of the present invention;
[0047] Figure 3 is a schematic diagram of constructing a sample of personal opinions of annotators in an embodiment of the present invention;
[0048] Figure 4 is a schematic diagram comparing samples used for prediction and samples used for training in an embodiment of the present invention;
[0049] Figure 5 Schematic diagram showing the difference between a soft tag in an embodiment of the present invention and a traditional hard tag;
[0050] Figure 6 is a schematic diagram of the operation of the global viewpoint module in an embodiment of the present invention;
[0051] Figure 7 It is a flowchart of the steps of a two-stage modeling method of a social media attack speech detection model in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0053] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0054] In the description of the present invention, the meaning of "several" is one or more, the meaning of "more" is two or more, and the meanings of "greater than", "less than", "exceed" and the like are understood as not including the number itself, and the meanings of "above", "below", "within" and the like are understood as including the number itself. If there is a description of the first and the second, it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features. In addition, "and / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects before and after are in an "or" relationship.
[0055] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0056] In view of the existing technical problems, the present invention proposes a two-stage modeling method for a social media attack speech detection model based on personal opinions. The method can effectively utilize the divergence information between annotators to improve the performance of the model in social media attack speech detection. The modeling method involves two neural network modules. The first part is the personal opinion module, which is responsible for learning the personal opinions of each annotator and forming a rich opinion pool for each sample. The second part is the global opinion module, which is responsible for selecting reference opinions from this opinion pool and finally aggregating these opinions to obtain a final output. The modeling of this model is also based on two stages. In the first stage, the personal opinion module is first trained based on the personal opinions of the sample annotators, and then the module is frozen. In the second stage, the global opinion module is trained based on the personal opinion module, and finally a complete prediction result of speech detection is obtained.
[0057] like Figure 7 As shown, the embodiment of the present invention provides a two-stage modeling method for a social media attack speech detection model, comprising the following steps:
[0058] S1. Obtain the original data set and construct the annotator's personal opinion data set;
[0059] S2. Based on the constructed personal opinion dataset, construct and train the annotator’s personal opinion prediction model;
[0060] S3. For each sample in the original data set, use the trained personal opinion prediction model to predict each annotator’s personal opinion on the sample and generate an annotator’s personal opinion pool;
[0061] S4. Based on the original data set and the annotator’s personal opinion pool, a decision model that integrates the annotators’ personal opinions is constructed and trained.
[0062] The above method is explained in detail below with reference to the accompanying drawings and specific embodiments.
[0063] like Figure 1 and Figure 2 As shown, this embodiment provides a two-stage modeling method for a social media attack speech detection model based on personal opinion, including:
[0064] The main purpose of the first stage modeling is to learn rich personal opinions on whether the speech is offensive speech, laying a solid foundation for the final detection prediction results. This stage includes the following two steps:
[0065] The first step is to construct a dataset of annotators’ personal opinions. For each sample in the original dataset, a corresponding number of personal samples are generated according to the number of annotators involved in the annotation. The label of each personal sample is the personal label of the corresponding annotator, and an annotator identifier is added before each personal sample to indicate which annotator’s personal opinion the model needs to predict.
[0066] The second step is to train the annotator’s personal opinion prediction model (personal opinion module). Use any language pre-training model based on the Transformer architecture as the basic model, input a sequence consisting of annotator identifiers and sample text, and output each annotator’s personal opinion on the sample, that is, the probability value of the two categories (offensive speech, ordinary speech).
[0067] The main purpose of the second stage of modeling is to select and summarize the opinions with reference value from the many personal opinions learned in the first stage, and finally output the final prediction results of the model. This stage includes the following two steps:
[0068] The third step is to generate the annotator’s personal opinion pool. For each sample in the original dataset, the model trained in the second step is used to predict each annotator’s personal opinion on the sample, which serves as the opinion pool for the sample to be used by the subsequent global opinion module.
[0069] The fourth step is to train the annotator's personal opinion fusion decision model (global opinion module). Use any language pre-training model based on the Transformer architecture as the basic model, input a sequence consisting of sample texts, and output a mask vector and a weight vector, which are used to select and integrate the personal opinions of all annotators, respectively, to obtain the final output of the model, that is, the probability value of the binary classification. The lengths of the mask vector and the weight vector are both equal to the number of annotators. The elements of the mask vector are 0 or 1, indicating whether the opinion of the annotator is considered. The elements of the weight vector are non-negative real numbers, indicating the weight of the annotator's opinion. The final output of the model is the sum of the products of the personal opinions and the corresponding weights. After normalization, the probability value of the binary classification is obtained.
[0070] The following is a detailed description of each part in each stage.
[0071] (1) Constructing a dataset of annotators’ personal opinions
[0072] The first part of the model is the personal opinion prediction model of the annotators. This model mainly learns the personal opinions of different annotators in the data set. Due to the different growth experiences, age, gender, personal values, and religious beliefs of each annotator, when they participate in the annotation work of the subjective task data set, each person focuses on different aspects, so each person's opinion can reflect the characteristics of different aspects of the sample. Learning the personal opinions of the annotators can allow the model to understand the complexity and diversity of subjective tasks and learn the characteristics of different aspects of the samples.
[0073] Before training this part of the model, the original data set is augmented to construct a data set of personal opinions of the annotators. In the original data set, each sample is annotated by several annotators, and the final label is constructed by majority voting. Figure 3 In this embodiment, each sample data is enhanced into multiple individual samples of annotators. The specific number is the number of annotators who participated in the annotation work of the sample data. The label of each individual sample of annotators is the individual label annotated by the corresponding annotator, and is no longer the aggregate label of the sample in the original data set. At the same time, a special annotator identifier pre-determined in the model is added before each individual sample. The annotator identifier corresponds to a specific annotator one-to-one. The identifier is used to prompt the model which annotator's personal opinion needs to be predicted.
[0074] After each sample has been transformed as described above, all individual samples are mixed together to form the annotator’s individual opinion dataset.
[0075] (2) Training the annotator’s personal opinion prediction model (personal opinion module)
[0076] Use any pre-trained language model based on the Transformer architecture as the basic model of the personal opinion module, and add linear layers and Softmax activation functions to support binary classification tasks. At the same time, all the annotators' identifiers need to be added to the vocabulary of these language models to ensure that the model will recognize these special identifiers as a whole. Then, use the annotator's personal opinion dataset to train the model through any machine learning library to enable the model to learn the preferences and opinions of different annotators.
[0077] (3) Generate annotator’s personal opinion pool
[0078] After completing the training of the personal opinion module, freeze the parameters of the module. In order to obtain the opinion predictions of all annotators on any sample, each speech sample needs to be expanded into multiple personal samples again, similar to the previous step, but the annotator identifier inserted before the generated sample is no longer limited to the staff who participated in the labeling of the sample, but expanded to all annotators. Figure 4 Each original sample will generate a number of derived samples that is the same as the number of all annotators, and a different annotator identifier is inserted in front of each sample. By inputting all these derived personal samples into the personal opinion module, we can get the personal opinion prediction of each annotator on the sample. A personal opinion contains the predicted output, that is, the probability value of the two categories (offensive speech, ordinary speech), and the ID of the corresponding annotator. All personal opinions constitute the opinion pool of the sample.
[0079] (4) Training the annotator’s personal opinion fusion decision model (global opinion module)
[0080] See also Figure 5 The global opinion module is responsible for integrating the opinions in the opinion pool to make the final decision. During the training process, this module no longer learns the hard labels of one-hot encoding, but learns soft labels. The soft label contains the proportion of the opinions of each class in the total opinions among all the annotations for this sample, while the traditional hard label only contains the category information of this sample. Therefore, the information contained in the soft label covers the hard label and can reveal the degree of controversy of the annotation of the speech, which is conducive to the model's detection of controversial samples.
[0081] See also Figure 6 , the global opinion module still uses any language pre-training model based on the Transformer architecture as the basic model of the personal opinion module, accepts the input of the original sample text string, and outputs two vectors. The first vector is called the mask vector, and the value of each element of the vector consists of 0 and 1. The element at each position corresponds to an annotator. If the element is 1, it means that the decision model will consider the opinion of the annotator; on the contrary, if the element is 0, it means that the decision model will ignore the opinion of the annotator. The purpose of this is to allow the model to freely choose to ignore those personal opinion predictions that have not been effectively modeled. The second vector is called the weight vector, and its function is to assign a weight to each opinion. The model can flexibly view the opinions of each annotator through the allocation of weights. The reference value of personal opinions can be reflected and adjusted through weights to obtain more reliable output. These two vectors need to work together. The weight vector will first set the personal weight of the annotator who chooses to be ignored to 0 directly according to the result of the mask vector. After multiplying the personal opinion with the corresponding weight, the sum can be obtained to get the output of the model.
[0082] It should be noted that, in this embodiment, in addition to using machine learning methods to learn and classify features, the personal opinion module and the global opinion module may also use other algorithms, such as convolutional neural network CNN, hidden Markov model HMM, recurrent neural network RNN, etc.
[0083] In summary, the method of the present invention has at least the following advantages and beneficial effects compared to the prior art:
[0084] (1) Technical solution: The present invention proposes a two-stage modeling method for a social media attack speech detection model based on personal opinions. This method can start from personal opinions and allow a model based on machine learning or deep learning to learn multiple personal opinions on a certain speech. It can understand the risk of each speech that may offend a certain group of users from multiple aspects and angles, thereby improving the detection model's ability to detect implicit attack speech and effectively curbing the emergence of attack speech on social media today.
[0085] Advantages: As existing technologies are increasingly capable of detecting offensive speech on social media, social media users now deliberately use some means to avoid being identified by the system when making offensive speech. One of the more effective means is to blur the offensiveness of their speech and attack the other party through indirect means such as ridicule, rather than directly attacking the user as in the past. This approach blurs the boundary between normal speech and offensive speech, making this type of obscure offensive speech difficult to detect. This modeling method can listen to the opinions of different people and can discover those difficult-to-detect offensive speech, overcoming the shortcomings of traditional model strengthening methods in this regard.
[0086] (2) Technical solution: In this modeling method, the traditional hard labels formed by majority voting are abandoned. In the training stage of the personal opinion module, personal labels are used to learn the opinions of different people. In the training stage of the global opinion module, soft labels containing controversial information are used to learn the final detection output.
[0087] Advantages: The predicted probability output by the model will be more worthy of reference, reflecting the degree of controversy of the sample. If the probability of the two classifications of the predicted output is not much different, it means that the sample is likely to be controversial. At this time, it can be sent to manual review, so that valuable human resources can be used where they are most needed, greatly improving the accuracy of detection. The remaining samples that the model is more confident about the prediction results can be handed over to the system for further automatic processing, improving the efficiency of speech detection and processing.
[0088] (3) Technical solution: In addition to learning the opinions of each annotator, this modeling method does not blindly listen to all opinions in the decision-making stage. Instead, it controls the proportion of relevant opinions in the final model prediction output through mask vectors and weight vectors. The mask vector consists of 0 and 1. The element at each position corresponds to an annotator. If the element is 1, it means that the decision model will consider the opinion of the annotator; on the contrary, if the element is 0, it means that the decision model will ignore the opinion of the annotator. The weight vector assigns a weight to each opinion. The model can flexibly view the opinions of each annotator through the allocation of weights. The weight vector will first set the personal weight of the annotator who is chosen to be ignored to 0 directly based on the result of the mask vector. After multiplying the personal opinion by the corresponding weight, the sum is obtained to obtain the output of the model.
[0089] Advantages: Factors that affect the credibility of predicted opinions can be divided into two categories. The first category is the amount of labeled data. Generally, the number of annotations of different annotators within a crowdsourcing data set varies greatly. It is difficult for the model to learn the personal preferences and biases of annotators with fewer annotations, resulting in a low degree of reference for their related predicted opinions. The second reason is the quality of annotation by the annotator. If the annotator does not strictly follow the annotation instructions and annotates carefully, the labels he or she puts may not accurately reflect his or her personal opinions, resulting in the model not being able to learn his or her true personal opinions. After adding the mask vector and the weight vector, the model can flexibly view the opinions of each annotator through the allocation of weights. The reference value of personal opinions can be reflected and adjusted through weights, and the opinions that have not been effectively modeled can be ignored through mask vectors to obtain more reliable output.
[0090] This embodiment also provides a two-stage modeling device for a social media attack speech detection model, including:
[0091] The dataset construction module is used to obtain the original dataset and construct the annotator's personal opinion dataset;
[0092] The personal opinion module is used to build and train the annotator's personal opinion prediction model based on the constructed personal opinion dataset;
[0093] The opinion pool construction module is used to predict the personal opinion of each annotator on each sample in the original data set using the trained personal opinion prediction model, and generate the annotator's personal opinion pool;
[0094] The global opinion module is used to build and train annotator's personal opinion fusion decision model based on the original data set and the annotator's personal opinion pool.
[0095] A two-stage modeling device for a social media attack speech detection model in this embodiment can execute a two-stage modeling method for a social media attack speech detection model provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0096] This embodiment also provides a two-stage modeling device for a social media attack speech detection model, including:
[0097] at least one processor;
[0098] at least one memory for storing at least one program;
[0099] When the at least one program is executed by the at least one processor, the at least one processor implements Figure 7 The method shown.
[0100] A two-stage modeling device for a social media attack speech detection model in this embodiment can execute a two-stage modeling method for a social media attack speech detection model provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0101] The present application also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes Figure 7 The method shown.
[0102] This embodiment also provides a storage medium storing instructions or programs that can execute a two-stage modeling method for a social media attack speech detection model provided by an embodiment of the method of the present invention. When the instructions or programs are run, any combination of implementation steps of the method embodiment can be executed, and the corresponding functions and beneficial effects of the method can be obtained.
[0103] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0104] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0105] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0106] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0107] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0108] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0109] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0110] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0111] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A two-stage modeling method for detecting offensive speech on social media, characterized in that: The following steps are involved: Obtain the original data set and construct the annotator's personal opinion data set; Based on the constructed personal opinion dataset, a personal opinion prediction model for annotators is constructed and trained; For each sample in the original dataset, use the trained personal opinion prediction model to predict each annotator’s personal opinion on the sample and generate an annotator’s personal opinion pool; Based on the original data set and the annotator's personal opinion pool, a decision model that integrates the annotators' personal opinions is constructed and trained.
2. According to claim 1, the two-stage modeling method of a social media attack speech detection model is characterized in that: The step of constructing the annotator's personal opinion dataset includes: For each sample in the original data set, a corresponding number of personal samples are generated according to the number of annotators involved in the annotation. The label of each personal sample is the personal label of the corresponding annotator. Add an annotator identifier to each individual sample to indicate to the model whose individual opinion needs to be predicted.
3. According to claim 1, the two-stage modeling method for detecting social media attack speech is characterized in that: The step of constructing and training a personal opinion prediction model for annotators based on the constructed personal opinion dataset includes: Use the language pre-training model as the base model, input a sequence consisting of annotator identifiers and sample text, and output each annotator's personal opinion on the sample, that is, the probability value of the binary classification.
4. According to claim 1, the two-stage modeling method of a social media attack speech detection model is characterized in that: For each sample in the original data set, the trained personal opinion prediction model is used to predict each annotator's personal opinion on the sample, and a personal opinion pool of the annotators is generated, including: After completing the training of the personal opinion prediction model, freezing the parameters of the model; For each original sample, a number of derived samples is generated that is the same as the number of all annotators, and a different annotator identifier is inserted in front of each derived sample; All these derived personal samples are input into the trained personal opinion prediction model to obtain each annotator's personal opinion prediction for the sample, forming an opinion pool for the sample; Among them, a personal opinion contains the predicted output, that is, the probability value of the binary classification, and the ID of the corresponding annotation person.
5. According to claim 1, the two-stage modeling method of a social media attack speech detection model is characterized in that: The method of constructing and training a decision model integrating personal opinions of annotators based on the original data set and the personal opinion pool of annotators includes: Use the language pre-training model as the basic model, input a sequence consisting of sample texts, and output a mask vector and a weight vector, which are used to select and integrate the personal opinions of all annotators, respectively, to obtain the final output of the model, that is, the probability value of the binary classification; Among them, the lengths of the mask vector and the weight vector are both equal to the number of annotators. The elements of the mask vector are 0 or 1, indicating whether the opinion of the annotator is considered. The elements of the weight vector are non-negative real numbers, indicating the weight of the annotator's opinion. The final output of the model is the sum of the products of personal opinions and the corresponding weights, and the probability value of the two categories is obtained after normalization.
6. According to claim 1, a two-stage modeling method for detecting social media attack speech is characterized in that: The annotator's personal opinion prediction model uses a language pre-training model based on the Transformer architecture as the basic model of the personal opinion module; The annotator's personal opinion fusion decision model uses a language pre-training model based on the Transformer architecture as the basic model of the global opinion module.
7. According to claim 1, a two-stage modeling method for detecting social media attack speech is characterized in that: The annotator personal opinion prediction model and the annotator personal opinion fusion decision model are implemented by using a convolutional neural network CNN, a hidden Markov model HMM or a recurrent neural network RNN.
8. A two-stage modeling device for detecting social media attack speech, characterized in that: include: The dataset construction module is used to obtain the original dataset and construct the annotator's personal opinion dataset; The personal opinion module is used to build and train the annotator's personal opinion prediction model based on the constructed personal opinion dataset; the opinion pool construction module is used to use the trained personal opinion prediction model for each sample in the original dataset. Predict each annotator’s personal opinion on the sample and generate an annotator’s personal opinion pool; The global opinion module is used to build and train annotator's personal opinion fusion decision model based on the original data set and the annotator's personal opinion pool.
9. A two-stage modeling device for detecting social media attack speech, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to perform the method according to any one of claims 1 to 7 when executed by the processor.
