A social text stance recognition method and system based on claim generation and consistency analysis

By constructing text pairs and utilizing a weighted fusion method combining a pre-trained model and a sentiment dictionary, the problem of capturing complex semantics in stance recognition in existing technologies is solved, achieving more stable and reliable stance recognition in social texts and adapting to high-precision recognition in multi-topic scenarios.

CN120780844BActive Publication Date: 2025-11-28DATA SPACE RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511296515.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-11
Publication Date
2025-11-28
Estimated Expiration
2045-09-11

AI Technical Summary

Technical Problem

Existing position recognition technologies struggle to capture complex semantic relationships and contextual information, especially when the target is not explicitly stated or the meaning is obscure. They also have difficulty handling complex linguistic phenomena such as irony and metaphor, and their generalization ability is poor and their domain transfer is not robust.

Method used

By constructing text pairs, including assertion sentences and preprocessed user tweet text, assertion sentences are generated using a pre-trained semantic consistency recognition model and a generative language model. These are then combined with a sentiment lexicon for weighted fusion to calculate a comprehensive stance inclination score, thus achieving a comprehensive judgment based on cognitive logic and emotional attitude.

Benefits of technology

It improves the stability and reliability of social text stance recognition in scenarios with strong emotions and varied language styles, enhances the accuracy and interpretability of stance recognition, and adapts to fine-grained recognition in multi-topic scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120780844B_ABST
    Figure CN120780844B_ABST
Patent Text Reader

Abstract

The application discloses a social text stand identification method and system based on claim generation and consistency analysis, relates to the field of natural language processing, and comprises the following steps: obtaining original user tweet texts of users and preprocessing the original user tweet texts to obtain preprocessed user tweet texts; constructing text pairs according to the preprocessed user tweet texts; inputting the text pairs into a pre-trained semantic consistency identification model to obtain consistency identification results; wherein the consistency identification results comprise semantic consistency scores and semantic stand classification results; performing sentiment analysis on the preprocessed user tweet texts based on a pre-set sentiment dictionary, and calculating sentiment tendency scores; weighting and fusing the semantic consistency scores and the sentiment scores to obtain comprehensive stand tendency scores; and obtaining the stands of the users according to the comprehensive stand tendency scores and the semantic stand classification results. The application improves the stability and reliability of social text stand identification in scenes with strong emotions and variable language styles.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, and particularly relates to a social text stance recognition method and system based on claim generation and consistency analysis. BACKGROUND

[0002] Stance recognition is a natural language processing task that aims to identify the attitude of the author towards a specific target (such as an event, opinion, person or thing) in the text, and usually classifies the stance as support, opposition or neutral.

[0003] Early stance recognition techniques rely on manually constructed sentiment dictionaries, syntactic rules or statistical features (such as bag of words, TF-IDF, sentiment dictionary, dependency relations, sentiment polarity scores, etc.), and combine traditional classification models for judgment, but such methods are difficult to capture complex semantic relationships and context information, have poor generalization ability, are not robust to domain migration, and rely on expert experience for feature design.

[0004] In recent years, the pre-trained language model BERT can better understand the relationship between context semantics and targets through joint modeling of text-target pairs, achieving leading results on multiple datasets and bringing significant performance improvements to the stance recognition task. However, this method does not fully model the relationship between the target and the text, making it difficult to handle cases where the target is not explicitly present or the semantics are ambiguous; and has limited understanding of complex language phenomena such as satire and metaphor. SUMMARY

[0005] To solve the technical problems in the background art, the present application proposes a social text stance recognition method and system based on claim generation and consistency analysis.

[0006] In a first aspect, the present application proposes a social text stance recognition method and system based on claim generation and consistency analysis, comprising:

[0007] obtaining an original user tweet text of a user;

[0008] constructing a text pair according to the preprocessed user tweet text; wherein the text pair comprises: a claim sentence and the preprocessed user tweet text;

[0009] inputting the text pair into a pre-trained semantic consistency recognition model to obtain a consistency recognition result; wherein the consistency recognition result comprises a semantic consistency score and a semantic stance classification result;

[0010] performing sentiment analysis on the preprocessed user tweet text based on a pre-set sentiment dictionary to calculate a sentiment tendency score;

[0011] weighting and fusing the semantic consistency score and the sentiment score to obtain a comprehensive stance tendency score;

[0012] According to the comprehensive position tendency score and the semantic position classification result, the position of the user is obtained.

[0013] Preferably, the original user tweet text is preprocessed to obtain preprocessed user tweet text, specifically including:

[0014] Defining a keyword dictionary containing target topic keywords;

[0015] Matching the original user tweet text with the target topic keywords in the keyword dictionary, and taking the target topic keywords that match successfully as the preprocessed user tweet text.

[0016] Preferably, according to the preprocessed user tweet text, a text pair is constructed, specifically including:

[0017] When the number of preprocessed user tweet texts is 1, keyword extraction is performed on the preprocessed user tweet text to obtain M keywords corresponding to the preprocessed user tweet text;

[0018] Using a pre-trained generative language model to automatically construct a proposition sentence for the preprocessed user tweet text according to the keywords corresponding to the preprocessed user tweet text;

[0019] When the number of preprocessed user tweet texts is multiple, unsupervised clustering method is used for clustering analysis of the preprocessed user tweet texts, and according to the clustering analysis result, the multiple preprocessed user tweet texts are divided into N classes, and M keywords are extracted from the preprocessed user tweet texts in each class to represent the preprocessed user tweet texts in the class;

