News article stand detection and rewriting evaluation method

By constructing a political text dataset and using a pre-trained language model for text representation and discourse structure analysis, the classifier is trained to detect news article stances, and rewritten the stance through the BERT model, the efficiency and accuracy of news article stance detection and rewriting are solved, and efficient depolarized news content processing is achieved.

CN119557450APending Publication Date: 2025-03-04HUNAN NORMAL UNIVERSITY

Patent Information

Application Number
CN202411802710.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The existing technology is difficult to efficiently detect and rewrite the position problem in news articles, especially when there is a lot of article content, manual detection is inefficient and inconvenient to rewrite.

Method used

By constructing a dataset containing political text and corresponding position labels, text representation and discourse structure analysis were performed using a pre-trained language model, classifiers were trained to detect the political stance of news articles, and position rewriting evaluation was performed by fine-tuning the BERT model.

Benefits of technology

A high-accuracy news text position detection has been achieved, and the news text with the left-to-right position is rewritten into neutral text, supporting the public to accept depolarized news and optimize international communication strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SMS_11
    Figure SMS_11
  • Figure SMS_24
    Figure SMS_24
  • Figure SMS_40
    Figure SMS_40
Patent Text Reader

Abstract

The invention discloses a news article site detection and rewriting evaluation method, and relates to the field of news detection and evaluation, and the method comprises the following steps: S1, data set construction: firstly, constructing a data set containing political texts and corresponding site tags for training and testing a model; s2, utterance structure analysis: decomposing the text into smaller units, and analyzing the relationship and structure among the units; s3, text representation: a pre-trained language model is used for obtaining embedded representation of the text, and the model is used for capturing semantic information and context relationships in the text; and S4, model training. According to the news article standing detection and rewriting evaluation method, the standing detection of the news text is realized in a high-accuracy manner, and the news text with the standing left and the standing right is rewritten into the neutral text, so that the news article standing detection and rewriting evaluation method is of great significance for people to accept depolarized news and optimize international propagation strategies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of news detection and evaluation, and in particular to a news article stance detection and rewriting evaluation method. Background Art

[0002] : News, also known as information, is a name for information disseminated through newspapers, radio stations, broadcasting, television stations and other media channels. It is a genre that records society, disseminates information and reflects the times. The concept of news can be divided into broad and narrow senses. In a broad sense, all common texts except comments and special articles published in newspapers, broadcasting, the Internet and television belong to the category of news, including news, correspondence, features, sketches, etc.; news in a narrow sense refers specifically to news. News uses a general narrative method and relatively concise and concise text to quickly and timely report recent and valuable facts at home and abroad so that others can understand. Each news generally includes six parts: title, head, lead, main body, background and conclusion. The first four are the main parts, and the last two are auxiliary parts. Title, lead and main body are indispensable. The writing style is mainly narrative, sometimes with discussion, description, comment, etc. News is a news service platform that contains massive information, which truly reflects important events at every moment. You can quickly understand their latest developments by checking news events, hot topics, character dynamics, product information, etc.

[0003] When writing news, people usually write their subjective emotions into news articles. When there are implicit stance issues, once published, they will spread bad information to the public. Therefore, news articles need to be checked. However, when the content of the article is large, manual detection is inefficient, omissions may occur, and subsequent rewriting is also inconvenient. Summary of the invention

[0004] The main purpose of the present invention is to provide a news article stance detection and rewriting evaluation method, which can effectively solve the problems in the background technology.

[0005] To achieve the above object, the technical solution adopted by the present invention is: A news article stance detection method includes the following steps: S1: Dataset construction. First, we build a dataset containing political texts and corresponding position labels for training and testing models. The dataset contains texts of different political positions, such as left-leaning, neutral, and right-leaning. S2: Discourse structure analysis, which breaks down the text into smaller units, preferably discourse units, and analyzes the relationship and structure between these units, including the organization of the article, the development of the argument and the use of evidence, to identify language features that may be related to political positions and to capture the argument structure and rhetorical devices of the text; S3: Text representation, using a pre-trained language model to obtain the embedded representation of the text. The model is used to capture the semantic information and contextual relationships in the text; S4: Model training, use the above text representation and discourse structure information to train a classifier to predict the political stance category of the text. The classifier contains multiple levels to process information of different granularities to achieve the effect of detecting news stance.

[0006] Preferably, the S1 specifically includes the following steps: S101: Selection of text and labels. Obtain text data with clear political stances from different political news sources and public news datasets, including but not limited to obtaining articles from left-leaning, right-leaning, and neutral news websites; write crawler code to set crawling rules, including but not limited to obtaining data by date range, keyword filtering, and news topic; assign a stance label yi to each text Ti based on the known tendency of the source and the content of the article, and divide it into left-leaning (L), neutral (N), and right-leaning (R) according to the political stance. The form of the dataset D is as shown in Formula 1: ; S102: Text filtering and cleaning. Before formal processing, clean each text Ti to remove noise characters, HTML tags, extra spaces, and URLs. At the same time, check the overall situation of the text data, including but not limited to the data volume, text length distribution, language type, and character encoding. Determine the main problems in the text, including but not limited to repeated content, incorrect spellings, and formats that do not meet the requirements. Based on Python, store the text data in a collection to automatically remove repeated content. Unify the format of text content, convert all text to uppercase or lowercase as needed, and perform specific uppercase and lowercase conversion on parts such as titles; Filter and clean the processed text content to verify whether the data meets the expected quality standards. Extract some samples for manual inspection and automated test cases to verify the accuracy, completeness and consistency of the data. Adjust and optimize the filtering and cleaning steps based on the verification results. After the above processing, the text is used for subsequent processing, and the cleaned text is denoted as Ti′; S103: Label encoding, converting the category label yi into a numerical code for model training. The following is formula 2: .

