Recognition method, device and equipment for anti-pulse reviews and storage medium
By masking and detecting contradictory semantics in comments, the problem of traditional public opinion analysis tools struggling to identify sarcastic comments has been solved, enabling accurate identification and management of sarcastic comments.
Patent Information
- Application Number
- CN202511071473.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-12-30
AI Technical Summary
Traditional sentiment analysis tools struggle to effectively identify contradictory semantics in satirical comments, especially since satirical comments often lack explicit negative vocabulary, making it difficult for administrators to identify them using traditional sentiment analysis techniques.
A neural network model is used to train the comments. The surface sentiment semantics are eliminated by masking the comments to be identified. A sentiment expression pattern learner is used to predict the true sentiment tendency. Finally, a contradictory semantic detector is used to detect contradictory semantics in the comments and identify ironic comments.
It significantly improves the recognition of satirical comments, accurately identifies the true intentions in comments, and enhances the effectiveness of public opinion governance.
Smart Images

Figure CN121234935A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of public opinion governance, and in particular to a sarcasm comment identification method and device, equipment and a storage medium. BACKGROUND
[0002] Sarcasm comment identification is one of the important contents of domestic and foreign comment public opinion research. Recently, comments such as "low-level red" and "high-level black" have become a disaster area of public opinion governance. Such comments are characterized by using the rhetorical method of sarcasm to express derogatory and defamatory. The core of sarcasm is the opposition between "surface meaning" and "real intention", which makes traditional public opinion analysis tools often fall into the "literal meaning trap". Moreover, such sarcastic comments do not appear obvious negative words, and managers are difficult to effectively identify by relying on traditional sentiment analysis technology, and it is urgent to design a solution combining natural language processing front-end technology. SUMMARY
[0003] In a first aspect, the embodiments of the present disclosure provide a sarcasm comment identification method, which comprises: masking marking original subjective evaluation words in a to-be-identified comment to obtain a masked comment; inputting the masked comment into a sentiment expression pattern learner, and performing real sentiment tendency prediction on the masked comment by the sentiment expression pattern learner to output real subjective evaluation words; inputting the original subjective evaluation words and the real subjective evaluation words into a contradictory semantic detector, and performing contradictory semantic detection on the original subjective evaluation words and the real subjective evaluation words by the contradictory semantic detector to output a contradictory semantic detection result; identifying whether the to-be-identified comment is a sarcastic comment according to the contradictory semantic detection result.
[0004] In some implementable manners of the first aspect, the sentiment expression pattern learner is trained by the following manner: a plurality of comments are obtained, including normal comments and sarcastic comments; for any one comment, the original subjective evaluation words in the comment are masked marked to obtain a masked comment; if the comment is a normal comment, the original subjective evaluation words in the comment are extracted as the label of the masked comment; if the comment is a sarcastic comment, the comment is reconstructed from a sarcastic sentiment expression pattern to a normal sentiment expression pattern to obtain a reconstructed comment, and the reconstructed subjective evaluation words in the reconstructed comment are extracted as the label of the masked comment, wherein the semantic of the reconstructed subjective evaluation words and the original subjective evaluation words are contradictory; a sentiment expression pattern learning sample is constructed according to the masked comment and the label corresponding to the masked comment; the first neural network is trained according to the plurality of constructed sentiment expression pattern learning samples, and the trained first neural network is taken as the sentiment expression pattern learner.
[0005] In some implementable manners of the first aspect, the contradictory semantic detector is trained in the following manner: obtain a plurality of comments, including normal comments and sarcasm comments; for any one comment, mask mark original subjective evaluation words in the comment to obtain a masked comment; input the masked comment into the sentiment expression pattern learner, and perform true sentiment tendency prediction on the masked comment by the sentiment expression pattern learner to output true subjective evaluation words; set corresponding labels for the original subjective evaluation words and the true subjective evaluation words, wherein the labels are used to identify whether the semantics of the original subjective evaluation words and the true subjective evaluation words contradict each other; construct a contradictory semantic detection sample according to the original subjective evaluation words, the true subjective evaluation words, and the corresponding labels of the original subjective evaluation words and the true subjective evaluation words; train the preset second neural network according to the plurality of constructed contradictory semantic detection samples, and use the trained second neural network as the contradictory semantic detector.
[0006] In some implementable manners of the first aspect, the first neural network comprises a BERT-MLM pre-training layer, a full connection layer, and a Softmax layer, wherein the BERT-MLM pre-training layer, the full connection layer, and the Softmax layer are connected in sequence.
[0007] In some implementable manners of the first aspect, the second neural network comprises a prompt template embedding layer, a BERT-NSP pre-training layer, a full connection layer, and a Sigmoid layer, wherein the prompt template embedding layer, the BERT-NSP pre-training layer, the full connection layer, and the Sigmoid layer are connected in sequence.
[0008] In some implementable manners of the first aspect, the identification of whether the to-be-identified comment is a sarcasm comment according to the contradictory semantic detection result comprises: if the contradictory semantic detection result is contradictory, the to-be-identified comment is identified as a sarcasm comment; if the contradictory semantic detection result is not contradictory, the to-be-identified comment is identified as a normal comment and not a sarcasm comment.
[0009] In some implementable manners of the first aspect, the method further comprises: performing summary analysis on the identified sarcasm comments, and developing sarcasm comment governance according to the summary analysis result.
[0010] In the second aspect, the embodiments of the present disclosure provide a sarcasm comment identification device, which comprises: a mask marking module configured to mask mark original subjective evaluation words in a to-be-identified comment to obtain a masked comment; The real sentiment tendency prediction module is configured to input the masked comment into a sentiment expression pattern learner, perform real sentiment tendency prediction on the masked comment by the sentiment expression pattern learner, and output a real subjective evaluation word; The contradictory semantic detection module is configured to input the original subjective evaluation word and the real subjective evaluation word into a contradictory semantic detector, perform contradictory semantic detection on the original subjective evaluation word and the real subjective evaluation word by the contradictory semantic detector, and output a contradictory semantic detection result. The irony recognition module is configured to recognize whether the to-be-recognized comment is an ironic comment according to the contradictory semantic detection result.
[0011] In a third aspect, an electronic device is provided, which includes at least one processor, and a memory connected with the at least one processor in communication; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method as described above.
[0012] In a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, and the computer instructions are used to enable a computer to perform the method as described above.
[0013] Compared with the prior art, the present disclosure has at least the following technical effects: By marking the original subjective evaluation word in the to-be-recognized comment with a mask, the surface sentiment semantics of the to-be-recognized comment can be eliminated to obtain a masked comment including only objective facts, and then the real sentiment tendency of the reviewer can be accurately predicted by the sentiment expression pattern learner based on the context of the masked comment to output a real subjective evaluation word. Then, starting from the characteristic that the ironic comment itself is opposite in "surface meaning" and "real intention", the contradictory semantic detector performs contradictory semantic detection on the original subjective evaluation word and the real subjective evaluation word to output a contradictory semantic detection result, and finally whether the to-be-recognized comment is an ironic comment is effectively recognized according to the contradictory semantic detection result, thereby significantly improving the ironic comment recognition effect.
[0014] It should be understood that the content described in the summary section is not intended to limit or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become apparent through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0015] The above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent by describing in detail the following detailed description in conjunction with the accompanying drawings. The accompanying drawings are used to better understand the present disclosure, and do not constitute a limitation on the present disclosure, and the same or similar reference numerals in the accompanying drawings represent the same or similar elements, wherein: Figure 1A flow chart of a sarcasm comment recognition method provided by an embodiment of the present disclosure is shown. Figure 2 A mask marking and sentiment expression mode reconstruction schematic diagram provided by an embodiment of the present disclosure is shown. Figure 3 An example schematic diagram of a sarcasm comment recognition method provided by an embodiment of the present disclosure is shown. Figure 4 A training loss schematic diagram of a BERT-EPL in different training sets provided by an embodiment of the present disclosure is shown. Figure 5 A structural diagram of a sarcasm comment recognition device provided by an embodiment of the present disclosure is shown. Figure 6 A structural diagram of an example electronic device capable of implementing an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0016] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are some, but not all, of the embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present disclosure.
[0017] In addition, the term “and / or” herein is only to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. In addition, the character “ / ” herein generally represents that the front and rear associated objects are in an “or” relationship.
[0018] To solve the problems in the background art, the embodiments of the present disclosure provide a sarcasm comment recognition method, device, equipment, and storage medium. Specifically, the original subjective evaluation words in the to-be-recognized comment can be masked and marked to eliminate the surface sentiment semantics of the to-be-recognized comment, and a masked comment including only objective facts is obtained. Then, the real emotional tendency of the commenters is accurately predicted based on the context of the masked comment by a sentiment expression mode learner, and the real subjective evaluation words are output. Then, starting from the opposite characteristics of the “surface meaning” and “real intention” of the sarcasm comment, the original subjective evaluation words and the real subjective evaluation words are detected by a contradictory semantic detector, and the contradictory semantic detection result is output. Finally, whether the to-be-recognized comment is a sarcasm comment is effectively recognized according to the contradictory semantic detection result, thereby significantly improving the sarcasm comment recognition effect.
[0019] The following detailed description, with reference to the accompanying drawings and specific embodiments, illustrates a method, apparatus, device, and storage medium for identifying ironic comments provided by the present disclosure.
[0020] Figure 1 A flowchart illustrating an embodiment of the present disclosure provides a method for recognizing ironic comments, such as... Figure 1 As shown, method 100 may include the following steps: S110, Mask the original subjective evaluation words in the comments to be identified to obtain the masked comments.
[0021] Specifically, the comments to be identified can be segmented into words first to obtain the segmentation results. Then, the original subjective evaluation words can be determined from the segmentation results and masked to obtain the masked comments.
[0022] S120: Input the masked comments into the sentiment expression pattern learner. The sentiment expression pattern learner predicts the true sentiment tendency of the masked comments and outputs the true subjective evaluation words.
[0023] The emotion expression pattern learner used here can be trained in the following way: Get multiple comments, including normal comments (which are further divided into positive and negative comments) and sarcastic comments.
[0024] For any given comment, the following method is used to construct a learning sample of sentiment expression patterns: The original subjective evaluation words in the comments are masked to obtain masked comments. If the comment is normal, the original subjective evaluation words are extracted as labels for the masked comments; if the comment is ironic, it is reconstructed from an ironic sentiment expression pattern to a normal sentiment expression pattern to obtain reconstructed comments, and the reconstructed subjective evaluation words in the reconstructed comments are extracted as labels for the masked comments. Sentiment expression pattern learning samples are constructed based on the masked comments and their corresponding labels. Note that the semantics of the reconstructed subjective evaluation words contradict those of the original subjective evaluation words; the masking and sentiment expression pattern reconstruction can be performed as follows: Figure 2 As shown.
[0025] The first neural network is trained based on multiple constructed emotion expression pattern learning samples, and the trained first neural network is used as the emotion expression pattern learner.
[0026] It is worth noting that the mapping between specific facts in an objective context and the commenter's subjective evaluation words is called the sentiment expression mapping pattern (or sentiment expression pattern for short). The key to distinguishing between normal and ironic comments lies in the mapping rules of the sentiment expression pattern. From the joint distribution of sentiment and facts, ironic comments have the opposite sentiment expression pattern to normal comments. Taking the facts and evaluations of a comment s as random variables X and Y respectively, the comment label Z is identified through the joint distribution of X and Y, including three types of labels: positive comments, negative comments, and ironic comments. Taking "disabling WeChat work groups" as an example, Table 1 shows three comments. Among them, the fact X of the negative comment is "calling project members one by one to confirm," which represents "repeatedly doing the same physical activities at work." From its evaluation Y "seriously lagging behind in progress," this type of fact corresponds to the commenter's negative emotions; therefore, fact X in this comment is a negative attribute. Therefore, when constructing the samples required for training the sentiment expression pattern learner, it is necessary to reconstruct the sentiment expression pattern of ironic comments, transforming them from an ironic sentiment expression pattern to a normal sentiment expression pattern. In other words, ironic comments are reconstructed into normal comments that are consistent with facts and evaluations. This makes it easier for the sentiment expression pattern learner to learn the normal sentiment expression pattern and thus predict the commenter's true sentiment tendency in the current context.
[0027] Table 1 As an example, the pre-defined first neural network may include: a BERT-MLM pre-trained layer, a fully connected layer, and a Softmax layer, which are connected sequentially. When training the first neural network, the masked comment is input to the BERT-MLM pre-trained layer, and the feature vector at the [mask] position is extracted from its last hidden state layer; this is a 768-dimensional feature vector. This feature vector is the calculated value at the [mask] position of the masked comment by the BERT-MLM pre-trained layer in conjunction with the context and using an attention mechanism. This value is then fed into the fully connected layer, which transforms the feature vector at the [mask] position into a space with a dimension equal to the size of the label set. The Softmax layer then calculates the probability of each word in the label set. Furthermore, the word with the highest probability is used as the predicted subjective evaluation word at the [mask] position of the masked comment. Subsequently, a loss value is calculated based on the corresponding predicted value and label, and the parameters of the first neural network are updated based on the loss value. This process is iterated until the training stopping condition is met.
[0028] S130: Input the original subjective evaluation words and the real subjective evaluation words into the contradiction semantic detector. The contradiction semantic detector performs contradiction semantic detection on the original subjective evaluation words and the real subjective evaluation words, and outputs the contradiction semantic detection result.
[0029] The contradiction semantic detector used here can be trained in the following way: Get multiple comments, including normal comments (which are further divided into positive and negative comments) and sarcastic comments.
[0030] For any given comment, the following method is used to construct a contradiction semantic detection sample: The original subjective evaluation words in the comments are masked to obtain masked comments. These masked comments are then input into a sentiment expression pattern learner, which predicts the true sentiment tendency of the masked comments and outputs the true subjective evaluation words. Corresponding labels are assigned to the original and true subjective evaluation words, whereby the labels indicate whether the semantics of the original and true subjective evaluation words contradict each other. Contradiction semantic detection samples are constructed based on the original and true subjective evaluation words and their corresponding labels.
[0031] The pre-defined second neural network is trained based on multiple contradictory semantic detection samples, and the trained second neural network is used as the contradictory semantic detector.
[0032] As an example, the pre-defined second neural network may include: a cue template embedding layer, a BERT-NSP pre-training layer, a fully connected layer, and a sigmoid layer, wherein the cue template embedding layer, BERT-NSP pre-training layer, fully connected layer, and sigmoid layer are connected sequentially. The cue template embedding layer uses a fixed-format template, such as the subjective evaluation word at the [evaluation] position in the template "makes people feel / feel [evaluation]". This template can provide a specific formatted input to the BERT-NSP pre-training layer, typically containing words with subjective biases such as emotions, attitudes, and feelings, guiding the model to classify sentences. During the training of the second neural network, the original subjective evaluation words before masking and the real subjective evaluation words output by the sentiment expression pattern learner for predicting the true sentiment bias of the masked comments are fed into the cue template embedding layer, combined into sentence pairs in the form of "[CLS] + cue embedding sentence 1 + [SEP] + cue embedding sentence 2 + [SEP]". Here, [SEP] is the sentence separator. The entire sentence pair is input into the BERT-NSP pre-trained layer for sentence pair relationship prediction. Then, the fully connected layer converts the [CLS] labeled output into a feature vector, and the Sigmoid layer calculates the probability of whether the input sentence pair contradicts each other, outputting a contradiction prediction result. Subsequently, a loss value is calculated based on the corresponding contradiction prediction result and the label, and then the parameters of the second neural network are updated based on the loss value. This process iterates until the training stopping condition is met. Optionally, binary cross-entropy is used as the loss function.
[0033] S140, Based on the contradictory semantic detection results, identify whether the comment to be identified is an ironic comment.
[0034] Specifically, if the semantic contradiction detection result is contradictory, the comment to be identified is identified as an ironic comment; if the semantic contradiction detection result is not contradictory, the comment to be identified is identified as a normal comment and not an ironic comment.
[0035] Furthermore, to improve the effectiveness of managing satirical comments, the identified satirical comments can be aggregated and analyzed, and the management of satirical comments can be carried out based on the aggregated analysis results.
[0036] In summary, this disclosure achieves at least the following technical effects: The surface sentiment semantics of the comment to be identified can be eliminated by masking the original subjective evaluation words in the comment to be identified, resulting in a masked comment that only includes objective facts. Then, the sentiment expression pattern learner accurately predicts the commenter's true sentiment tendency based on the context of the masked comment and outputs the true subjective evaluation words. Next, based on the characteristic of the contradiction between the "surface meaning" and "true intention" of the ironic comment itself, the contradiction semantic detector performs contradiction semantic detection on the original subjective evaluation words and the true subjective evaluation words, and outputs the contradiction semantic detection results. Finally, based on the contradiction semantic detection results, it is possible to effectively identify whether the comment to be identified is an ironic comment, thereby significantly improving the ironic comment identification effect.
[0037] The following example illustrates method 100: Taking the comment "A warning was given for not answering a customer's call for four minutes while showering; such strict discipline gives one confidence in the company's management" as an example, the identification process is as follows: Figure 3 As shown, firstly, the original subjective evaluation words in the comment are masked, resulting in the masked comment "Being warned for not answering a customer's call for 4 minutes while showering makes one feel disgusted with the company's management [mask]". Then, the masked comment is input into a sentiment expression pattern learner, which predicts the true sentiment tendency of the masked comment and outputs the true subjective evaluation word as "disappointment". Finally, the original subjective evaluation word "confidence" and the true subjective evaluation word "disappointment" are input into a contradiction semantic detector, which performs contradiction semantic detection on both and outputs the contradiction semantic detection result. Based on the contradiction semantic detection result, the comment is identified as an ironic comment.
[0038] To further demonstrate the advancements of the method 100 (hereinafter referred to as BERT-EPL) employed in this disclosure, the following comparative tests are conducted.
[0039] (1) Data settings The training data consists of normal comments and satirical comments. First, policy-related and military-related comments were crawled and manually labeled from the Weibo platform. Then, normal comments, including both positive and negative comments, were sampled from the Chinese sentiment analysis dataset. The original comment data, comprising both normal and satirical comments, totaled 12,282 comments, used to construct the training, validation, and test sets, containing 8,282, 2,000, and 2,000 comments respectively. The number of satirical and normal comments is shown in Table 2.
[0040] Table 2 (2) Experimental method setup Four methods were tested: BERT-EPL, BERT-FC, TextCNN, TextRNN, and DPCNN.
[0041] (3) Evaluation index setting Recall, precision, and F1 score are used as metrics. Negative review recall is the ratio of the number of reviews accurately identified as negative to the total number of negative reviews in the test set. Similarly, the precision for positive reviews and sarcastic reviews is calculated in the same way. Precision refers to the ratio of reviews accurately classified into a certain category. For example, the precision for sarcastic reviews is the ratio of the number of true positive reviews correctly classified as sarcastic to the total number of samples identified as sarcastic. Considering that recall (R) and precision (P) metrics sometimes contradict each other, the F1 score is used for comparison, i.e., F1 = 2*R*P / (R+P).
[0042] (4) Model Setup. BERT-EPL and BERT-FC consist of the BERT pre-trained model bert-base-chinese and downstream task models. bert-base-chinese is used for feature extraction; its encoder has 12 hidden layers and outputs a 768-dimensional tensor to the downstream task model. It has been trained with simplified and traditional Chinese text. The downstream task model of BERT-FC is a fully connected neural network that computes the features extracted by the bert-base-chinese model. Since the BERT model has acquired rich language knowledge through large-scale pre-training, the parameters of the BERT pre-trained model do not need to be updated. Therefore, fine-tuning only updates the parameters of the downstream network, and the learning rate is set to 5e-5. The dropout rate of DPCNN, TextCNN, and TextRNN is set to 0.5, the batch size is set to 32, and the learning rate is 1e-3. Among them, TextCNN uses convolutional kernels with sizes of 2, 3, and 4, respectively. The number of iterations for all methods is set to 30, that is, the number of times the full data passes through the model. If the training effect does not improve after more than 1000 consecutive batches, the training is terminated early.
[0043] (5) Analysis of experimental results Table 3 shows the accuracy and other metrics of different methods on the same dataset. DPCNN, TextCNN, and TextRNN all lag behind methods based on the BERT pre-trained model in all performance metrics. These models are characterized by their reliance on the quality of external word vectors. Compared to methods like TextCNN, BERT is pre-trained on a large-scale corpus and, through its attention mechanism, can better learn word vector representations from context, making it more suitable for scenarios requiring a high level of understanding of language context and complex semantics.
[0044] Table 3 To analyze the impact of negative fine-tuning on knowledge reuse in BERT pre-trained models, the proportion of sarcastic comments in the training corpus was further adjusted. A certain number of sarcastic comments were randomly selected and mixed with normal comments in a certain proportion to form three training sets, D1, D2, and D3, with sarcastic comments accounting for 30%, 50%, and 70% of the total training samples, respectively. The total number of comments in each of the three datasets was 3000.
[0045] The classification performance of BERT-EPL and BERT-FC was tested using these three training sets. Table 4 shows the precision, recall, and F1 score of these two methods. On the one hand, the BERT-FC method showed inconsistent performance across various metrics on different datasets, achieving the best results when trained on the D2 dataset. However, as the proportion of sarcastic comments increased, the BERT-FC method did not achieve better recognition precision. Analysis suggests that directly fine-tuning the BERT pre-trained model using sarcastic comment corpora carries the risk of performance degradation. Existing research also indicates that, when training general-purpose large language models based on Transformers as vertical domain models, a significant difference in the distribution of data obtained from the vertical domain compared to the general pre-training data can lead to catastrophic forgetting and performance degradation.
[0046] Table 4 On the other hand, because BERT-EPL does not directly use a high proportion of method comment data for fine-tuning, but instead trains on corpora after reconstructing sentiment expression patterns, this method shows relatively stable performance on different datasets. Secondly, we analyze the training details of BERT-EPL. During the training phase, fine-tuning was performed using training sets D1, D2, and D3 respectively, and the training loss was observed. Training lasted for 320 iterations, and all three models converged in the end. The training loss is as follows: Figure 4 As shown, the larger the proportion of sarcastic comments in the fine-tuning dataset, the more difficult it is for the training loss to converge.
[0047] (6) Experimental conclusions To address the problem of identifying ironic comments, BERT-EPL was designed, comprising two core components: a sentiment expression pattern learner and a contradiction word pair detector. The sentiment pattern learner leverages the capabilities of the BERT pre-trained model to predict the commenter's true sentiment tendency. The contradiction word pair detector uses predefined prompt templates to construct sentence pairs from the predicted sentiment tendency and the original comment's subjective evaluation, and determines the irony through the contradiction relationship between the sentences. Experimental results show that irony recognition methods like BERT-FC achieve higher accuracy than methods such as TextRNN and TextCNN, but there is still room for improvement. BERT-EPL, by preserving the factual basis of the comment and masking subjective evaluation, constructs a training corpus consistent with the facts and evaluations for the pre-trained model to learn the commenter's true sentiment tendency. This effectively avoids the negative fine-tuning problem of the pre-trained model, thus significantly improving the performance of ironic comment recognition.
[0048] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this disclosure.
[0049] The above is an introduction to the method embodiments. The following describes the solution described in this disclosure further through device embodiments.
[0050] Figure 5 A structural diagram of an ironic comment recognition device provided by an embodiment of this disclosure is shown, such as... Figure 5 As shown, the device 500 may include: The masking module 510 is used to mask the original subjective evaluation words in the comments to be identified, so as to obtain the masked comments.
[0051] The true sentiment tendency prediction module 520 is used to input the masked comments into the sentiment expression pattern learner, which then predicts the true sentiment tendency of the masked comments and outputs true subjective evaluation words.
[0052] The contradiction semantic detection module 530 is used to input the original subjective evaluation words and the real subjective evaluation words into the contradiction semantic detector, and the contradiction semantic detector performs contradiction semantic detection on the original subjective evaluation words and the real subjective evaluation words, and outputs the contradiction semantic detection results.
[0053] The irony recognition module 540 is used to identify whether a comment to be identified is an ironic comment based on the contradictory semantic detection results.
[0054] Understandable,Figure 5 Each module / unit in the illustrated device 500 has the ability to implement Figure 1 The functions of each step in method 100 shown, and their corresponding technical effects, will not be elaborated here for the sake of brevity.
[0055] Figure 6 A structural diagram of an exemplary electronic device capable of implementing embodiments of the present disclosure is shown. Electronic device 600 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 600 may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0056] like Figure 6 As shown, the electronic device 600 may include a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. The RAM 603 may also store various programs and data required for the operation of the electronic device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0057] Multiple components in electronic device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of displays, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows electronic device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0058] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as method 100. For example, in some embodiments, method 100 may be implemented as a computer program product, including a computer program tangibly contained in a computer-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of method 100 described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform method 100 by any other suitable means (e.g., by means of firmware).
[0059] The various embodiments described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), payload programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0060] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0061] In the context of this disclosure, a computer-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of computer-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0062] It should be noted that this disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute method 100 and achieve the corresponding technical effects achieved by the embodiments of this disclosure in executing the method. For the sake of brevity, these will not be elaborated here.
[0063] In addition, this disclosure also provides a computer program product including a computer program that implements method 100 when executed by a processor.
[0064] To provide interaction with a user, the embodiments described above can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0065] The embodiments described above can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with the implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0066] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0067] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0068] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A sarcasm comment identification method, characterized by, The method comprises: masking an original subjective evaluation word in a to-be-identified comment to obtain a masked comment; inputting the masked comment into an emotional expression mode learner, performing real emotional tendency prediction on the masked comment by the emotional expression mode learner, and outputting a real subjective evaluation word; inputting the original subjective evaluation word and the real subjective evaluation word into a contradictory semantic detector, performing contradictory semantic detection on the original subjective evaluation word and the real subjective evaluation word by the contradictory semantic detector, and outputting a contradictory semantic detection result; identifying whether the to-be-identified comment is a sarcasm comment according to the contradictory semantic detection result.
2. The method of claim 1, wherein, The emotional expression mode learner is obtained by the following method: obtaining a plurality of comments, including normal comments and sarcasm comments; masking an original subjective evaluation word in any comment to obtain a masked comment; if the comment is a normal comment, extracting the original subjective evaluation word in the comment as a label of the masked comment; if the comment is a sarcasm comment, reconstructing the comment from a sarcastic emotional expression mode to a normal emotional expression mode to obtain a reconstructed comment, extracting a reconstructed subjective evaluation word in the reconstructed comment as a label of the masked comment, wherein the semantic of the reconstructed subjective evaluation word and the original subjective evaluation word are contradictory to each other; and constructing an emotional expression mode learning sample according to the masked comment and the label corresponding to the masked comment; training a preset first neural network according to the plurality of constructed emotional expression mode learning samples, and taking the trained first neural network as the emotional expression mode learner.
3. The method of claim 2, wherein, The contradictory semantic detector is obtained by the following method: obtaining a plurality of comments, including normal comments and sarcasm comments; masking an original subjective evaluation word in any comment to obtain a masked comment; inputting the masked comment into an emotional expression mode learner, performing real emotional tendency prediction on the masked comment by the emotional expression mode learner, and outputting a real subjective evaluation word; setting a corresponding label for the original subjective evaluation word and the real subjective evaluation word, wherein the label is used to identify whether the semantic of the original subjective evaluation word and the real subjective evaluation word are contradictory to each other; constructing a contradictory semantic detection sample according to the original subjective evaluation word and the real subjective evaluation word and the label corresponding to the original subjective evaluation word and the real subjective evaluation word; training a preset second neural network according to the plurality of constructed contradictory semantic detection samples, and taking the trained second neural network as the contradictory semantic detector.
4. The method of claim 3, wherein, The first neural network comprises a BERT-MLM pre-training layer, a full connection layer and a Softmax layer, wherein the BERT-MLM pre-training layer, the full connection layer and the Softmax layer are connected in sequence.
5. The method of claim 3, wherein, The second neural network comprises a prompt template embedding layer, a BERT-NSP pre-training layer, a full connection layer and a Sigmoid layer, wherein the prompt template embedding layer, the BERT-NSP pre-training layer, the full connection layer and the Sigmoid layer are connected in sequence.
6. The method according to any one of claims 1 to 5, characterized in that, The identification of whether the to-be-identified comment is a sarcasm comment according to the contradictory semantic detection result comprises: If the contradictory semantic detection result is contradictory, the to-be-identified comment is identified as a sarcasm comment; if the contradictory semantic detection result is not contradictory, the to-be-identified comment is identified as a normal comment, and is not a sarcasm comment.
7. The method of claim 1, wherein, The method further comprises: performing summary analysis on the identified sarcasm comments, and developing sarcasm comment governance according to the summary analysis result.
8. An irony comment identifying apparatus characterized by comprising: The device comprises: a mask marking module configured to mark original subjective evaluation words in the to-be-identified comment with a mask to obtain a masked comment; a true sentiment tendency prediction module configured to input the masked comment into a sentiment expression pattern learner, and to perform true sentiment tendency prediction on the masked comment by the sentiment expression pattern learner to output true subjective evaluation words; a contradictory semantic detection module configured to input the original subjective evaluation words and the true subjective evaluation words into a contradictory semantic detector, and to perform contradictory semantic detection on the original subjective evaluation words and the true subjective evaluation words by the contradictory semantic detector to output a contradictory semantic detection result; a sarcasm identification module configured to identify whether the to-be-identified comment is a sarcasm comment according to the contradictory semantic detection result.
9. An electronic device, comprising: The electronic device comprises at least one processor, and a memory connected in communication with the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-7.