[0020] Using a pre-trained generative language model to automatically construct a proposition sentence for each preprocessed user tweet text in each class according to the keywords of the preprocessed user tweet texts in each class;

[0021] Each preprocessed user tweet text and the corresponding proposition sentence form a text pair.

[0022] Preferably, M keywords are extracted from the preprocessed user tweet texts in each class to represent the preprocessed user tweet texts in the class, specifically including:

[0023] Keyword extraction is performed on the preprocessed user tweet texts in each class to obtain initial keywords;

[0024] Using a pre-trained part-of-speech tagging model to filter the initial keywords to obtain noun keywords;

[0025] Statistical analysis of the noun keywords to obtain a noun keyword frequency list;

[0026] Select the top M nouns in the keyword frequency list as the keywords of the preprocessed user tweet text of each category.

[0027] Preferably, a claim sentence is automatically constructed for each preprocessed user tweet text in each category using a pre-trained generative language model based on the keywords of the preprocessed user tweet text of each category, specifically including:

[0028] A mapping relationship between the keywords of the preprocessed user tweet text of each category and each preprocessed user tweet text in each category is constructed.

[0029] A claim sentence is automatically constructed using a pre-trained generative language model based on the keywords of the preprocessed user tweet text of each category.

[0030] According to the mapping relationship between the keywords of the preprocessed user tweet text of each category and each preprocessed user tweet text in each category and the claim sentence corresponding to the keywords of the preprocessed user tweet text of each category, the claim sentence corresponding to each preprocessed user tweet text of each category is obtained.

[0031] Preferably, the semantic consistency recognition model includes an input layer, a fusion layer, an encoding layer, a processing layer, a cosine similarity calculation layer, a fully connected layer, and an output layer.

[0032] The input layer is used to input the text pair into the fusion layer and the encoding layer; the fusion layer is used to splice and encode the claim sentence and the preprocessed user tweet text in the text pair to obtain a fusion sequence; the encoding layer is used to encode the claim sentence in the text pair to obtain a claim sentence encoding sequence; the processing layer is used to generate a viewpoint representation according to the fusion sequence and a claim representation according to the claim sentence encoding sequence; the cosine similarity calculation layer is used to calculate the cosine similarity between the claim representation and the viewpoint representation; the fully connected layer is used to generate a semantic stance classification result according to the value of the cosine similarity and the viewpoint representation; and the output layer is used to output the value of the cosine similarity as a semantic consistency score and combine the semantic consistency score and the semantic stance classification result as a consistency recognition result.

[0033] Preferably, the processing layer is a large language model BERT based on a Transformer architecture.

[0034] Preferably, the preprocessed user tweet text is analyzed based on a pre-set sentiment dictionary to calculate a sentiment tendency score, specifically including:

[0035] The content of the preprocessed user tweet text is segmented into one or more words.

[0036] The one or more words are matched with positive words and negative words in a preset sentiment dictionary, and a polarity label of the matched word in the sentiment dictionary is obtained; wherein the polarity label includes positive and negative;

[0037] According to the polarity label of the matched word in the sentiment dictionary and the word frequency in the tweet content in the preprocessed user tweet text, a sentiment tendency score is calculated.

[0038] Preferably, the calculation formula of the comprehensive stance tendency score is semantic consistency score sentiment tendency score

[0039] In the formula, is a weight parameter, is the comprehensive stance tendency score.

[0040] Preferably, according to the comprehensive stance tendency score and the semantic stance classification result, the stance of the user is obtained, specifically including:

[0041] When the comprehensive stance tendency score is greater than a set positive threshold, the user is determined to be a support party of the semantic stance classification result;

[0042] When the comprehensive stance tendency score is less than a set negative threshold, the user is determined to be an opposite party of the semantic stance classification result; wherein the negative threshold is less than the positive threshold;

[0043] When the comprehensive stance tendency score is less than or equal to the set positive threshold and greater than or equal to the set negative threshold, the user is determined to be a neutral party of the semantic stance classification result.

[0044] In a second aspect, the present application further provides a social text stance recognition system based on claim generation and consistency analysis, comprising:

[0045] An acquisition module is configured to acquire original user tweet text of a user;

[0046] A text pair construction module is configured to construct a text pair according to the preprocessed user tweet text; wherein the text pair includes a claim sentence and the preprocessed user tweet text;

[0047] A consistency recognition module is configured to input the text pair into a pre-trained semantic consistency recognition model to obtain a consistency recognition result; wherein the consistency recognition result includes a semantic consistency score and a semantic stance classification result;

[0048] An emotion analysis module is configured to perform emotion analysis on the original user tweet text in the preprocessed user tweet text in the text pair based on a preset sentiment dictionary, and calculate a sentiment tendency score;

[0049] The position analysis module is configured to combine the semantic consistency score and the sentiment score by weighting to obtain a comprehensive position tendency score, and obtain the position of the user according to the comprehensive position tendency score and the semantic position classification result.

[0050] In specific implementation, the original user tweet text of the user is acquired; the original user tweet text is preprocessed to obtain preprocessed user tweet text; a text pair is constructed according to the preprocessed user tweet text; the text pair is input into a pre-trained semantic consistency identification model to obtain an identification result; sentiment analysis is performed on the preprocessed user tweet text based on a preset sentiment dictionary to calculate a sentiment tendency score; the semantic consistency score and the sentiment score are combined by weighting to obtain a comprehensive position tendency score; and the position of the user is obtained according to the comprehensive position tendency score and the semantic position classification result.