[0007] Preferably, the S2 specifically includes the following steps: S201: Discourse unit segmentation: divide each cleaned text Ti′ into basic discourse units (EDUs). These units are the smallest complete expression units. Each text is used to represent a set of EDUs {ei1, ei2, …, ein}, where n represents the number of EDUs. The following is formula 3: ; At the same time, too short units are merged. The too short speech units that appear after segmentation, including but not limited to single words and very short phrases, when they do not meet the requirements of the application scenario, are merged with adjacent units based on the context and semantics; Check the coherence and logic. Check whether the segmented discourse units are semantically and logically coherent through manual inspection and automatic semantic coherence assessment tools. If the segmentation is found to be unreasonable, adjust the segmentation method; S202: discourse relationship construction, analyzing the relationship between each EDU and establishing the discourse structure. Preferably, this is achieved by using a method based on discourse structure theory, organizing EDUs into a tree structure according to their semantic relationships. The relationship structure between EDUs is represented as a tree, where the root node represents the main argument and the leaf nodes represent supporting arguments. Specifically, the sentence segmentation tool is used to divide the text into multiple sentences according to the rhetorical structure theory, and the core and satellite are marked. The core represents the unit of central information and has relatively complete semantics. The satellite is other units that convey supporting information and are used to supplement the core part. A coherent chapter is composed of rhetorical relationships at different levels, which are represented as a tree structure. Starting from the chapter unit, the rhetorical structure tree gradually covers the entire chapter, forming a hierarchical chapter structure tree. The complexity of the levels is related to the complexity of the chapter semantics. The more complex the semantics, the more levels there are. S203: Relationship annotation, by annotating different semantic relationships, including but not limited to "contrast", "support", and "causality", to further enrich the discourse structure and make full use of this information in model training. Annotation is used to identify the role of each EDU in the overall text structure; The annotation process is based on manual and automatic annotation. For manual annotation, a complete relationship annotation system is first determined, including relationship types and annotation rules. The annotators annotate the relationships between discourse units in the text according to the annotation system. The annotators analyze how the sentences are organized, including sequential and contrastive relationships. Automatic annotation: Extract various features of discourse structure, including but not limited to lexical features, syntactic features, and semantic features, and use the annotated corpus to train the machine learning model. The model learns the relationship patterns in the annotated corpus and then annotates the new text.

[0008] Preferably, S3 specifically includes the following steps: S301: Generate word embeddings. Use pre-trained language models, including but not limited to RoBERTa and Longformer, to generate word embedding representations for each EDU. The following is formula 4: ; Where eij represents the jth EDU of the i-th text, which contains the word vector xijk. The formula is used to calculate the average word embedding of the EDU and generate the embedding representation veij of the EDU, where m represents the number of words in the EDU, and xijk represents the embedding representation of the kth word in the EDU; S302: Context processing of EDUs, inputting the embedding representation veij of each EDU into a context model such as LSTM or Transformer to obtain a richer context representation and capture the dependencies between EDUs; S303: Document embedding generation: The representations of all EDUs are combined into the overall embedding representation vTi of the document. The embedding vectors of all EDUs can be weighted averaged, as shown in Formula 5: ; Where n is the number of EDUs in the text, wj is the weight of the jth EDU, which is determined by the attention mechanism to emphasize important EDUs; S304: Feature concatenation, concatenating other features on the document embedding vTi, including but not limited to sentiment scores and TF-IDF values, to form the final document representation v'Ti, as shown in Formula 6: .

[0009] Preferably, in step S4, a classifier model is trained on a text implication recognition task, that is, determining whether there is an implication relationship, a contradictory relationship, or a neutral relationship between the premise sentence and the hypothesis sentence. S4 specifically includes the following operation steps: S401: Model structure, build classifier, input is document embedding v'Ti, output is predicted label , select a model with a multi-layer structure to capture multi-granularity information, and use the cross entropy loss function to optimize the model parameters so that the predicted label The difference between the actual label yi is minimized, as shown in Formula 7: ; in is the model’s predicted probability for category c; S402: Training and validation, optimizing the model on the training set Dtrain, adjusting the hyperparameters on the validation set Dval, and evaluating the performance on the test set Dtest to calculate the accuracy, as shown in Formula 8: Where 1(.) is an indicator function, which takes the value of 1 when the prediction is correct.

[0010] A news article stance rewriting evaluation method, the method adopts the news article stance detection method according to any one of claims 1 to 5, and comprises the following steps: A: Separate the sentences with stances in the tested articles and pay attention to the sources of information cited in the articles. When the articles cite the opinions, research or speeches of one party and lack sufficient discussion of other opposing opinions, it is judged that there is a stance bias. Analyze the structure of the article. When the article clearly puts forward a point of view at the beginning and then elaborates and argues around the point of view, it can be judged that the position of the article is relatively clear; when the article adopts a balanced structure, presents and analyzes different points of view in a relatively balanced manner, and finally draws a conclusion, it can be judged that the article tends to be neutral. Argumentation logic and methods: Check whether the argumentation logic of the article is reasonable. If there are logical loopholes, one-sidedness, or selective use of evidence in the argumentation process of the article, it can be judged that the position of the article is not objective enough; Based on the above content, a set of stance sentences is formed. Three basic editing operations are used to mark the words in the sentences, where [INS] marks the words that need to be inserted in front, [SUB] marks the words that need to be replaced with new words, [DEL] marks the words that need to be deleted, and [KEEP] marks the words that do not need to be modified; B: Fine-tune the BERT model as a language model to perform substitution and insertion operations, introduce a mask-based training strategy, and use the marker [SUB] to replace the words marked as [SUB]. <mask>Replace it, and for the word marked as [INS], insert before it <mask>, the masked sentence is input into the language model, and the language model replaces the predicted word with the mask; C: During each iteration, multiple sentences are generated, called the state set St, where each subset in St represents an operation applied to the current sentence; D: Use a classifier to distinguish sentences with different stances, and use a language model to construct a conditional random field. The scores calculated by the classifier are used to represent the stance differences of the sentences, and the scores calculated by the language model are used to represent the fluency of the sentences. They are weighted and input into the softmax layer to represent the quality of the converted sentences. E: Each iteration calculates the transition probability between two states and finds the optimal path to convert the input sentence into a high-quality output sentence. This process continues until the output sentence achieves the desired result. F: Integrate the revised sentences into the entire article and compare them with the unrevised article. Calculate the content completeness and position similarity of the two articles to ensure that the content of the revised article is complete and the position meets our requirements, thereby achieving the evaluation and rewriting of the content of the news article.

[0011] Preferably, A is specifically: forming a stance sentence set from sentences with stances in the detected news articles, wherein the sentence set is represented as , and then use the tagger to tag the sentence, where [INS] marks the word that needs to be inserted in front, [SUB] marks the word that needs to be replaced with a new word, [DEL] marks the word that needs to be deleted, and [KEEP] marks the word that does not need to be modified. After tagging, the sentence set is represented as .

[0012] Preferably, the B specifically includes the following steps: B01: Fine-tune the BERT model, use the masked training strategy to train the language model, and mark the words marked as [SUB] in the sentence set with <mask>Replace it with the word marked as [INS] and insert it before it <mask>, forming the input vector of the language model; B02: After the vector is input into the language model, the language model replaces the predicted word with the mask to generate a state collection , where each subset si in each subset sti represents an operation on a sentence, and each state will produce 3n+1 sentences.

[0013] Preferably, the D specifically includes the following steps: D01: Use a trained classifier to detect whether the generated sentence is in the target stance, and use a language model to ensure that the generated sentence is fluent. The loss function is as follows: ; Where xj is the jth sample in the training set, yj is the stance label of xj, and for sentence SA, when it needs to be converted into the target stance sentence SB, the conversion path is , the sentence Si needs to go through state Sti to convert to Si+1. The classifier calculation score of this step is formula 10: ; This score represents the difference in stance between sentence Si+1 and sentence Si. The language model then calculates the fluency scores of sentences Si+1 and Si. The score function is Formula 11: ; The weighted sum of the classifier score and the sentence fluency score is used to obtain the feature function to construct the conditional random field. The following is formula 12: STotal(Sti,pi)=u1 +u2 ; Then input the total score into the softmax layer to calculate the standardized probability distribution, as shown in Formula 13: ; The probability indicates the quality of the converted sentence. The higher the probability, the more the generated sentence meets the requirements. Based on step D, continuous iteration, the specific steps of E are: find the optimal path for sentence conversion, for the path , which means that the input sentence SA is modified for i consecutive times to obtain sentence SB. The transition probability from SA to SB is the product of all probabilities in the path, as shown in Formula 14: If the stance classification and sentence quality of sentence SB meet the requirements, the conversion is stopped.

[0014] Preferably, the specific steps of F are: through step AE, the sentence set Convert to Finally, the converted sentence set is integrated into the original article newi to obtain the article newi' after the transformed stance. Then, the existing automatic text evaluation indicators (such as ROUGE, SBERT, CtxSimFit) are used to calculate the content similarity between the modified article and the original article to ensure that the content of the modified article is consistent with that of the original article. The following is formula 15: ; ; ; Where LCS(X, Y) is the length of the longest common subsequence of X and Y, m and n represent the number of words contained, Rlcs and Plcs represent the recall rate and precision rate, respectively, and Flcs is the content similarity index. When the index reaches above 0.9, the news position is rewritten and the content remains unchanged.

[0015] Compared with the prior art, the present invention has the following beneficial effects: In the present invention, the stance detection of news texts is achieved with high accuracy, and news texts with left or right stances are rewritten into neutral texts, which is of great significance for the public to accept depolarized news and optimize international communication strategies. DETAILED DESCRIPTION