[0051] In the present application, the proposed social text position recognition method and system based on claim generation and consistency analysis identify a text pair through a pre-trained semantic consistency identification model to obtain a semantic consistency score and a semantic position classification result, introduce a sentiment tendency score on the basis of consistency judgment, quantify the emotional tendency expressed by the user, combine the sentiment tendency score and the consistency score by weighting, obtain a comprehensive position tendency score and a semantic position classification result according to the weighted combination, and obtain the position of the user, thereby comprehensively judging the position of the user from two dimensions of cognitive logic and emotional attitude, and improving the stability and reliability of social text position recognition in a scene with strong emotions and variable language styles. BRIEF DESCRIPTION OF DRAWINGS

[0052] Figure 1 The figure is a flowchart of the social text position recognition method based on claim generation and consistency analysis in an embodiment of the present application.

[0053] Figure 2 The figure is a data flow diagram of the semantic consistency identification model in an embodiment of the present application. DETAILED DESCRIPTION

[0054] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments.

[0055] REFERENCE Figure 1 The social text position recognition method based on claim generation and consistency analysis proposed in the present application comprises the following steps:

[0056] The original user tweet text of the user is acquired.

[0057] The original user tweet text is preprocessed to obtain preprocessed user tweet text.

[0058] constructing a text pair according to the preprocessed user tweet text; wherein the text pair comprises a claim sentence and the preprocessed user tweet text;

[0059] inputting the text pair into a pre-trained semantic consistency recognition model to obtain a consistency recognition result; wherein the consistency recognition result comprises a semantic consistency score and a semantic stance classification result;

[0060] performing sentiment analysis on the preprocessed user tweet text based on a preset sentiment dictionary to calculate a sentiment tendency score;

[0061] performing weighted fusion of the semantic consistency score and the sentiment score to obtain a comprehensive stance tendency score;

[0062] obtaining the user's stance according to the comprehensive stance tendency score and the semantic stance classification result.

[0063] In specific implementation, the original user tweet text of a user is obtained; the original user tweet text is preprocessed to obtain a preprocessed user tweet text; a text pair is constructed according to the preprocessed user tweet text; the text pair is input into a pre-trained semantic consistency recognition model to obtain a consistency recognition result; sentiment analysis is performed on the preprocessed user tweet text based on a preset sentiment dictionary to calculate a sentiment tendency score; weighted fusion is performed on the semantic consistency score and the sentiment score to obtain a comprehensive stance tendency score; and the user's stance is obtained according to the comprehensive stance tendency score and the semantic stance classification result.

[0064] The present application first identifies the text pair by using the pre-trained semantic consistency recognition model to obtain the semantic consistency score and the semantic stance classification result, then introduces the sentiment tendency score on the basis of the consistency judgment, quantifies the emotional tendency expressed by the user, and performs weighted fusion on the sentiment tendency score and the consistency score, and then obtains the comprehensive stance tendency score and the semantic stance classification result according to the weighted fusion to obtain the user's stance, thereby realizing comprehensive judgment of the user's stance from the two dimensions of cognitive logic and emotional attitude, and improving the stability and reliability of the social text stance recognition in the scene with strong emotions and variable language styles.

[0065] The preprocessed user tweet text comprises user identity information and user tweet information. The user identity information comprises a username and a user ID. The user tweet information comprises a tweet ID, a posting time, a tweet content, a number of likes and a number of retweets of each preprocessed user tweet text.

[0066] In the present embodiment, the text pair is constructed according to the preprocessed user tweet text, specifically comprising:

[0067] When the number of preprocessed user tweet texts is 1, keyword extraction is performed on the preprocessed user tweet text to obtain M keywords corresponding to the preprocessed user tweet text;

[0068] An argument sentence is automatically constructed for the preprocessed user tweet text according to the keywords corresponding to the preprocessed user tweet text by using a pre-trained generative language model.

[0069] When the number of preprocessed user tweet texts is multiple, unsupervised clustering is performed on the preprocessed user tweet texts, and the multiple preprocessed user tweet texts are divided into N classes according to the clustering result, and M keywords are extracted from the preprocessed user tweet texts in each class to represent the preprocessed user tweet texts in the class.

[0070] An argument sentence is automatically constructed for each preprocessed user tweet text in each class according to the keywords of the preprocessed user tweet texts in the class by using a pre-trained generative language model.

[0071] Each preprocessed user tweet text and the corresponding argument sentence form a text pair.

[0072] When the number of preprocessed user tweet texts is 1, keyword extraction is performed on the preprocessed user tweet text to obtain M keywords corresponding to the preprocessed user tweet text; and when the number of preprocessed user tweet texts is multiple, unsupervised clustering is performed on the preprocessed user tweet texts, and the multiple preprocessed user tweet texts are divided into N classes according to the clustering result, and M keywords are extracted from the preprocessed user tweet texts in each class to represent the preprocessed user tweet texts in the class, to support fine-grained stance recognition in a multi-topic scenario, significantly improving the accuracy and interpretability of stance recognition; and an argument sentence is automatically constructed for each preprocessed user tweet text in each class according to the keywords of the preprocessed user tweet texts in the class by using a pre-trained generative language model, which can flexibly adapt to various topic contents and realize argument construction for any theme, greatly improving the universality and automation of the method.