[0016] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Specific embodiment one: A news article stance detection method includes the following steps: S1: Dataset construction. First, we build a dataset containing political texts and corresponding position labels for training and testing models. The dataset contains texts of different political positions, such as left-leaning, neutral, and right-leaning. S1 specifically includes the following steps: S101: Selection of text and labels. Obtain text data with clear political stances from different political news sources and public news datasets, including but not limited to obtaining articles from left-leaning, right-leaning, and neutral news websites; write crawler code to set crawling rules, including but not limited to obtaining data by date range, keyword filtering, and news topic; assign a stance label yi to each text Ti based on the known tendency of the source and the content of the article, and divide it into left-leaning (L), neutral (N), and right-leaning (R) according to the political stance. The form of the dataset D is as shown in Formula 1: ; S102: Text filtering and cleaning. Before formal processing, clean each text Ti to remove noise characters, HTML tags, extra spaces, and URLs. At the same time, check the overall situation of the text data, including but not limited to the data volume, text length distribution, language type, and character encoding. Determine the main problems in the text, including but not limited to repeated content, incorrect spellings, and formats that do not meet the requirements. Based on Python, store the text data in a collection to automatically remove repeated content. Unify the format of text content, convert all text to uppercase or lowercase as needed, and perform specific uppercase and lowercase conversion on parts such as titles; Filter and clean the processed text content to verify whether the data meets the expected quality standards. Extract some samples for manual inspection and automated test cases to verify the accuracy, completeness and consistency of the data. Adjust and optimize the filtering and cleaning steps based on the verification results. After the above processing, the text is used for subsequent processing, and the cleaned text is denoted as Ti′; S103: Label encoding, converting the category label yi into a numerical code for model training. The following is formula 2: .

[0018] S2: Discourse structure analysis, which breaks down the text into smaller units, preferably discourse units, and analyzes the relationship and structure between these units, including the organization of the article, the development of the argument and the use of evidence, to identify language features that may be related to political positions and to capture the argument structure and rhetorical devices of the text; S2 specifically includes the following steps: S201: Discourse unit segmentation: divide each cleaned text Ti′ into basic discourse units (EDUs). These units are the smallest complete expression units. Each text is used to represent a set of EDUs {ei1, ei2, …, ein}, where n represents the number of EDUs. The following is formula 3: ; At the same time, too short units are merged. The too short speech units that appear after segmentation, including but not limited to single words and very short phrases, when they do not meet the requirements of the application scenario, are merged with adjacent units based on the context and semantics; Check the coherence and logic. Check whether the segmented discourse units are semantically and logically coherent through manual inspection and automatic semantic coherence assessment tools. If the segmentation is found to be unreasonable, adjust the segmentation method; S202: discourse relationship construction, analyzing the relationship between each EDU and establishing the discourse structure. Preferably, this is achieved by using a method based on discourse structure theory, organizing EDUs into a tree structure according to their semantic relationships. The relationship structure between EDUs is represented as a tree, where the root node represents the main argument and the leaf nodes represent supporting arguments. Specifically, the sentence segmentation tool is used to divide the text into multiple sentences according to the rhetorical structure theory, and the core and satellite are marked. The core represents the unit of central information and has relatively complete semantics. The satellite is other units that convey supporting information and are used to supplement the core part. A coherent chapter is composed of rhetorical relationships at different levels, which are represented as a tree structure. Starting from the chapter unit, the rhetorical structure tree gradually covers the entire chapter, forming a hierarchical chapter structure tree. The complexity of the levels is related to the complexity of the chapter semantics. The more complex the semantics, the more levels there are. For example, the following text: [There was nothing unusual about the weather this January.] 1 [It’s just part of the Earth’s natural weather patterns.] 2 [The mainstream media is just pushing the idea of ​​climate change.] 3 [Pushing their own agenda.] 4; The above is a right-leaning text about weather, which is divided into four basic discourse units, expressing that climate is not a problem, but that the mainstream media is using climate change to promote its own agenda. The core is sentence (4), and the satellites are sentences (1), (2), and (3), forming a rhetorical structure tree with the core sentence (4) as the root node and the remaining satellite sentences as child nodes. The tree includes the organization of the article, the development of the argument, and the use of evidence, and can identify language features that may be related to political stance; S203: Relationship annotation, by annotating different semantic relationships, including but not limited to "contrast", "support", and "causality", to further enrich the discourse structure and make full use of this information in model training. Annotation is used to identify the role of each EDU in the overall text structure; The annotation process is based on manual and automatic annotation. For manual annotation, a complete relationship annotation system is first determined, including relationship types and annotation rules. The annotators annotate the relationships between discourse units in the text according to the annotation system. The annotators analyze how the sentences are organized, including sequential and contrastive relationships. Automatic annotation: Extract various features of discourse structure, including but not limited to lexical features, syntactic features, and semantic features, and use the annotated corpus to train the machine learning model. The model learns the relationship patterns in the annotated corpus and then annotates the new text.

[0019] S3: Text representation, using a pre-trained language model to obtain the embedded representation of the text. As an implementation example, the language model can be RoBERTa and Longformer. The model is used to capture the semantic information and contextual relationships in the text; S3 specifically includes the following steps: S301: Generate word embeddings. Use pre-trained language models, including but not limited to RoBERTa and Longformer, to generate word embedding representations for each EDU. The following is formula 4: ; Where eij represents the jth EDU of the i-th text, which contains the word vector xijk. The formula is used to calculate the average word embedding of the EDU and generate the embedding representation veij of the EDU, where m represents the number of words in the EDU, and xijk represents the embedding representation of the kth word in the EDU; S302: Context processing of EDUs, inputting the embedding representation veij of each EDU into a context model such as LSTM or Transformer to obtain a richer context representation and capture the dependencies between EDUs; S303: Document embedding generation: The representations of all EDUs are combined into the overall embedding representation vTi of the document. The embedding vectors of all EDUs can be weighted averaged, as shown in Formula 5: ; Where n is the number of EDUs in the text, wj is the weight of the jth EDU, which is determined by the attention mechanism to emphasize important EDUs; S304: Feature concatenation, concatenating other features on the document embedding vTi, including but not limited to sentiment scores and TF-IDF values, to form the final document representation v'Ti, as shown in Formula 6: .

[0020] S4: Model training, using the above text representation and discourse structure information to train a classifier to predict the political stance category of the text. The classifier contains multiple layers to process information of different granularities to achieve the effect of detecting news stances; In step S4, a classifier model is trained on the text implication recognition task, that is, whether there is an implication relationship, a contradiction relationship or a neutral relationship between the premise sentence and the hypothesis sentence. S4 specifically includes the following operation steps: S401: Model structure, build classifier, input is document embedding v'Ti, output is predicted label , select a model with a multi-layer structure to capture multi-granularity information, and use the cross entropy loss function to optimize the model parameters so that the predicted label The difference between the actual label yi is minimized, as shown in Formula 7: ; in is the model’s predicted probability for category c; S402: Training and validation, optimizing the model on the training set Dtrain, adjusting the hyperparameters on the validation set Dval, and evaluating the performance on the test set Dtest to calculate the accuracy, as shown in Formula 8: Where 1(.) is an indicator function, which takes the value of 1 when the prediction is correct. Specific embodiment 2: A news article stance rewriting evaluation method, the method adopts the news article stance detection method according to any one of claims 1 to 5, and comprises the following steps: A: Separate the sentences with stances in the tested articles and pay attention to the sources of information cited in the articles. When the articles cite the opinions, research or speeches of one party and lack sufficient discussion of other opposing opinions, it is judged that there is a stance bias. Analyze the structure of the article. When the article clearly puts forward a point of view at the beginning and then elaborates and argues around the point of view, it can be judged that the position of the article is relatively clear; when the article adopts a balanced structure, presents and analyzes different points of view in a relatively balanced manner, and finally draws a conclusion, it can be judged that the article tends to be neutral. Argumentation logic and methods: Check whether the argumentation logic of the article is reasonable. If there are logical loopholes, one-sidedness, or selective use of evidence in the argumentation process of the article, it can be judged that the position of the article is not objective enough; Based on the above content, a set of stance sentences is formed. Three basic editing operations are used to mark the words in the sentences, where [INS] marks the words that need to be inserted in front, [SUB] marks the words that need to be replaced with new words, [DEL] marks the words that need to be deleted, and [KEEP] marks the words that do not need to be modified; Specifically, A forms a stance sentence set from the sentences with stances in the news articles that have been detected, where the sentence set is represented as , and then use the tagger to tag the sentence, where [INS] marks the word that needs to be inserted in front, [SUB] marks the word that needs to be replaced with a new word, [DEL] marks the word that needs to be deleted, and [KEEP] marks the word that does not need to be modified. After tagging, the sentence set is represented as .

[0022] B: Fine-tune the BERT model as a language model to perform substitution and insertion operations, introduce a mask-based training strategy, and use the marker [SUB] to replace the words marked as [SUB]. <mask>Replace it, and for the word marked as [INS], insert before it <mask>, the masked sentence is input into the language model, and the language model replaces the predicted word with the mask; B specifically includes the following steps: B01: Fine-tune the BERT model, use the masked training strategy to train the language model, and use the marker [SUB] to mark the words in the sentence set. <mask>Replace it with the word marked as [INS] and insert it before it <mask>, forming the input vector of the language model; B02: After the vector is input into the language model, the language model replaces the predicted word with the mask to generate a state collection , where each subset si in each subset sti represents an operation on a sentence, and each state will produce 3n+1 sentences.