[0073] Too many keywords can disturb the output of the large model, leading to homogenization of different categories of topics; too few keywords can make the output of the large model too general and unable to accurately grasp the details of the discussion topic. In order to effectively generate high-quality argument sentences according to M keywords, M is 3 in this embodiment.

[0074] The content of the user tweet information is a core attribute. For the task of identifying the social stance of a user, the original user tweet text is an important basis for judging the user's stance. Since the original user tweet text has complex raw data, it is necessary to filter out tweets directly related to the theme or task to ensure that the final data set can effectively reflect the key opinions and stance of the user. Therefore, in a further embodiment, the original user tweet text is preprocessed to obtain preprocessed user tweet text, specifically including:

[0075] Defining a keyword dictionary containing target topic keywords;

[0076] Matching the original user tweet text with the target topic keywords in the keyword dictionary, and using the target topic keywords that match successfully as the preprocessed user tweet text.

[0077] In a further embodiment, M keywords are extracted from each category of preprocessed user tweet text to represent the preprocessed user tweet text of that category, specifically including:

[0078] Extracting keywords from each category of preprocessed user tweet text to obtain initial keywords;

[0079] Using a pre-trained part-of-speech tagging model to filter the initial keywords to obtain noun keywords;

[0080] Counting the noun keywords to obtain a noun keyword frequency list;

[0081] Selecting the top M noun keywords in the noun keyword frequency list as the keywords for each category of preprocessed user tweet text.

[0082] In a specific embodiment, in the keyword extraction stage, the TextRank text summarization algorithm is first used to extract keywords from all filtered tweets to mine core concepts and topic elements that users are concerned about. In order to improve the theme representativeness and entity of the keywords, this embodiment further introduces a part-of-speech tagging model to filter the initially extracted keywords, retaining only those with noun parts of speech, thereby ensuring that the keywords have clear semantic direction and can accurately reflect the theme or entity discussed by the user. After completing keyword extraction, this embodiment counts the keywords and selects the group with the highest frequency as the keywords for each category of preprocessed user tweet text. The M keywords in each group represent an independent topic.

[0083] In a further embodiment, a pre-trained generative language model is used to automatically construct a claim sentence for each preprocessed user tweet text in each category based on the keywords of the preprocessed user tweet text in each category, specifically including:

[0084] mapping relationship between the keywords of the preprocessed user tweet texts of each category and each preprocessed user tweet text in each category is constructed;

[0085] An argument sentence is automatically constructed according to the keywords of the preprocessed user tweet texts of each category by using a pre-trained generative language model;

[0086] According to the mapping relationship between the keywords of the preprocessed user tweet texts of each category and each preprocessed user tweet text in each category and the argument sentence corresponding to the keywords of the preprocessed user tweet texts of each category, an argument sentence corresponding to each preprocessed user tweet text of each category is obtained.

[0087] According to the argument sentence corresponding to the preprocessed user tweet texts of each category, an argument sentence corresponding to each preprocessed user tweet text of each category is obtained.

[0088] After obtaining the topic keyword set, the embodiment further introduces a generative language model to automatically construct an argument sentence. Since the user's position on a certain subject often varies with different topics, an argument sentence with clear position orientation and related to the target subject needs to be generated for each topic.

[0089] In this embodiment, a generative language model with large-scale corpus pre-training capability, such as Deepseek, is used to guide the generative language model to generate an argument sentence with position bias according to the keywords and the pre-set position bias input by the user, as the analysis target under this topic. The argument sentence positively represents the target subject in semantics, thereby formulating the position recognition problem as "judging whether the user supports the argument" and facilitating model modeling and unified classification.

[0090] After keyword extraction and argument sentence generation, to determine whether the user supports the argument, the embodiment regards the user tweet as the user's view expression, combines the generated argument sentence, and constitutes a set of "argument sentence and preprocessed user tweet text" text pairs to input a pre-trained semantic consistency recognition model to obtain a consistency recognition result; wherein the consistency recognition result includes a semantic consistency score and a semantic position classification result.

[0091] To realize position classification, as shown in Figure 2 In one specific embodiment, the semantic consistency recognition model includes an input layer, a fusion layer, an encoding layer, a processing layer, a cosine similarity calculation layer, a full connection layer, and an output layer.

[0092] The input layer is connected with the input end of the fusion layer and the input end of the encoding layer respectively, the output end of the fusion layer and the output end of the encoding layer are connected with the input end of the processing layer respectively, the output end of the processing layer is connected with the input end of the cosine similarity calculation layer and the input end of the full connection layer respectively, the output end of the cosine similarity calculation layer is connected with the input end of the output layer and the input end of the full connection layer respectively, and the output end of the full connection layer is connected with the output layer.

[0093] In specific implementation, the input layer is configured to input the text pair into the fusion layer and the encoding layer respectively; the fusion layer is configured to splice and encode the claim sentence in the text pair and the preprocessed user tweet text to obtain a fusion sequence; the encoding layer is configured to encode the claim sentence in the text pair to obtain a claim sentence encoding sequence; the processing layer is configured to generate a viewpoint representation according to the fusion sequence and generate a claim representation according to the claim sentence encoding sequence; the cosine similarity calculation layer is configured to calculate the cosine similarity between the claim representation and the viewpoint representation; the full connection layer is configured to generate a semantic stance classification result according to the value of the cosine similarity and the viewpoint representation; and the output layer is configured to output the value of the cosine similarity as a semantic consistency score and combine the semantic consistency score and the semantic stance classification result as a consistency recognition result.

[0094] The semantic consistency recognition model in the embodiment jointly models the claim and the viewpoint, uses consistency constraints to capture the consistency between the claim and the viewpoint, and predicts whether the user supports the claim according to the input claim and the user's viewpoint, so as to quickly and accurately realize stance recognition.

[0095] The processing layer is a large language model BERT based on a Transformer architecture. The large language model BERT based on the Transformer architecture can accurately understand the context of the text by using the bidirectional context modeling capability, and is suitable for the recognition of the semantic relationship in the embodiment.

[0096] In specific implementation, the input of the large language model BERT includes two sequences: one is the fusion sequence obtained by splicing the claim sentence and the user tweet, in the format of [CLS] claim sentence [SEP] tweet [SEP]; and the other is the claim sentence encoding sequence obtained by encoding the claim sentence. The two sequences of the fusion sequence and the claim sentence encoding sequence are encoded by the large language model BERT with shared weights to obtain two sets of semantic vector representations of the viewpoint representation and the claim representation; then, the large language model BERT further calculates the cosine similarity between the two sets of semantic vector representations as a semantic consistency score, which is used to measure the consistency degree between the claim and the viewpoint.

[0097] The reason for calculating the cosine similarity between the opinion representation obtained according to the fusion sequence and the claim representation is that the stance classification task is not only to judge whether the semantics of two sentences are consistent, but also to capture more fine-grained context association and opposite relationship. If the claim sentence and the opinion sentence are independently encoded (i.e., the user tweet text is preprocessed), only the overall semantic representation of the two sentences is obtained, and the model cannot explicitly learn the corresponding relationship and logical conflict between specific words, which is not enough for stance judgment. The fusion sequence obtained by splicing and encoding the claim sentence and the preprocessed user tweet text in the text pair and inputting it into BERT to generate a fusion representation can make each word in the opinion sentence directly "focus" on the related word in the claim sentence, so that the semantic clues of the opposite sentence are integrated during encoding, and a more targeted opinion representation is formed. Such a fusion sequence provides rich interactive features for subsequent classification, which can more accurately identify subtle stance differences, and combines the independent encoding of the claim representation and the consistency constraint, which is equivalent to optimizing from the perspectives of "interactive features" and "semantic alignment", so that the model has stronger performance in the stance recognition task.

[0098] Finally, the semantic consistency recognition model judges the stance tendency through a fully connected layer according to the semantic consistency score and the opinion representation: if the semantic consistency score is higher than a first preset threshold, it means that the opinion representation is highly consistent with the stance classification in the claim representation, and it is considered that the user supports the stance classification of the claim representation; if the semantic consistency score is lower than a second preset threshold, the second preset threshold is lower than the first preset threshold, it means that there is a semantic conflict or a negation relationship between the opinion representation and the claim representation, and it is judged that the user opposes the stance classification of the claim representation; if the semantic consistency score is lower than or equal to the first preset threshold and higher than or equal to the second preset threshold, it means that the user has no obvious attitude, and it is classified as neutral. The semantic consistency recognition model supports outputting classification labels and continuous stance scores, and can realize the stance judgment of a single tweet under a specified topic.

[0099] Moreover, for the stance expressed by the same user in multiple posts, the overall stance judgment result of the user level is outputted by statistical analysis and hierarchical integration of the stance results of each tweet. The embodiment also supports the unified expression of the stance of a single user under multiple topics or multiple time periods, enhancing the completeness and coherence of the stance recognition at the user behavior level.

[0100] In the unified expression, if the same user has a stance on multiple topics, the stance scores of the user for each topic are outputted in the json format;

[0101] If the user has a stance on the same topic in multiple time periods, the stance scores are aggregated and calculated according to the time periods, and the stance score changes at different times are outputted in the json format according to the time development order.

[0102] Of course, before the text pair is input into the pre-trained semantic consistency recognition model to obtain a consistency recognition result, the embodiment further includes: constructing a semantic consistency recognition model; and training the semantic consistency recognition model.

[0103] In the training process of the semantic consistency recognition model, the semantic consistency recognition model is optimized and trained using a total loss function. The total loss function is: ; in the formula, represents the total loss function, and is used to represent the potential consistency between the viewpoint and the proposition; represents a semantic stance classification loss function, represents a semantic consistency score loss function.

[0104] In the formula, ;

[0105] In the formula, represents a proposition representation, represents a viewpoint representation, represents a cosine similarity, represents taking a maximum value.

[0106] In the embodiment, the preprocessed user tweet text is subjected to sentiment analysis based on a pre-set sentiment dictionary, and a sentiment tendency score is calculated. Specifically, the sentiment analysis includes:

[0107] The content of the preprocessed user tweet text is subjected to a word segmentation operation to obtain one or more words;

[0108] The one or more words are matched with positive words and negative words in the pre-set sentiment dictionary, and a polarity label of a successfully matched word in the sentiment dictionary is obtained;

[0109] According to the polarity label of the successfully matched word in the sentiment dictionary and the word frequency in the tweet content in the preprocessed user tweet text, a sentiment tendency score is calculated.

[0110] In the formula, the polarity label includes positive, negative, or neutral.

[0111] In the formula, the sentiment tendency score is a continuous value, and the range is usually set to -1 to +1, indicating an emotional tendency from strong opposition to strong support.