[0023] C: During each iteration, multiple sentences are generated, called the state set St, where each subset in St represents an operation applied to the current sentence; D: Use a classifier to distinguish sentences with different stances, and use a language model to construct a conditional random field. The scores calculated by the classifier are used to represent the stance differences of the sentences, and the scores calculated by the language model are used to represent the fluency of the sentences. They are weighted and input into the softmax layer to represent the quality of the converted sentences. D specifically includes the following steps: D01: Use a trained classifier to detect whether the generated sentence is in the target stance, and use a language model to ensure that the generated sentence is fluent. The loss function is as follows: ; Where xj is the jth sample in the training set, yj is the stance label of xj, and for sentence SA, when it needs to be converted into the target stance sentence SB, the conversion path is , the sentence Si needs to go through state Sti to convert to Si+1. The classifier calculation score of this step is formula 10: ; This score represents the difference in stance between sentence Si+1 and sentence Si. The language model then calculates the fluency scores of sentences Si+1 and Si. The score function is Formula 11: ; The weighted sum of the classifier score and the sentence fluency score is used to obtain the feature function to construct the conditional random field. The following is formula 12: STotal(Sti,pi)=u1 +u2 ; Then input the total score into the softmax layer to calculate the standardized probability distribution, as shown in Formula 13: ; The probability indicates the quality of the converted sentence. The higher the probability, the more the generated sentence meets the requirements.

[0024] E: Each iteration calculates the transition probability between two states and finds the optimal path to convert the input sentence into a high-quality output sentence. This process continues until the output sentence achieves the desired result. Based on step D, continuous iteration, the specific steps of E are: find the optimal path for sentence conversion, for the path , which means that the input sentence SA is modified for i consecutive times to obtain sentence SB. The transition probability from SA to SB is the product of all probabilities in the path, as shown in Formula 14: If the stance classification and sentence quality of sentence SB meet the requirements, the conversion is stopped.

[0025] F: Integrate the revised sentences into the entire article and compare them with the unrevised article. Calculate the content completeness and position similarity of the two articles to ensure that the revised article is complete and its position meets our requirements, thereby achieving the evaluation and rewriting of the news article content. The specific steps of F are: through step AE, the sentence set Convert to Finally, the converted sentence set is integrated into the original article newi to obtain the article newi' after the transformed stance. Then, the existing automatic text evaluation indicators (such as ROUGE, SBERT, CtxSimFit) are used to calculate the content similarity between the modified article and the original article to ensure that the content of the modified article is consistent with that of the original article. The following is formula 15: ; ; ; Where LCS(X, Y) is the length of the longest common subsequence of X and Y, m and n represent the number of words contained, Rlcs and Plcs represent the recall rate and precision rate, respectively, and Flcs is the content similarity index. When the index reaches above 0.9, the news position is rewritten and the content remains unchanged.

[0026] The present invention realizes the stance detection of news texts in a highly accurate manner and rewrites news texts with left or right stances into neutral texts, which is of great significance for the public to accept depolarized news and optimize international communication strategies.

[0027] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.< / mask> < / mask> < / mask> < / mask> < / mask> < / mask> < / mask> < / mask>

Claims

1. A news article stance detection method, characterized by: The steps include: S1: Dataset construction. First, we build a dataset containing political texts and corresponding position labels for training and testing models. The dataset contains texts of different political position categories. S2: Discourse structure analysis, which breaks down the text into smaller units, preferably discourse units, and analyzes the relationship and structure between these units, including the organization of the article, the development of the argument and the use of evidence, to identify language features that may be related to political positions and to capture the argument structure and rhetorical devices of the text; S3: Text representation, using a pre-trained language model to obtain the embedded representation of the text. The model is used to capture the semantic information and contextual relationships in the text; S4: Model training, use the above text representation and discourse structure information to train a classifier to predict the political stance category of the text. The classifier contains multiple levels to process information of different granularities to achieve the effect of detecting news stance.

2. A news article stance detection method according to claim 1, characterized in that: The S1 specifically includes the following steps: S101: Selection of text and labels. Obtain text data with clear political stances from different political news sources and public news datasets, including but not limited to obtaining articles from left-leaning, right-leaning, and neutral news websites; write crawler code to set crawling rules, including but not limited to obtaining data by date range, keyword filtering, and news topic; assign a stance label yi to each text Ti based on the known tendency of the source and the content of the article, and divide it into left-leaning (L), neutral (N), and right-leaning (R) according to the political stance. The form of the dataset D is as shown in Formula 1: ; S102: Text filtering and cleaning. Before formal processing, clean each text Ti to remove noise characters, HTML tags, extra spaces, and URLs. At the same time, check the overall situation of the text data, including but not limited to the data volume, text length distribution, language type, and character encoding. Determine the main problems in the text, including but not limited to repeated content, incorrect spellings, and formats that do not meet the requirements. Based on Python, store the text data in a collection to automatically remove repeated content. Unify the format of text content, convert all text to uppercase or lowercase as needed, and perform specific uppercase and lowercase conversion on parts such as titles; Filter and clean the processed text content to verify whether the data meets the expected quality standards. Extract some samples for manual inspection and automated test cases to verify the accuracy, completeness and consistency of the data. Adjust and optimize the filtering and cleaning steps based on the verification results. After the above processing, the text is used for subsequent processing, and the cleaned text is denoted as Ti′; S103: Label encoding, converting the category label yi into a numerical code for model training. The following is formula 2: 。 3. A news article stance detection method according to claim 1, characterized in that: The S2 specifically includes the following steps: S201: Discourse unit segmentation: divide each cleaned text Ti′ into basic discourse units (EDUs). These units are the smallest complete expression units. Each text is used to represent a set of EDUs {ei1, ei2, …, ein}, where n represents the number of EDUs. The following is formula 3: ; At the same time, too short units are merged. The too short speech units that appear after segmentation, including but not limited to single words and very short phrases, when they do not meet the requirements of the application scenario, are merged with adjacent units based on the context and semantics; Check the coherence and logic. Check whether the segmented discourse units are semantically and logically coherent through manual inspection and automatic semantic coherence assessment tools. If the segmentation is found to be unreasonable, adjust the segmentation method; S202: discourse relationship construction, analyzing the relationship between each EDU and establishing the discourse structure. Preferably, this is achieved by using a method based on discourse structure theory, organizing EDUs into a tree structure according to their semantic relationships. The relationship structure between EDUs is represented as a tree, where the root node represents the main argument and the leaf nodes represent supporting arguments. Specifically, the sentence segmentation tool is used to divide the text into multiple sentences according to the rhetorical structure theory, and the core and satellite are marked. The core represents the unit of central information and has relatively complete semantics. The satellite is other units that convey supporting information and are used to supplement the core part. A coherent chapter is composed of rhetorical relationships at different levels, which are represented as a tree structure. Starting from the chapter unit, the rhetorical structure tree gradually covers the entire chapter, forming a hierarchical chapter structure tree. The complexity of the levels is related to the complexity of the chapter semantics. The more complex the semantics, the more levels there are. S203: Relationship annotation, by annotating different semantic relationships, including but not limited to "contrast", "support", and "causality", to further enrich the discourse structure and make full use of this information in model training. Annotation is used to identify the role of each EDU in the overall text structure; The annotation process is based on manual and automatic annotation. For manual annotation, a complete relationship annotation system is first determined, including relationship types and annotation rules. The annotators annotate the relationships between discourse units in the text according to the annotation system. The annotators analyze how the sentences are organized, including sequential and contrastive relationships. Automatic annotation: Extract various features of discourse structure, including but not limited to lexical features, syntactic features, and semantic features, and use the annotated corpus to train the machine learning model. The model learns the relationship patterns in the annotated corpus and then annotates the new text.

4. A news article stance detection method according to claim 1, characterized in that: The S3 specifically includes the following steps: S301: Word embedding generation, using pre-trained language models, including but not limited to RoBERTa and Longformer, to generate word embedding representations for each EDU, as shown in Formula 4: ; Where eij represents the jth EDU of the i-th text, which contains the word vector xijk. The formula is used to calculate the average word embedding of the EDU and generate the embedding representation veij of the EDU, where m represents the number of words in the EDU, and xijk represents the embedding representation of the kth word in the EDU; S302: Context processing of EDUs, inputting the embedding representation veij of each EDU into a context model such as LSTM or Transformer to obtain a richer context representation and capture the dependencies between EDUs; S303: Document embedding generation: The representations of all EDUs are combined into the overall embedding representation vTi of the document. The embedding vectors of all EDUs can be weighted averaged, as shown in Formula 5: ; Where n is the number of EDUs in the text, wj is the weight of the jth EDU, which is determined by the attention mechanism to emphasize important EDUs; S304: Feature concatenation, concatenating other features on the document embedding vTi, including but not limited to sentiment scores and TF-IDF values, to form the final document representation v'Ti, as shown in Formula 6: 。 5. A news article stance detection method according to claim 1, characterized in that: In step S4, a classifier model is trained on the text implication recognition task, that is, whether there is an implication relationship, a contradiction relationship or a neutral relationship between the premise sentence and the hypothesis sentence. S4 specifically includes the following operation steps: S401: Model structure, build classifier, input is document embedding v'Ti, output is predicted label , select a model with a multi-layer structure to capture multi-granularity information, and use the cross entropy loss function to optimize the model parameters so that the predicted label The difference between the actual label yi is minimized, as shown in Formula 7: ; in is the model’s predicted probability for category c; S402: Training and validation, optimizing the model on the training set Dtrain, adjusting the hyperparameters on the validation set Dval, and evaluating the performance on the test set Dtest to calculate the accuracy, as shown in Formula 8: Where 1(.) is an indicator function, which takes the value of 1 when the prediction is correct.