[0112] In the formula, the sentiment dictionary is a Chinese sentiment dictionary, an English sentiment dictionary, or a Chinese-English sentiment dictionary.

[0113] Of course, the sentiment dictionary can also be a sentiment dictionary of various languages.

[0114] In the embodiment, the calculation formula of the comprehensive stance tendency score is

[0115] semantic consistency score sentiment tendency score; wherein, is a weight parameter, is a comprehensive stance tendency score.

[0116] In order to facilitate the final stance classification judgment, in the embodiment, according to the comprehensive stance tendency score and the semantic stance classification result, the stance of the user is obtained, specifically including:

[0117] When the comprehensive stance tendency score is greater than a set positive threshold value, the user is determined to be a support party of the semantic stance classification result;

[0118] When the comprehensive stance tendency score is less than a set negative threshold value, the user is determined to be an opposite party of the semantic stance classification result;

[0119] When the comprehensive stance tendency score is less than or equal to the set positive threshold value and greater than or equal to the set negative threshold value, the user is determined to be a neutral party of the semantic stance classification result.

[0120] In one specific embodiment,

[0121] When S > 0.5, the user is determined to be a support party of the semantic stance classification result;

[0122] When S < -0.5, the user is determined to be an opposite party of the semantic stance classification result;

[0123] When -0.5 ≤ S ≤ 0.5, the user is determined to be a neutral party of the semantic stance classification result.

[0124] In the embodiment, the sentiment tendency score of the post and the consistency score between the post and the claim sentence are calculated respectively, and through setting a reasonable double threshold strategy, the two types of score information are fused to realize the final stance classification judgment. The method fully utilizes the sentiment information and the semantic consistency information, and improves the robustness and interpretability of the stance recognition.

[0125] In a second aspect, the application further provides a social text stance recognition system based on claim generation and consistency analysis, comprising:

[0126] An acquisition module is configured to acquire an original user tweet text of a user;

[0127] A preprocessing module is configured to preprocess the original user tweet text to obtain a preprocessed user tweet text;

[0128] A text pair construction module is configured to construct a text pair according to the preprocessed user tweet text; wherein the text pair comprises a claim sentence and the preprocessed user tweet text;

[0129] The consistency recognition module is configured to input the text pair into a pre-trained semantic consistency recognition model to obtain a consistency recognition result; the consistency recognition result includes a semantic consistency score and a semantic stance classification result;

[0130] The sentiment analysis module is configured to perform sentiment analysis on the preprocessed user tweet text based on a preset sentiment dictionary to calculate a sentiment tendency score.

[0131] The stance analysis module is configured to perform weighted fusion of the semantic consistency score and the sentiment score to obtain a comprehensive stance tendency score, and obtain the user's stance according to the comprehensive stance tendency score and the semantic stance classification result.

[0132] The construction process of the text pair includes:

[0133] When the number of preprocessed user tweet texts is 1, keyword extraction is performed on the preprocessed user tweet text to obtain M keywords corresponding to the preprocessed user tweet text; a pre-trained generative language model is used to automatically construct a claim sentence for the preprocessed user tweet text according to the keywords corresponding to the preprocessed user tweet text.

[0134] When the number of preprocessed user tweet texts is multiple, unsupervised clustering is performed on the preprocessed user tweet texts, and the preprocessed user tweet texts are divided into N classes according to the clustering result; M keywords are extracted from the preprocessed user tweet texts in each class to represent the preprocessed user tweet texts in the class; a pre-trained generative language model is used to automatically construct a claim sentence for each preprocessed user tweet text in each class according to the keywords of the preprocessed user tweet texts in the class.

[0135] Each preprocessed user tweet text and the corresponding claim sentence form a text pair.

[0136] The preprocessed user tweet text is obtained by preprocessing the original user tweet text, and specifically includes:

[0137] A keyword dictionary containing target topic keywords is defined;

[0138] The target topic keywords in the keyword dictionary are used to match the original user tweet text, and the successfully matched target topic keywords are used as the preprocessed user tweet text.

[0139] The M keywords used to represent the preprocessed user tweet texts in each class are extracted from the preprocessed user tweet texts in each class, and specifically include:

[0140] Keyword extraction is performed on the preprocessed user tweet texts in each class to obtain initial keywords;

[0141] The pre-trained part-of-speech tagging model is used to screen the initial keywords to obtain the noun keywords;

[0142] The noun keywords are counted to obtain a noun keyword frequency list;

[0143] The noun keywords with the top M frequencies in the noun keyword frequency list are selected as the keywords of the preprocessed user tweet text of each category.

[0144] The pre-trained generative language model is used to automatically construct a claim sentence for each preprocessed user tweet text in each category according to the keywords of the preprocessed user tweet text of each category, and the process specifically includes:

[0145] The mapping relationship between the keywords of the preprocessed user tweet text of each category and the preprocessed user tweet text in each category is constructed;

[0146] The pre-trained generative language model is used to automatically construct a claim sentence according to the keywords of the preprocessed user tweet text of each category;

[0147] According to the mapping relationship between the keywords of the preprocessed user tweet text of each category and the preprocessed user tweet text in each category and the claim sentence corresponding to the keywords of the preprocessed user tweet text of each category, the claim sentence corresponding to each preprocessed user tweet text of each category is obtained.

[0148] The semantic consistency recognition model in the embodiment includes an input layer, a fusion layer, an encoding layer, a processing layer, a cosine similarity calculation layer, a full connection layer, and an output layer;