6. A news article stance rewriting evaluation method, the method adopting the news article stance detection method as claimed in any one of claims 1 to 5, characterized in that: The steps include: A: Separate the sentences with stances in the tested articles and pay attention to the sources of information cited in the articles. When the articles cite the opinions, research or speeches of one party and lack sufficient discussion of other opposing opinions, it is judged that there is a stance bias. Analyze the structure of the article. When the article clearly puts forward a point of view at the beginning and then elaborates and argues around the point of view, it can be judged that the position of the article is relatively clear; when the article adopts a balanced structure, presents and analyzes different points of view in a relatively balanced manner, and finally draws a conclusion, it can be judged that the article tends to be neutral. Argumentation logic and methods: Check whether the argumentation logic of the article is reasonable. If there are logical loopholes, one-sidedness, or selective use of evidence in the argumentation process of the article, it can be judged that the position of the article is not objective enough; Based on the above content, a set of stance sentences is formed. Three basic editing operations are used to mark the words in the sentences, where [INS] marks the words that need to be inserted in front, [SUB] marks the words that need to be replaced with new words, [DEL] marks the words that need to be deleted, and [KEEP] marks the words that do not need to be modified; B: Fine-tune the BERT model as a language model to perform substitution and insertion operations, introduce a mask-based training strategy, and use the marker [SUB] to replace the words marked as [SUB]. <mask>Replace it, and for the word marked as [INS], insert before it <mask> , the masked sentence is input into the language model, and the language model replaces the predicted word with the mask;< / mask> < / mask> C: During each iteration, multiple sentences are generated, called the state set St, where each subset in St represents an operation applied to the current sentence; D: Use a classifier to distinguish sentences with different stances, and use a language model to construct a conditional random field. The scores calculated by the classifier are used to represent the stance differences of the sentences, and the scores calculated by the language model are used to represent the fluency of the sentences. They are weighted and input into the softmax layer to represent the quality of the converted sentences. E: Each iteration calculates the transition probability between two states and finds the optimal path to convert the input sentence into a high-quality output sentence. This process continues until the output sentence achieves the desired result. F: Integrate the revised sentences into the entire article and compare them with the unrevised article. Calculate the content completeness and position similarity of the two articles to ensure that the content of the revised article is complete and the position meets our requirements, thereby achieving the evaluation and rewriting of the content of the news article.

7. A news article stance rewriting evaluation method according to claim 6, characterized in that: Specifically, A is: forming a stance sentence set from the sentences with stances in the detected news articles, where the sentence set is represented as , and then use the tagger to tag the sentence, where [INS] marks the word that needs to be inserted in front, [SUB] marks the word that needs to be replaced with a new word, [DEL] marks the word that needs to be deleted, and [KEEP] marks the word that does not need to be modified. After tagging, the sentence set is represented as .

8. A news article stance rewriting evaluation method according to claim 6, characterized in that: The B specifically includes the following steps: B01: Fine-tune the BERT model, use the masked training strategy to train the language model, and mark the words marked as [SUB] in the sentence set with <mask>Replace it with the word marked as [INS] and insert it before it <mask> , forming the input vector of the language model;< / mask> < / mask> B02: After the vector is input into the language model, the language model replaces the predicted word with the mask to generate a state collection , where each subset si in each subset sti represents an operation on a sentence, and each state will produce 3n+1 sentences.

9. A news article stance rewriting evaluation method according to claim 6, characterized in that: The D specifically includes the following steps: D01: Use a trained classifier to detect whether the generated sentence is in the target stance, and use a language model to ensure that the generated sentence is fluent. The loss function is as follows: ; Where xj is the jth sample in the training set, yj is the stance label of xj, and for sentence SA, when it needs to be converted into sentence SB of the target stance, the conversion path is , the sentence Si needs to go through state Sti to convert to Si+1. The classifier calculation score of this step is formula 10: ; This score represents the difference in stance between sentence Si+1 and sentence Si. The language model then calculates the fluency scores of sentences Si+1 and Si. The score function is Formula 11: ; The weighted sum of the classifier score and the sentence fluency score is used to obtain the feature function to construct the conditional random field. The following is formula 12: STotal(Sti,pi)=u1 +u2 ; Then input the total score into the softmax layer to calculate the standardized probability distribution, as shown in Formula 13: ; The probability indicates the quality of the converted sentence. The higher the probability, the more the generated sentence meets the requirements. Based on step D, continuous iteration, the specific steps of E are: find the optimal path for sentence conversion, for the path , which means that the input sentence SA is modified for i consecutive times to obtain sentence SB. The transition probability from SA to SB is the product of all probabilities in the path, as shown in Formula 14: If the stance classification and sentence quality of sentence SB meet the requirements, the conversion is stopped.

10. A news article stance rewriting evaluation method according to claim 6, characterized in that: The specific steps of F are: through step AE, the sentence set Convert to Finally, the converted sentence set is integrated into the original article newi to obtain the article newi' after the transformed stance. Then, the existing automatic text evaluation indicators (such as ROUGE, SBERT, CtxSimFit) are used to calculate the content similarity between the modified article and the original article to ensure that the content of the modified article is consistent with that of the original article. The following is formula 15: ; ; ; Where LCS(X, Y) is the length of the longest common subsequence of X and Y, m and n represent the number of words contained, Rlcs and Plcs represent the recall rate and precision rate, respectively, and Flcs is the content similarity index. When the index reaches above 0.9, the news position is rewritten and the content remains unchanged.

Citation Information

Patent Citations

  • Multi-label classification method and system based on label dependency measurement

    CN115203410A

  • Chinese social media few-sample standing detection method based on theme enhancement

    CN117910466A

  • RAG-based news comment article full-text generation framework and method of large language model

    CN118377893A

  • Reordering multi-mode abstract generation method based on semantic plan guidance

    CN118708716A

Cited By

  • E-book recommendation method and system based on artificial intelligence

    CN121052377A

  • Mathematical modeling competition paper quality evaluation method based on multi-feature fusion

    CN121598932A

  • A Method for Evaluating the Quality of Mathematical Modeling Competition Papers Based on Multi-Feature Fusion

    CN121598932B