[0149] The input layer is used to input the text pair into the fusion layer and the encoding layer; the fusion layer is used to splice and encode the claim sentence and the preprocessed user tweet text in the text pair to obtain a fusion sequence; the encoding layer is used to encode the claim sentence in the text pair to obtain a claim sentence encoding sequence; the processing layer is used to generate a viewpoint representation according to the fusion sequence and generate a claim representation according to the claim sentence encoding sequence; the cosine similarity calculation layer is used to calculate the cosine similarity between the claim representation and the viewpoint representation; the full connection layer is used to generate a semantic stance classification result according to the value of the cosine similarity and the viewpoint representation; and the output layer is used to take the value of the cosine similarity as a semantic consistency score and combine the semantic consistency score and the semantic stance classification result as a consistency recognition result.

[0150] The processing layer is a large language model BERT based on a Transformer architecture.

[0151] The process of performing sentiment analysis on the preprocessed user tweet text based on the pre-set sentiment dictionary includes:

[0152] Segmenting the content of the preprocessed user tweet text to obtain one or more words;

[0153] Matching the one or more words with positive words and negative words in a preset sentiment dictionary, and obtaining a polarity label of the matched word in the sentiment dictionary; wherein the polarity label includes positive and negative;

[0154] According to the polarity label of the matched word in the sentiment dictionary and the word frequency in the tweet content in the preprocessed user tweet text, a sentiment tendency score is calculated.

[0155] Wherein, the calculation formula of the comprehensive stance tendency score is S = α × semantic consistency score + (1-α) × sentiment tendency score; in the formula, α is a weight parameter, and S is the comprehensive stance tendency score.

[0156] Wherein, according to the comprehensive stance tendency score and the semantic stance classification result, the stance of the user is obtained, specifically including:

[0157] When the comprehensive stance tendency score is greater than a set positive threshold, the user is determined to be a support party of the semantic stance classification result;

[0158] When the comprehensive stance tendency score is less than a set negative threshold, the user is determined to be an opposite party of the semantic stance classification result; wherein the negative threshold is less than the positive threshold;

[0159] When the comprehensive stance tendency score is less than or equal to the set positive threshold and greater than or equal to the set negative threshold, the user is determined to be a neutral party of the semantic stance classification result.

[0160] The above is only the preferred specific embodiment of the present application, but the protection scope of the present application is not limited to this, any person skilled in the art in the technical range disclosed by the present application, according to the technical scheme and the inventive concept of the present application, equivalent replacement or change, should be covered in the protection scope of the present application.

Claims

1. A method for stance identification of social text based on claim generation and consistency analysis, characterized in that, The method comprises the following steps: obtaining original user tweet text of a user; preprocessing the original user tweet text to obtain preprocessed user tweet text; constructing a text pair according to the preprocessed user tweet text; wherein the text pair comprises a claim sentence and the preprocessed user tweet text; inputting the text pair into a pre-trained semantic consistency recognition model to obtain a consistency recognition result; wherein the consistency recognition result comprises a semantic consistency score and a semantic stance classification result; performing sentiment analysis on the preprocessed user tweet text based on a pre-set sentiment dictionary to calculate a sentiment tendency score; and weighting and fusing the semantic consistency score and the sentiment score to obtain a comprehensive stance tendency score; when the comprehensive stance tendency score is greater than a set positive threshold, determining that the user is a supporter of the semantic stance classification result; when the comprehensive stance tendency score is less than a set negative threshold, determining that the user is an opponent of the semantic stance classification result; wherein the negative threshold is less than the positive threshold; and when the comprehensive stance tendency score is less than or equal to the set positive threshold and greater than or equal to the set negative threshold, determining that the user is a neutral party of the semantic stance classification result. The semantic consistency recognition model comprises an input layer, a fusion layer, an encoding layer, a processing layer, a cosine similarity calculation layer, a full connection layer and an output layer; the input layer is used for inputting the text pair into the fusion layer and the encoding layer respectively; the fusion layer is used for splicing and encoding the claim sentence and the preprocessed user tweet text in the text pair to obtain a fusion sequence; the encoding layer is used for encoding the claim sentence in the text pair to obtain a claim sentence encoding sequence; the processing layer is used for generating a viewpoint representation according to the fusion sequence and generating a claim representation according to the claim sentence encoding sequence; the cosine similarity calculation layer is used for calculating the cosine similarity between the claim representation and the viewpoint representation; the full connection layer is used for generating the semantic stance classification result according to the value of the cosine similarity and the viewpoint representation; and the output layer is used for outputting the value of the cosine similarity as the semantic consistency score and combining the semantic consistency score and the semantic stance classification result as the consistency recognition result; wherein the processing layer is a large language model BERT based on a Transformer architecture. 2.The social text stance identification method based on claim generation and consistency analysis of claim 1, wherein, The preprocessing of the original user tweet text to obtain the preprocessed user tweet text specifically comprises: defining a keyword dictionary containing target topic keywords; matching the original user tweet text with the target topic keywords in the keyword dictionary, and taking the successfully matched target topic keywords as the preprocessed user tweet text. 3.The social text stance identification method based on claim generation and consistency analysis of claim 1, wherein, The construction of the text pair according to the preprocessed user tweet text specifically comprises: when the number of the preprocessed user tweet text is 1, extracting keywords from the preprocessed user tweet text to obtain M keywords corresponding to the preprocessed user tweet text; using a pre-trained generative language model to automatically construct a claim sentence for the preprocessed user tweet text according to the keywords corresponding to the preprocessed user tweet text; When the number of preprocessed user tweet texts is multiple, the preprocessed user tweet texts are analyzed by using an unsupervised clustering method, and the multiple preprocessed user tweet texts are divided into N classes according to the analysis result, and M keywords representing the preprocessed user tweet texts in each class are extracted from the preprocessed user tweet texts in each class; An opinion sentence is automatically constructed for each preprocessed user tweet text in each class by using a pre-trained generative language model according to the keywords of the preprocessed user tweet texts in each class; Each preprocessed user tweet text and the corresponding opinion sentence form a text pair.

4. The stance identification method of claim 3, wherein, The M keywords representing the preprocessed user tweet texts in each class are extracted from the preprocessed user tweet texts in each class, and specifically include: Keywords are extracted from the preprocessed user tweet texts in each class to obtain initial keywords; The initial keywords are filtered by using a pre-trained part-of-speech tagging model to obtain noun keywords; The noun keywords are counted to obtain a noun keyword frequency list; The top M noun keywords in the noun keyword frequency list are selected as the keywords of the preprocessed user tweet texts in each class.

5. The stance recognition method based on opinion generation and consistency analysis according to claim 3, wherein an opinion sentence is automatically constructed for each preprocessed user tweet text in each class by using a pre-trained generative language model according to the keywords of the preprocessed user tweet texts in each class, and specifically includes: A mapping relationship between the keywords of the preprocessed user tweet texts in each class and the preprocessed user tweet texts in each class is constructed; An opinion sentence is automatically constructed by using a pre-trained generative language model according to the keywords of the preprocessed user tweet texts in each class; According to the mapping relationship between the keywords of the preprocessed user tweet texts in each class and the preprocessed user tweet texts in each class and the opinion sentence corresponding to the keywords of the preprocessed user tweet texts in each class, the opinion sentence corresponding to each preprocessed user tweet text in each class is obtained.

6. The stance identification method of claim 1, wherein, The preprocessed user tweet texts are analyzed based on a pre-set sentiment dictionary, and a sentiment tendency score is calculated, specifically including: The content of the preprocessed user tweet texts is segmented into one or more words; The one or more words are matched with positive words and negative words in the pre-set sentiment dictionary, and the polarity labels of the matched words in the sentiment dictionary are obtained; wherein the polarity labels include positive, negative or neutral; According to the polarity labels of the matched words in the sentiment dictionary and the word frequency in the tweet content in the preprocessed user tweet texts, a sentiment tendency score is calculated.

7. The stance identification method of claim 1, wherein, The calculation formula of the comprehensive stance tendency score is S = α × semantic consistency score + (1-α) × sentiment tendency score; In the formula, α is a weight parameter, and S is the comprehensive stance tendency score.

8. A social text stance recognition system based on assertion generation and consistency analysis, characterized in that, The method comprises: An acquisition module is configured to acquire original user tweet texts of a user; A preprocessing module is configured to preprocess the original user tweet texts to obtain preprocessed user tweet texts. The text pair construction module is configured to construct a text pair according to the preprocessed user tweet text, wherein the text pair comprises an argument sentence and the preprocessed user tweet text; The consistency identification module is configured to input the text pair into a pre-trained semantic consistency identification model to obtain a consistency identification result, wherein the consistency identification result comprises a semantic consistency score and a semantic stance classification result; The sentiment analysis module is configured to perform sentiment analysis on the preprocessed user tweet text based on a preset sentiment dictionary to calculate a sentiment tendency score; The stance analysis module is configured to weight and fuse the semantic consistency score and the sentiment score to obtain a comprehensive stance tendency score; when the comprehensive stance tendency score is greater than a set positive threshold, the user is determined to be a support of the semantic stance classification result; when the comprehensive stance tendency score is less than a set negative threshold, the user is determined to be an opponent of the semantic stance classification result; wherein the negative threshold is less than the positive threshold; when the comprehensive stance tendency score is less than or equal to the set positive threshold and greater than or equal to the set negative threshold, the user is determined to be a neutral party of the semantic stance classification result; The semantic consistency identification model comprises an input layer, a fusion layer, an encoding layer, a processing layer, a cosine similarity calculation layer, a full connection layer and an output layer; the input layer is configured to input the text pair into the fusion layer and the encoding layer respectively; the fusion layer is configured to splice and encode the argument sentence and the preprocessed user tweet text in the text pair to obtain a fusion sequence; the encoding layer is configured to encode the argument sentence in the text pair to obtain an argument sentence encoding sequence; the processing layer is configured to generate a viewpoint representation according to the fusion sequence and an argument representation according to the argument sentence encoding sequence; the cosine similarity calculation layer is configured to calculate the cosine similarity between the argument representation and the viewpoint representation; the full connection layer is configured to generate a semantic stance classification result according to the value of the cosine similarity and the viewpoint representation; the output layer is configured to output the value of the cosine similarity as the semantic consistency score, and combine the semantic consistency score and the semantic stance classification result as the consistency identification result; wherein the processing layer is a large language model BERT based on a Transformer architecture.

Citation Information

Patent Citations

  • Zero sample interpretability field detection method and device based on prompt learning

    CN117764077A

  • Controllable text generation method, device and equipment

    CN120163134A