An english text stance annotation method and system
By constructing an English text stance labeler and utilizing the RoBERTa-Large model and rule formulation, the problems of efficiency and accuracy in English text stance labeling were solved, achieving automated identification and visual analysis of stance vocabulary, and promoting the progress of English text stance research.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TIANJIN UNIVERSITY OF FINANCE AND ECONOMICS
- Filing Date
- 2026-01-16
- Publication Date
- 2026-05-08
AI Technical Summary
In existing technologies, stance labeling of English texts requires a lot of manual labor, making it difficult to achieve efficient and accurate stance vocabulary recognition and analysis on large-scale corpora.
By constructing an English text stance labeler and training it using the RoBERTa-Large model, and combining English syntactic structure, contextual semantics, and lexical characteristics, stance lexical labeling rules are formulated to achieve automated stance lexical labeling.
It enables precise annotation and visual analysis of stances in English texts, quickly and efficiently identifying stance-related vocabulary, quantifying media bias, and tracking changes in public opinion, providing a tool for quantitative analysis of stance trends in cross-cultural communication.
Smart Images

Figure CN121543587B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of information technology and natural language processing, and specifically relates to a method and system for position labeling in English text. Background Technology
[0002] The analysis and optimization of English texts, besides correcting grammatical errors, are crucial for accurate expression, avoiding inappropriate phrasing and linguistic loopholes, enhancing the persuasiveness of discourse, and improving communication effectiveness. One important area of analysis and optimization concerns the expression of stances. Appropriately expressing stances in English can more accurately convey deeper meanings, ensuring that viewpoints are accurately understood and disseminated globally.
[0003] In research on stance analysis and optimization of English texts, the annotation of stance terms is a crucial process. Since stance terms often require identification in conjunction with specific grammatical structures, traditional research often employs part-of-speech taggers to assign parts of speech to each word in the text, followed by manual identification of grammatical relationships and stance terms. While this method ensures accuracy, the substantial manual labor required makes it prohibitively costly and practically unfeasible for large-scale stance research. Therefore, there is an urgent need for an automated stance annotation method and analysis system capable of accurately identifying stance terms in large volumes of English texts. Summary of the Invention
[0004] The purpose of this invention is to provide a method and system for labeling English text stances, which achieves accurate labeling of English text stances by constructing an English text stance labeler.
[0005] To achieve the above objectives, the technical solution of the present invention is as follows:
[0006] A method for labeling stances in English texts, comprising:
[0007] S1. Part-of-speech preprocessing: Obtain English text through data collection and generate part-of-speech tags for each word in the English text;
[0008] S2. Rule Construction: Based on the part-of-speech tags, formulate position lexical tagging rules according to English syntax, contextual semantics and lexical characteristics, and write code to obtain a rule-based position lexical tagger;
[0009] S3. Dataset labeling: Using the rule-based stance lexical labeler, the English text that already contains part-of-speech tags is labeled with stances to obtain a stance-labeled dataset.
[0010] S4. Machine Learning Training: Using the aforementioned stance labeling dataset, the RoBERTa-Large model is used as a base model for training to obtain a training-based stance vocabulary labeler, thereby improving labeling accuracy.
[0011] S5. Stance Labeling: The stance labeling of the English text to be analyzed is completed using the training-based stance lexical labeler.
[0012] Furthermore, step S1 includes:
[0013] S101. Collect English text corpora of news from mainstream foreign media and major domestic media outlets with external propaganda from global news databases;
[0014] S102. Perform duplicate filtering on the collected text corpus, including extracting title prefixes using regular expressions and grouping them for deduplication, and performing parallel similarity matching with two rules to delete similar text.
[0015] S103. Perform data cleaning on the text after filtering out duplicates;
[0016] S104. Use regular expressions to segment the cleaned text content into several parts: title, date, source, watermark information, and body text.
[0017] S105. Use regular expressions to construct sentence segmentation logic. Based on English punctuation and quotation mark rules, the text content is divided into independent sentences. Then, the Stanford POS Tagger is used to tag the segmented sentences to obtain the part-of-speech tag for each word.
[0018] S106. Construct a PostgreSQL database, divided into ID, title, source, date, body, sentence segmentation result, and tag; write the segmented content into the corresponding fields except ID, with each data entry having a unique ID, forming an English text database.
[0019] Furthermore, the duplicate item screening in step S102 specifically includes:
[0020] S102-1. Extracting and grouping the title prefixes of the text: Extract the prefixes from the first line title of the text using regular expressions; group the text according to the extracted prefixes, and count the number of texts and unique titles in each group; retain only the groups with more than 1 files as candidate deduplication objects; further filter out the groups in which all files have the same title and the number of files is less than or equal to the set threshold, and perform subsequent content comparison on the filtered groups.
[0021] S102-2, Parallel Similarity Matching with Two Rules: Calculate the complete similarity of each text content in the filtered group. If it is greater than or equal to the set similarity threshold, it is determined to be similar text. If it is lower than the set similarity threshold, the first N characters are compared and subset similarity is calculated. If the subset similarity is greater than or equal to the set subset similarity threshold, it is determined to be similar text. Delete the matched similar text and keep only one copy.
[0022] Furthermore, step S103 includes:
[0023] S103-1. Adjust the title format of the text to the standard format;
[0024] S103-2. Extract proper nouns from the text and form a proper noun dictionary;
[0025] S103-3. Write a text formatting program to standardize the main text content;
[0026] S103-4. Remove irrelevant content, including illegal characters and URL links, using regular expressions.
[0027] Furthermore, the formulation of position term labeling rules in step S2 includes:
[0028] S201. Simple Stance Vocabulary Tagging: Modal verbs, semi-modal verbs, and stance adverbs are used as simple stance vocabulary, and the vocabulary definition is expanded; the simple stance vocabulary is judged and tagged by combining the word form of the target word with the part-of-speech tag.
[0029] S202. Complex Stance Vocabulary Annotation: Stance verbs, stance adjectives, and stance nouns that introduce complement clauses are designated as complex stance vocabulary; the identification types of complex stance vocabulary are summarized, and general and special rules are set for each identification type; the complex stance vocabulary is judged and annotated according to the identification type and its corresponding rules by combining the word form of the target word with the part-of-speech tag.
[0030] Furthermore, the vocabulary definition expansion in step S201 includes: expanding the variant forms of modal verbs, semi-modal verbs, and position adverbs defined in the existing position vocabulary to the corresponding levels for definition expansion.
[0031] Furthermore, step S202 includes:
[0032] S202-1. Based on position verbs, position adjectives, position nouns, and their introduced complement clauses in English grammar, determine the identification types of complex positional vocabulary, including:
[0033] Position verb + to clause; position verb + that clause; position adjective + to clause; position adjective + that clause; position noun + to clause; position noun + that clause;
[0034] S202-2. Set general rules for each identification type, the general rules including:
[0035] (1) Lexical definition expansion: Extend the inflected forms of the existing stance verbs / stance adjectives / stance nouns defined in the stance vocabulary to the corresponding level for definition expansion;
[0036] (2) Definition of the scope of to / that: Based on the various different part-of-speech tags corresponding to to / that, the scope of part-of-speech tags used for judging complex stance words is defined;
[0037] (3) Definition of limiting rules: The limiting rules include: triggering different judgment processes and results based on the different grammatical structures, including different words, parts of speech tags, and punctuation marks, between the position verb / position adjective / position noun and to / that;
[0038] S202-3. Set special rules for each identification type. The special rules include: based on the special cases of the target word that does not conform to the general rules but is still a complex position word contained in the position verb / position adjective / position noun + to / that clause, set grammatical structure judgment rules for the special cases.
[0039] Furthermore, the general and special rules also include part-of-speech tag correction rules, which determine whether the target word is mislabeled based on the contextual tags. If it is mislabeled, the mislabeled part-of-speech tag is replaced with the correct part-of-speech tag.
[0040] Furthermore, step S3 includes:
[0041] S301. Based on the definition of position vocabulary and the division of sub-levels expressing position in the definition, set position codes;
[0042] S302. Based on the stated position tagging rules and position codes, programmatically perform position tagging on English text that already contains part-of-speech tags to obtain a position tagging dataset.
[0043] Furthermore, step S4 includes:
[0044] The position labeling dataset is divided into a training set, a validation set, and a test set. The training set is used as the data source for training the RoBERTa-Large model, allowing the model to learn from the labeling results.
[0045] The sentence is split into WordPiece subwords using the RobertaTokenizerFast tokenizer, and the first subword of each word is used as a token, which is then mapped to the corresponding label of the word. The sequence labeling task is then assigned to the pre-trained model class RobertaForTokenClassification, which learns how to predict regular labels on a large-scale corpus through cross-entropy or multi-label loss. Gradient accumulation, mixed precision, and learning rate warm-up are used during training to adapt to the memory requirements of RoBERTa-Large. The model parameters are adjusted using a validation set, and the model performance is tested using a test set. The final trained model is used as a stance lexical labeler.
[0046] In another aspect, this invention also proposes an English text stance annotation system, comprising:
[0047] Part-of-speech tagging module: Obtains English text through data acquisition and generates part-of-speech tags for each word in the English text;
[0048] Rule building module: Based on the part-of-speech tags, and according to English syntax, contextual semantics and lexical characteristics, formulate position lexical tagging rules, and write code to obtain a rule-based position lexical tagger;
[0049] Dataset labeling module: Using the rule-based stance lexical labeler, stance labels are applied to English text that already contains part-of-speech tags to obtain a stance-labeled dataset;
[0050] Machine learning training module: Using the aforementioned stance labeling dataset, the RoBERTa-Large model is used as a base model for training to obtain a training-based stance vocabulary labeler, thereby improving labeling accuracy;
[0051] Stance labeling module: The trained stance lexical labeler is used to label the English text to be analyzed with stance.
[0052] This invention also proposes a visual retrieval and annotation system, which develops web pages with database visual retrieval and annotation functions using a programming language and applies the aforementioned English text stance annotation method.
[0053] Compared with the prior art, the present invention has the following beneficial effects:
[0054] The proposed method for labeling English text stances, along with a training-based English text stance labeler and corresponding system, enables precise labeling and visual analysis of English text stances, thus providing a reliable tool for stance research in fields such as linguistics and international communication. Using this method and system, researchers can quickly and efficiently identify stance-related vocabulary from massive data sources and analyze the stance inclination within sentences by combining their position within the sentence. This allows for the quantification of media bias, tracking of changes in public opinion, and quantitative analysis of stance trends in cross-cultural communication. This method and system will effectively promote the progress of large-scale English text stance research in China and bring beneficial effects to the construction of an international discourse system. Attached Figure Description
[0055] Figure 1 This is a schematic diagram of the method flow of Embodiment 1 of the present invention;
[0056] Figure 2 This is a schematic diagram of the hybrid annotation result of Stanford label + position label in Embodiment 1 of the present invention;
[0057] Figure 3 This is a functional diagram of the visual retrieval and annotation system of Embodiment 3 of the present invention. Detailed Implementation
[0058] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.
[0059] The present invention will now be described in detail with reference to specific embodiments and accompanying drawings.
[0060] It should be noted that: the specific embodiments involving functions implemented through programming languages, such as using programming languages to construct regular expressions, all use Python as an example, but it is not limited to using only Python. Any programming language that can achieve the same function is within the protection scope of this invention.
[0061] Example 1:
[0062] The English text stance annotation method implemented in this embodiment, such as Figure 1 As shown, it specifically includes:
[0063] 1. Core data collection and part-of-speech preprocessing:
[0064] 1.1 Data Collection. English text corpora of news from mainstream foreign media, including those from the UK and the US, and English text corpora of news from major domestic media outlets promoting foreign propaganda (including headlines, body text, dates, sources, authors, etc.) were collected from global news databases.
[0065] 1.2 Data Filtering. Duplicate items are filtered from the collected raw text. The specific process is as follows:
[0066] (1) Extract title prefixes and group them. Perform the following steps sequentially: extract the prefix from the first line of the file title using the Python regular expression PREFIX_SEPARATOR; group the files according to the extracted prefixes, and count the number of files and unique titles in each group. Only groups with more than 1 files are retained as candidates for deduplication; further filter out groups with "no subclasses" (all files within the group have identical titles) and a file count ≤ the threshold SIMILARITY_GROUP_MAX_SIZE (the default threshold in this example is 10), and only perform subsequent content comparisons on these groups.
[0067] (2) Parallel similarity matching with two rules. The following steps are performed sequentially: Calculate the complete similarity (standardratio) of the document content. If it is greater than or equal to the set similarity threshold of 0.8, it is judged as similar and marked as "Standard" type. When the standard similarity does not meet the standard, the first N characters of the longer content and the shorter content (N = the length of the shorter content) are compared to calculate the subset similarity (subset_ratio). If the subset similarity is greater than or equal to the set subset similarity threshold of 0.9, it is judged as similar and marked as Subset type. Delete the matched similar text and keep only one of them.
[0068] 1.3 Data Cleaning. This includes: adjusting title format; extracting proper nouns and creating a proper noun dictionary (with protected formatting); using a Python-written text formatting program to standardize the text content for capitalization, punctuation, common abbreviations, and initial capitalization; and applying NLTK and Python regular expressions to clean the text, removing illegal characters, URL links, and other irrelevant content.
[0069] 1.4 Content Segmentation. Regular expressions are used to segment the text content into several parts: title, date, source, watermark information, and body text.
[0070] 1.5 Text Pre-labeling. A Python sentence segmentation file, `text_utils.py`, was written, using Python regular expressions to construct the complete sentence segmentation logic, taking into account English punctuation and quotation rules (especially modern English), to segment the text content into independent sentences. Then, the Stanford POS Tagger was used to label the segmented sentences, obtaining the part-of-speech tag for each word.
[0071] 1.6 Data Import. A PostgreSQL database is constructed, consisting of fields for ID, title, source, date, body, sentence segmentation, and tags. The segmented content is written into the corresponding fields except for ID. Each data entry has a unique ID, forming an English text database α.
[0072] 2. Develop rules for identifying stance-related terms.
[0073] In this embodiment, an English position vocabulary list is used as the primary source of position vocabulary. This position vocabulary list can be the one found on page 93 of Chapter 5 of Douglas Biber's 2006 book, *University Language: Acorpus-based study of spoken and written registers*, or other commonly used position vocabulary lists. Biber's position vocabulary list categorizes position terms into three types:
[0074] ① Modal verbs and semi-modal verbs;
[0075] ② Stance Adverbs;
[0076] ③ Stance verbs, stance adjectives, or stance nouns that introduce complement clauses.
[0077] The identification of words in categories ① and ② does not require complex grammatical structures; it only requires combining word form and part-of-speech tags. Therefore, these are named "simple stance words." Words in category ③ require the application of complex grammatical rules for identification; therefore, they are named "complex stance words." An analysis of the grammatical structures of introductory complement clauses in English grammar reveals that the identification types involved in category ③ stance words can be mainly divided into the following six categories:
[0078] 1) Verb of stance + to clause;
[0079] 2) Stance verb + that clause;
[0080] 3) Stance adjective + to clause;
[0081] 4) Stance adjective + that clause;
[0082] 5) Noun of stance + to clause;
[0083] 6) Noun of stance + that clause;
[0084] The "to" clause refers to an infinitive clause, and the "that" clause refers to a complement clause introduced by the subordinating conjunction "that".
[0085] Based on the above characteristics, recognition rules were formulated for simple stance words and complex stance words.
[0086] 2.1 Simple Stance Words Recognition Rules:
[0087] Simple stance words do not involve complex grammatical rules, and word form matching can guarantee an accuracy rate of over 90%. In this embodiment, the recognition of simple_stance_words mainly adopts a combination of word form matching and Stanford part-of-speech tagging, achieving an accuracy rate of over 98%. This accuracy rate primarily depends on the part-of-speech tagging accuracy of the Stanford part-of-speech tagger, as word form matching is generally error-free. The specific rules are described below.
[0088] 2.1.1 Modal and semi-modal verbs:
[0089] First, we expand the vocabulary definition by extending the inflections of modal verbs and semi-modal verbs to the corresponding levels, as explained below:
[0090] Some modal verbs have positional variations. For example, "could" is a modal verb, and its conjunctions "couldn't" and "could not" are also positional words. For this category of words with variations, using forms like "could0" as the base form, a list of words containing various variations is defined, as shown in the following form (only a portion is listed):
[0091] could0 = ["could", "could not", "couldn't"];
[0092] may0 = ["may", "may not"];
[0093] might0 = ["might", "might not", "mightn't"];
[0094] must0 = ["must", "must not", "mustn't"];
[0095] should0 = ["should", "should not", "shouldn't"];
[0096] Simultaneously, a hierarchical structure needs to be defined, based on the hierarchy of positional vocabulary given by linguist Douglas Biber, such as the hierarchy of modal verbs and semi-modal verbs:
[0097] 1. Modal and semi-modal verbs (top-level: modal verbs and semi-modal verbs)
[0098] 1.1. Possibility / Permission / Ability (Second-level: semantics: possibility / permission / capability)
[0099] 1.2. Necessity / Obligation (Second-level semantics: necessity / obligation)
[0100] 1.3. Prediction / volition (Second layer: semantics are prediction / willingness)
[0101] The data structure for defining hierarchical levels after vocabulary definition expansion can be referenced in the following form (partial list only):
[0102] "Modal and semi-modal verbs": {
[0103] "possibility / permission / ability": {
[0104] "words": ["can", "cannot", "can't",
[0105] "could", "could not", "couldn't",
[0106] "may", "may not",
[0107] "might", "might not", "mightn't"],
[0108] "subcategories": {}
[0109] }
[0110] } ;
[0111] The data structure described above shows that the hierarchical structure includes:
[0112] The top-level section, Modal and semi-modal verbs, indicates that the core theme is modal and semi-modal verbs.
[0113] The second layer represents the semantic layer: possibility / permission / ability;
[0114] Sub-level word represents the vocabulary (including word variants) at the semantic level.
[0115] The subcategories represent the subcategories under the semantic layer (currently empty).
[0116] The hierarchical structure is used for setting subsequent stance codes and determining stance inclinations.
[0117] When identifying a single word, such as "could", the following three conditions must be met simultaneously: ① the word form is consistent with the position words in the category, ② the label is MD (Stanford Part-of-Speech Tag) modal verb label, and ③ it belongs to the corresponding category in the hierarchical structure and can be identified as a simple position word.
[0118] If it is a phrase, such as "may not", then it can be identified as a simple stance word as long as it meets the requirements of word form consistency and belonging to the category in the hierarchical structure.
[0119] 2.1.2 Stance Adverbs
[0120] Since position adverbs do not have inflections, there is no need to define lexical variants; only a hierarchical structure needs to be defined, based on the hierarchy of position lexics given by linguist Douglas Biber.
[0121] Please refer to the following format (partial list only):
[0122] "Stance adverbs": {
[0123] "Epistemic": {
[0124] "words": [],
[0125] "subcategories": {
[0126] "Certainty": ["actually", "always", "certainly", "definitely", "indeed", "inevitably", "in fact", "never", "of course", "obviously", "really", "undoubtedly", "without doubt", "no doubt"],
[0127] "Likelihood": ["apparently", "evidently", "kind of", "in most cases","in most instances", "perhaps", "possibly", "predictably", "probably", "roughly", "sort of", "maybe"]
[0128] }
[0129] }
[0130] };
[0131] The data structure described above shows that the hierarchical structure includes:
[0132] Top-level Stance adverbs indicate that the core theme is a stance adverb.
[0133] The second layer, Epistemic, represents the semantic layer: cognitive class;
[0134] The sub-level word represents a lexical variant under the cognitive semantic layer. Since there is no variation, it is empty.
[0135] Subcategories represent subcategories within a semantic category, including the subcategory Certainty (representing certainty), Likelihood (representing possibility), and the vocabulary for each subcategory.
[0136] When identifying a single word, such as "actually", the following three conditions must be met: ① consistent word form, ② labeled as RB (Stanford's adverb label), ③ belonging to the corresponding category in the hierarchical structure and can be identified as a simple position word.
[0137] If it appears in the form of a phrase, such as "in fact", then it only needs to meet the requirements of part of speech consistency and belonging to the corresponding category in the hierarchical structure to be identified as a simple stance word.
[0138] 2.2 Recognition rules for complex stance words:
[0139] Complex stance words involve intricate grammatical structures and lexical inflections, requiring a combination of methods for identification. This embodiment employs a combination of methods to identify complex stance words (complex_stance_words): ① word form matching ② Stanford part-of-speech tagging ③ basic part-of-speech correction ④ rule writing ⑤ special case exclusion. Extensive testing shows that the accuracy rate for identifying this type of stance word is approximately 95%. Errors mainly arise from the following: ① incorrect basic part-of-speech tagging ② rules not fully covering all aspects ③ special punctuation marks (such as dashes and hyphens) causing rule lookup interruptions ④ stance words appearing as proper nouns / phrases ⑤ excessive distance causing lookup interruptions. The specific rules are described below:
[0140] 2.2.1 Stance verb + to clause.
[0141] 1) General Rules:
[0142] ① Define position verbs. Biber's position vocabulary only provides the base form of position verbs, but in actual sentences, position verbs are conjugated in five forms: base form, third-person singular, present participle, past tense, and past participle. Therefore, a complete vocabulary list needs to be defined, similar to "conclude0". See the following format (partial list only):
[0143] conclude0 = ["conclude", "concludes", "concluding", "concluded"];
[0144] find0 = ["find", "finds", "finding", "found"];
[0145] A hierarchical structure needs to be defined simultaneously. This hierarchical structure is also based on the hierarchy of positional vocabulary given by linguist Douglas Biber, and is defined as shown in the previous hierarchical structure.
[0146] Because some positional verbs, such as "wish," can be both verbs and nouns, and some positional verb inflections, such as "prepared," can be either past tense verbs or adjectives, it is necessary to ensure that the words in a sentence are true positional verbs through a tag + rule approach. The specific method is as follows:
[0147] Ensure that the part-of-speech tag for the verb begins with "V". Stanford uses a total of six part-of-speech tags for verbs, all of which begin with "V", as shown in Table 1:
[0148] Table 1: Verb Tag Types
[0149]
[0150] VBG and VBN may have adjective parts of speech, such as "a loving_VBG person" and "a prepared_VBNmeal". Stanford's labeling has a high probability of misjudging these terms. Therefore, to ensure accuracy, the main labeling range is narrowed down to four categories: VB / VBP / VBZ / VBD.
[0151] Words that start with V but are actually adjectives (Stanford mislabeling) will be converted to JJ tags (adjectives). The specific judgment logic is as follows: check whether the tag immediately to the left of the target word belongs to ['PRP$', 'POS', 'JJ'] or whether the adjacent word is ['a', 'an', 'the']. If either of them is satisfied, ignore the original tag and replace the tag with JJ.
[0152] ② Define the scope of "to". A "to" clause refers to an infinitive clause. First, use the Stanford TO tag (infinitive) to make a judgment. To avoid Stanford misjudging "to" as a preposition (labeled IN) as an infinitive "TO", the scope of the TO tag needs to be further narrowed. If the tag immediately to the right of TO is DT (determiner), then replace TO with IN (preposition / conjunction tag). Simultaneously, to correct situations where "to" should be labeled TO but is instead labeled IN, check according to the following rules:
[0153] a. If the "to" tag is already "TO", then it takes effect immediately;
[0154] b. If it is not TO, then check if the tag immediately to its right is VB (verb infinitive). If it is, ignore the previous tag and directly replace the tag of to with TO.
[0155] The remaining TO tags entering the judgment process are considered valid only if they meet the following two conditions on the right:
[0156] a. The label immediately to its right is VB or VBP (without any punctuation marks except for quotation marks);
[0157] b. The first position on its right is RB (adverb), the second position is VB or VBP, and there are no punctuation marks in between except for quotation marks.
[0158] ③ Define limiting rules. Since the target word in a position verb + to clause is not always immediately adjacent to the infinitive "to", it is necessary to define limiting rules between the target word and "to". Different judgment processes and results are triggered based on the grammatical structures between the position verb and "to", including different words, parts of speech tags, and punctuation. For example: if the target word and "to" have a part of speech tag starting with "V" or belonging to WP / WRB / WP$ / WDT, then blocking is triggered, and the recognition result for that target word is returned as "empty"; if the target word is "find / finds / finding / found" and is immediately followed by "it", then the recognition result for that target word is returned as "empty", and so on; these collectively form the summary of limiting rules for position verb + to clause.
[0159] 2) Special Rules:
[0160] There is a special case in the "to" clause where the verb of position + to can omit "to": when the verb is in the "help" family, forming the structure "help (sb.) (to) do", including ["help", "helps", "helping", "helped"]. In this case, the "to" label cannot be relied upon for judgment, and special rules are required. The specific special rules are:
[0161] ① The target word must begin with V (limited to verb tags);
[0162] ② Search up to 5 positions to the right of the target word, checking for the existence of VB or VBP tags (verb base form). If not found, skip directly; if found, proceed to the next step.
[0163] ③ Check whether the target word is immediately adjacent to VB or VBP and has no other punctuation marks except quotation marks. If it meets the requirements, it is considered effective and the target word can be identified as a position verb.
[0164] ④ Check if the word immediately to the left of VB or VBP is a PRP (personal pronoun) or a tag starting with N (noun). If so, it is considered effective and the target word can be identified as a position verb.
[0165] 2.2.2 Stance verb + that clause.
[0166] 1) General Rules:
[0167] ① Define the stance verb. The process has already been outlined in 2.2.1 and will not be repeated here;
[0168] ② Define the scope of "that". Since "that" can function as a demonstrative pronoun, determiner, subordinating conjunction, and relative pronoun simultaneously, and "that" clauses require a subordinating conjunction, only "that" clauses with the tag "IN" are considered valid and can proceed to the judgment process.
[0169] ③ Define limiting rules. In a position verb + that clause, the target word is usually not immediately adjacent to "that". Therefore, it is necessary to define limiting rules between the target word and that_IN. For example, if a tag starting with VB and not VBG / VBN appears between the target word and that, a blocking event is triggered, and the recognition result for the target word is returned as "empty", etc. Together, these form a summary of limiting rules for position verb + that clause.
[0170] 2) Special Rules:
[0171] The "that" clause with a position verb includes the following two special cases: ① that is omitted ② other cases that are equivalent to that being omitted. In the latter case, the "[THATD]" (that omitted) tag is added after the original tag to form a combined tag, such as "knows_VBZ[THATD]", which indicates that it is a "that" clause.
[0172] 2.2.3 Stance adjective + to clause.
[0173] 1) General Rules:
[0174] ① Define position adjectives. Although adjectives (JJ) have comparative (JJR) and superlative (JJS) forms, they cannot be directly followed by an infinitive or the subordinating conjunction "that". Therefore, position adjectives only need to be considered in their basic form. At the same time, it is necessary to define the hierarchical structure of position adjectives, similar to position verbs, which will not be elaborated here.
[0175] Although some adjectives are marked as JJ by the Stanford part-of-speech tagger, they are not suitable for position adjective judgment. The tags for these words need to be converted to ADJ (general adjective). Specific rules for this situation are set in the general rules. For example, if either of the following exists in the two positions to the left of the target word: the part-of-speech tag is PRP$ (possessive pronoun tag) or POS (possessive case tag), and the corresponding word itself is a qualifier a / an / the, then the original part-of-speech tag JJ of the target word is replaced with the general adjective tag ADJ, and it is not included in the position adjective judgment; and so on. A summary of JJ-to-ADJ conversion rules is set in the general rules.
[0176] Some words that are mistakenly labeled as VBN are actually adjectives. The specific method for determining this is to check if there is a "be" verb in the three positions to the left of the VBN. If there is, and the classification is correct, then it is also considered a position adjective.
[0177] Therefore, the positional adjectives involved in the judgment include:
[0178] a. Adjectives initially marked as JJ that do not conform to ADJ conversion rules;
[0179] b. The initial tag starts with V, but is converted to JJ using the conversion rule mentioned in point ① of the general rule in 2.2.1;
[0180] c. VBNs that conform to the rules.
[0181] ② Define the scope of "to". This is consistent with the use of "to" in positional verbs, and will not be elaborated further.
[0182] ③ Define limiting rules. Since the target word in a position adjective + to clause is not always immediately adjacent to the infinitive "to", it is necessary to define limiting rules between the target word and TO. For example, if a tag starting with V or N or PRP appears between the target word and TO, it will trigger a block and the recognition result for the target word will be returned as "empty", etc. Together, these form a summary of limiting rules for position adjective + to clause.
[0183] 2) Special Rules:
[0184] ① "better". When the word to be judged is "better", it is necessary to check whether it is immediately adjacent to a JJ or ADJ tag on the right. This is because there may be forms like "better improve", in which case "better" is easily labeled as a JJ, but it is actually an adverb. Therefore, in this case, "better" is not considered a position adjective.
[0185] ② "as soon as possible". When possible appears in this phrase, it does not express a stance, but rather a possibility. Therefore, "possible" in this case is not considered a stance adjective.
[0186] 2.2.4 Stance adjective + that clause.
[0187] 1) General Rules:
[0188] ① Define positional adjectives. 2.2.3 has already been listed and will not be repeated here.
[0189] ② Define the scope of "that". This is consistent with the use of "that" in positional verbs, and will not be elaborated further.
[0190] ③ Define limiting rules. In position adjective + that clause, the target word is usually not immediately adjacent to "that". Therefore, it is necessary to define limiting rules between the target word and that_IN. For example, if the target word is immediately adjacent to a label that starts with N, then blocking is triggered, and the recognition result for the target word is returned as "empty", etc. Together, these form a summary of limiting rules for position adjective + that clause.
[0191] 2) Special Rules:
[0192] There are also cases where "that" is omitted when using position adjectives + "that". For example, if there is a preposition (prep set) 1-2 positions to the left of the target word, it is skipped, not marked [THATD], and is not considered as belonging to a "that" clause, etc.; together, these constitute the summary of rules for omitting "that" in position adjectives.
[0193] 2.2.5 Position noun + to clause.
[0194] 1) General Rules:
[0195] ① Define the position noun. The noun contains singular and plural forms, so a primitive level needs to be defined, such as "reason0", which contains ["reason", "reasons"]. At the same time, the hierarchical structure of the position noun needs to be defined, similar to the position verb, which will not be elaborated here.
[0196] Some position nouns, such as "hope," can function as both a noun and a verb, therefore they need to be prefixed with the label N to qualify them as nouns. Furthermore, when used as nouns, these are often mistakenly labeled as VBG or VBN, so the following rules are needed to correct this: ① Check if the original label of a word in the position noun set is VBG / VBN, and if its immediate left neighbor is a word in the be set. If so, proceed to step two; ② Check if its immediate left neighbor is DT / POS / PRP$ / JJ / starting with N / starting with V / in the prep list. If so, replace its original label with NN.
[0197] Therefore, the positional terms involved in the judgment include: ① those whose original labels begin with N; ② those obtained by replacing VBG / VBN with NN.
[0198] ② Define the scope of "to". This is consistent with the use of "to" in positional verbs, and will not be elaborated further.
[0199] ③ Define limiting rules. Since the target word is not always immediately adjacent to the infinitive "to" in a position adjective + to clause, it is necessary to define limiting rules between the target word and "to". For example, if a label starting with "VB" and not "VBG / VBN" appears between the target word and "to", it will trigger a block and return "empty" as the recognition result for the target word, etc. Together, these form a summary of limiting rules for position noun + to clause.
[0200] 2) Special Rules:
[0201] Some positional nouns may appear in proper noun phrases, in which case they do not express a position and are not considered positional nouns even if they conform to grammatical rules. For example: ① result appears in as a result; ② news appears in news agency or news conference; ③ fact appears in in fact; ④ report appears in work report; ⑤ requirement appears in reserve requirement.
[0202] When the position noun is ['reason', 'reasons'] or ['report', 'reports', 'statement', 'statements'], a special exclusion rule is required, specifically:
[0203] ①The right side of reason / reasons cannot be immediately adjacent to why. In such cases, it is considered a clause introduced by why and does not belong to the type of position verb + to clause.
[0204] ②The word "in" or "at" cannot be in any of the four positions to the left of "report," "reports," "statement," or "statements." Otherwise, "report" will be considered a prepositional phrase and not a noun indicating a position.
[0205] 2.2.6 Position noun + that clause.
[0206] 1) General Rules:
[0207] ① Define the terminology of the position. 2.2.5 has already listed this, so it will not be repeated here.
[0208] ② Define the scope of "that". Slightly different from the position verb "that", because "that" is often marked as WDT (wh-determiner) in the position noun + that sentence pattern, the scope of the "that" label is extended to IN / WDT.
[0209] ③ Define limiting rules. In position nouns + that clauses, the target word is usually not immediately adjacent to "that". Therefore, it is necessary to define limiting rules between the target word and that_IN / WDT. For example, if a label starting with V appears between the target word and that, it will trigger a block and return "empty" as the recognition result for the target word, etc. Together, these form a summary of limiting rules for position nouns + that clauses.
[0210] 2) Special Rules:
[0211] There are also cases where "that" can be omitted when adding "that" to a position noun. Specific rules include, for example, if the target word is "reason / reasons" and the immediate word to the right is "why", then the "THATD" marker is skipped, etc.; these together constitute a summary of rules for omitting "that" when adding "that" to position nouns.
[0212] 3. Dataset labeling.
[0213] 3.1.1 Tag Naming:
[0214] First, we need to assign labels to each category of positional terms at different levels (including specific subcategories within the three main categories), as shown in Table 2, which lists some of the labels:
[0215] Table 2: Stance Coding Table
[0216]
[0217] 3.1.2 Position Marker Route File Integration:
[0218] Use the Python programming language to integrate the above content into a callable stance marker route file, named Stance Tagger 1.0. The specific process is as follows:
[0219] ① Use Stanford POS Tagger to segment and annotate the text of the article with the specified ID in database α, and obtain the original annotation results from Stanford;
[0220] ② Apply stance rules to perform secondary annotation on the same articles to obtain stance-related vocabulary in the corresponding categories;
[0221] ③ Replace the Stanford part-of-speech tags of the corresponding positional terms with positional tags, while leaving the tags of other non-positional terms unchanged. The final result is a hybrid annotation of Stanford tags and positional tags. The format can be referenced. Figure 2 As shown, blue labels are part-of-speech tags, and red labels are stance tags.
[0222] 3.1.3 Test rule accuracy:
[0223] To facilitate testing the accuracy of rule-based labeling, this embodiment developed a position labeling visualization system based on the Python programming language for testing; the final position term labeling based on the above rules achieved an average accuracy of approximately 95% after testing.
[0224] 3.1.4 Position Labeling Dataset;
[0225] The Stance Tagger 1.0 routing file is used to segment and annotate the main body of all articles in database α, resulting in a mixed annotation of basic part-of-speech tagging and stance tagging for each sentence, in a format such as "I_PRP will_PRSMD continue_VB to_TO do_VB that_DT."
[0226] After all sentences are labeled, a position labeling dataset β in standard JSON format is formed, which includes information such as sentences, vocabulary labels, timestamps, sentence indexes, news dates, and news sources.
[0227] 4. Machine learning training.
[0228] (1) Introduction to RoBERTa
[0229] This embodiment uses RoBERTa-Large (the largest parameter version of the RoBERTa model) as the base model for labeled training.
[0230] RoBERTa is a pre-trained model based on BERT, developed by Facebook AI Research. Building upon BERT, it significantly improves model performance through optimization of the pre-training process. By pre-training on a large-scale corpus, RoBERTa learns rich linguistic knowledge and semantic representations, enabling it to accurately understand the meaning of text and capture grammatical, semantic, and contextual information. Because it has accumulated a large amount of general-purpose linguistic knowledge during pre-training, even with only a small amount of task-specific labeled data, the model can effectively learn and adjust during fine-tuning, resulting in relatively accurate annotations.
[0231] (2) Model Training
[0232] ① Using the aforementioned position-labeled dataset β, the dataset is divided into three parts: 80% is the training set A, 10% is the validation set of A, and 10% is the test set B. The validation set is used to detect the learning effect of the model in each training round, facilitating parameter tuning.
[0233] ② The training set A was used as the data source for training the RoBERTa-Large model, allowing the model to learn from the annotation results. RobertaTokenizerFast was used to break sentences down into WordPieces, and each token (only the first word) was mapped to its corresponding label, with subsequent words ignored (-100). This sequence labeling task was then assigned to RobertaForTokenClassification, using cross-entropy to allow the model to learn how to predict rule-based labels (each token corresponding to a single label) on a large-scale corpus. Gradient accumulation, mixed precision, and learning rate warm-up were used during training to accommodate the memory requirements of RoBERTa-Large. The loss rate, accuracy, and F1 score were evaluated on the validation set for each epoch to adjust model parameters. Finally, the model was able to generate annotations consistent with expectations for sentences in the test set, achieving the transfer of existing knowledge to the model.
[0234] ③ Test the model performance using test set B (with existing labels removed). Perform a complete inference using the finely tuned RoBERTa-Large to obtain the predicted label for each token. Then compare the results with the existing annotations, and calculate the overall accuracy, macro / micro average F1, and precision and recall for each label to determine the transfer effect of the model in stance annotation. For labels with low recognition accuracy, train the model again on a new dataset until the model's annotation accuracy reaches over 98%. The model is then considered to have been successfully trained and named Stance Tagger 2.0 as a stance lexicon annotator.
[0235] 5. Stance labeling.
[0236] The stance tagger is used to complete the stance tagging of the English text to be analyzed.
[0237] The method implemented in this embodiment can construct an English text stance annotator, quickly and efficiently identify stance words, and analyze the stance tendency in the sentence by combining their position in the sentence, so as to achieve accurate annotation of the stance of English text.
[0238] Example 2:
[0239] This embodiment proposes an English text stance annotation system, including:
[0240] Part-of-speech tagging module: Obtains English text through data acquisition and generates part-of-speech tags for each word in the English text;
[0241] Rule building module: Based on the part-of-speech tags, and according to English syntax, contextual semantics and lexical characteristics, formulate position lexical tagging rules, and write code to obtain a rule-based position lexical tagger;
[0242] Dataset labeling module: Using the rule-based stance lexical labeler, stance labels are applied to English text that already contains part-of-speech tags to obtain a stance-labeled dataset;
[0243] Machine learning training module: Using the aforementioned stance labeling dataset, the RoBERTa-Large model is used as a base model for training to obtain a training-based stance vocabulary labeler, further improving the labeling accuracy;
[0244] Stance labeling module: The training-based stance lexical labeler is used to complete the stance labeling of the English text to be analyzed.
[0245] The part-of-speech preprocessing module includes:
[0246] This study collected English text corpora of news from mainstream foreign media and major domestic media outlets promoting foreign propaganda from a global news database. Duplicate filtering was performed on the collected text corpora, including extracting title prefixes using regular expressions and grouping them for deduplication, as well as performing parallel similarity matching with two rules to delete similar text. The filtered text was then cleaned. Regular expressions were used to segment the cleaned text into title, date, source, watermark information, and body text. Sentence segmentation logic was constructed using regular expressions, based on English punctuation and quotation mark rules, to divide the text into independent sentences. The Stanford POS Tagger was then used to tag the segmented sentences, obtaining part-of-speech tags for each word. A PostgreSQL database was constructed, containing fields for ID, title, source, date, body text, sentence segmentation results, and tags. The segmented content was written into the corresponding fields except for ID, with each data entry having a unique ID, forming the English text database.
[0247] The duplicate item filtering specifically includes:
[0248] Extracting and grouping title prefixes from text: Prefixes are extracted from the first line of the text using regular expressions; the text is grouped according to the extracted prefixes, and the number of texts and unique titles in each group is counted; only groups with more than one file are retained as candidates for deduplication; further filtering is performed on groups where all file titles are identical and the number of files is less than or equal to a set threshold, and subsequent content comparisons are conducted on the filtered groups; Parallel similarity matching using two rules: The complete similarity of each text content in the filtered groups is calculated. If it is greater than or equal to the set similarity threshold, it is determined to be similar text; if it is lower than the set similarity threshold, the first N characters are compared, and subset similarity is calculated. If the subset similarity is greater than or equal to the set subset similarity threshold, it is determined to be similar text; The matched similar texts are deleted, keeping only one copy.
[0249] Data cleaning includes:
[0250] Adjust the title format of the text to a standardized format; extract proper nouns from the text to form a proper noun dictionary; write a text formatting program to standardize the body content of the text; and use regular expressions to remove irrelevant content, including illegal characters and URL links.
[0251] The rule building module includes:
[0252] Simple Stance Vocabulary Tagging Unit: Modal verbs, semi-modal verbs, and stance adverbs are used as simple stance vocabulary, and the vocabulary definition is expanded; the simple stance vocabulary is judged and tagged by combining the word form of the target word with the part-of-speech tag.
[0253] Complex Stance Vocabulary Annotation Unit: Stance verbs, stance adjectives, and stance nouns that introduce complement clauses are designated as complex stance vocabulary; the identification types of complex stance vocabulary are summarized, and general and special rules are set for each identification type; the complex stance vocabulary is judged and annotated according to the identification type and its corresponding rules by combining the word form of the target word with the part-of-speech tag.
[0254] Complex stance term annotation units include:
[0255] Based on the positional verbs, positional adjectives, positional nouns, and their introduced complement clauses in English grammar, we can identify the recognition types of complex positional vocabulary, including: positional verb + to clause; positional verb + that clause; positional adjective + to clause; positional adjective + that clause; positional noun + to clause; and positional noun + that clause.
[0256] The system establishes general rules for each identification type, including: Lexical definition expansion: extending the variant forms of stance verbs / adjectives / nouns defined in the existing stance vocabulary to the corresponding levels for definition expansion; Definition of the effective scope of "to / that": defining the scope of part-of-speech tags used for judging complex stance vocabulary based on the various different part-of-speech tags corresponding to "to / that"; Definition of limiting rules: the limiting rules include triggering different judgment processes and results based on the different grammatical structures (including different words, part-of-speech tags, and punctuation) that exist between stance verbs / adjectives / nouns and "to / that".
[0257] Special rules are set for each identification type. These special rules include: based on the special cases of stance verbs / stance adjectives / stance nouns + to / that clauses that do not conform to the general rules but whose target words still belong to complex stance vocabulary, grammatical structures are set for the special cases.
[0258] The general and special rules also include part-of-speech tag correction rules, which determine whether the target word is mislabeled based on the surrounding tags. If it is mislabeled, the mislabeled part-of-speech tag is replaced with the correct part-of-speech tag.
[0259] The dataset annotation module includes:
[0260] Based on the definition of positional vocabulary and the sub-level division of positional inclination in the definition, position codes are set;
[0261] Based on the stated position tagging rules and position coding, a program is used to perform position tagging on English text that already contains part-of-speech tags, resulting in a position tagging dataset.
[0262] The machine learning training module includes:
[0263] The position labeling dataset is divided into a training set, a validation set, and a test set. The training set is used as the data source for training the RoBERTa-Large model, allowing the model to learn from the labeling results.
[0264] The sentence is split into WordPiece subwords using the RobertaTokenizerFast tokenizer, and the first subword of each word is used as a token, which is then mapped to the corresponding label of the word. The sequence labeling task is then assigned to the pre-trained model class RobertaForTokenClassification, which learns how to predict regular labels on a large-scale corpus through cross-entropy or multi-label loss. Gradient accumulation, mixed precision, and learning rate warm-up are used during training to adapt to the memory requirements of RoBERTa-Large. The model parameters are adjusted using a validation set, and the model performance is tested using a test set. The final trained model is used as a stance lexical labeler.
[0265] The English text stance annotation system proposed in this embodiment can achieve the English text stance annotation method in Embodiment 1 and has the same beneficial effects as Embodiment 1.
[0266] Example 3:
[0267] This embodiment proposes a visual retrieval and annotation system, which applies the English text stance annotation method described in Embodiment 1.
[0268] The described visual retrieval and annotation system uses a programming language to develop web pages with database visual retrieval and annotation functions. Its specific functions include... Figure 3 As shown, it includes:
[0269] I. Backend:
[0270] 1. Data:
[0271] First, English text data is collected, then the data is standardized, and the standardized data is used to build an English text database.
[0272] The data processing procedure is the same as in Example 1.
[0273] 2. Formulate the position labeling rules described in Example 1.
[0274] 3. Construct the rule-based position term tagger described in Example 1.
[0275] 4. Conduct machine learning simulation training.
[0276] 5. Through the above training, a training-based positional vocabulary labeler is obtained.
[0277] II. Front-end:
[0278] The system features a visual user interface that provides a database retrieval platform for searching English text databases, as well as a stance analysis system that uses a trained stance lexical annotator for stance lexical annotation and analysis.
[0279] The visual retrieval and annotation system proposed in this embodiment can realize the English text stance annotation method in Embodiment 1 and has the same beneficial effects as Embodiment 1.
[0280] The above-described embodiments are merely preferred embodiments of the present invention and are only used to help understand the method and core ideas of this application. The scope of protection of the present invention is not limited to the above embodiments, and all technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method for labeling stances in English text, characterized in that, include: S1. Part-of-speech preprocessing: Obtain English text through data collection and generate part-of-speech tags for each word in the English text; S2. Rule Construction: Based on the part-of-speech tags, formulate position lexical tagging rules according to English syntax, contextual semantics and lexical characteristics, and write code to obtain a rule-based position lexical tagger; The rules for labeling stance terms include: S201. Simple Stance Vocabulary Tagging: Modal verbs, semi-modal verbs, and stance adverbs are used as simple stance vocabulary, and the vocabulary definition is expanded; the simple stance vocabulary is judged and tagged by combining the word form of the target word with the part-of-speech tag. S202, Complex Stance Vocabulary Annotation: Stance verbs, stance adjectives, and stance nouns that introduce complement clauses are designated as complex stance vocabulary; the identification types of complex stance vocabulary are summarized, and general and special rules are set for each identification type; the complex stance vocabulary is judged and annotated according to the identification type and its corresponding rules by combining the word form of the target word with the part-of-speech tag. S3. Dataset labeling: Using the rule-based stance lexical labeler, the English text that already contains part-of-speech tags is labeled with stances to obtain a stance-labeled dataset. S4. Machine Learning Training: Using the aforementioned stance labeling dataset, train the RoBERTa-Large model as the base model to obtain a training-based stance vocabulary labeler, thereby improving labeling accuracy. S5. Stance Labeling: The stance labeling of the English text to be analyzed is completed using the training-based stance lexical labeler.
2. The method for labeling English text stance according to claim 1, characterized in that, Step S1 includes: S101. Collect English text corpora of domestic and international media news from global news databases; S102. Perform duplicate filtering on the collected text corpus, including extracting title prefixes using regular expressions and grouping them for deduplication, and performing parallel similarity matching with two rules to delete similar text. S103. Perform data cleaning on the text after filtering out duplicates; S104. Use regular expressions to segment the cleaned text content into several parts: title, date, source, watermark information, and body text. S105. Use regular expressions to construct sentence segmentation logic. Based on English punctuation and quotation mark rules, the text content is divided into independent sentences. Then, the Stanford POS Tagger is used to tag the segmented sentences to obtain the part-of-speech tag for each word. S106. Construct a PostgreSQL database, divided into ID, title, source, date, body, sentence segmentation result, and tag; write the segmented content into the corresponding fields except ID, with each data entry having a unique ID, forming an English text database.
3. The method for labeling English text stance according to claim 2, characterized in that, Step S102, the duplicate item screening, specifically includes: S102-1. Extracting and grouping the title prefixes of the text: Extract the prefixes from the first line title of the text using regular expressions; group the text according to the extracted prefixes, and count the number of texts and unique titles in each group; retain only the groups with more than 1 files as candidate deduplication objects; further filter out the groups in which all files have the same title and the number of files is less than or equal to the set threshold, and perform subsequent content comparison on the filtered groups. S102-2, Parallel Similarity Matching with Two Rules: Calculate the complete similarity of each text content in the filtered group. If it is greater than or equal to the set similarity threshold, it is determined to be similar text. If it is lower than the set similarity threshold, the first N characters are compared and subset similarity is calculated. If the subset similarity is greater than or equal to the set subset similarity threshold, it is determined to be similar text. Delete the matched similar text and keep only one copy.
4. The method for labeling English text stance according to claim 1, characterized in that, Step S202 includes: S202-1. Based on position verbs, position adjectives, position nouns, and their introduced complement clauses in English grammar, determine the identification types of complex positional vocabulary, including: Position verb + to clause; position verb + that clause; position adjective + to clause; position adjective + that clause; position noun + to clause; position noun + that clause; S202-2. Set general rules for each identification type, the general rules including: (1) Lexical definition expansion: Extend the inflected forms of the existing stance verbs / stance adjectives / stance nouns defined in the stance vocabulary to the corresponding level for definition expansion; (2) Definition of the scope of to / that: Based on the various different part-of-speech tags corresponding to to / that, the scope of part-of-speech tags used for judging complex stance words is defined; (3) Definition of limiting rules: The limiting rules include: triggering different judgment processes and results based on the different grammatical structures, including different words, parts of speech tags, and punctuation marks, between the position verb / position adjective / position noun and to / that; S202-3. Set special rules for each identification type. The special rules include: setting grammatical structure judgment rules for special cases where the target word is still a complex position word but does not conform to the general rules contained in the position verb / position adjective / position noun + to / that clause.
5. The method for labeling English text stance according to claim 4, characterized in that, The general and special rules also include part-of-speech tag correction rules, which determine whether the target word is mislabeled based on the surrounding tags. If it is mislabeled, the mislabeled part-of-speech tag is replaced with the correct part-of-speech tag.
6. The method for labeling English text stance according to claim 1, characterized in that, Step S3 includes: S301. Based on the definition of position vocabulary and the division of sub-levels expressing position in the definition, set position codes; S302. Based on the stated position tagging rules and position codes, programmatically perform position tagging on English text that already contains part-of-speech tags to obtain a position tagging dataset.
7. The method for labeling English text stance according to claim 1, characterized in that, Step S4 includes: The position labeling dataset is divided into a training set, a validation set, and a test set. The training set is used as the data source for training the RoBERTa-Large model, allowing the model to learn from the labeling results. The sentence is split into WordPiece subwords using the RobertaTokenizerFast tokenizer, and the first subword of each word is used as a token, which is then mapped to the corresponding label of the word. The labeling task is then assigned to the pre-trained model class RobertaForTokenClassification, which learns how to predict rule labels on a large-scale corpus through cross-entropy or multi-label loss. Gradient accumulation, mixed precision, and learning rate warm-up are used during training to adapt to the memory requirements of RoBERTa-Large. The model parameters are adjusted using a validation set, and the model performance is tested using a test set. The final trained model is used as a stance word labeler.
8. An English text stance annotation system, characterized in that, include: Part-of-speech tagging module: Obtains English text through data acquisition and generates part-of-speech tags for each word in the English text; Rule building module: Based on the part-of-speech tags, and according to English syntax, contextual semantics and lexical characteristics, formulate position lexical tagging rules, and write code to obtain a rule-based position lexical tagger; The rules for labeling positional vocabulary include: Simple positional vocabulary labeling: Modal verbs, semi-modal verbs, and positional adverbs are designated as simple positional vocabulary, and their definitions are expanded; simple positional vocabulary is judged and labeled by combining the word form of the target word with the part-of-speech tag; Complex positional vocabulary labeling: Positional verbs, positional adjectives, and positional nouns that introduce complement clauses are designated as complex positional vocabulary; the identification types of complex positional vocabulary are summarized, and general and special rules are set for each identification type; complex positional vocabulary is judged and labeled according to the identification type and its corresponding rules by combining the word form of the target word with the part-of-speech tag. Dataset labeling module: Using the rule-based stance lexical labeler, stance labels are applied to English text that already contains part-of-speech tags to obtain a stance-labeled dataset; Machine learning training module: Using the aforementioned stance labeling dataset, the RoBERTa-Large model is used as a base model for training to obtain a training-based stance vocabulary labeler, thereby improving labeling accuracy; Stance labeling module: The trained stance lexical labeler is used to label the English text to be analyzed with stance.
9. A visual retrieval and annotation system, wherein the visual retrieval and annotation system is developed using a programming language to create web pages with database visual retrieval and annotation functions, characterized in that, The English text stance annotation method as described in any one of claims 1-7 is applied.
Citation Information
Patent Citations
Movie comment viewpoint emotion tendency analysis method
CN110825876A
Station detection method, device and system based on combination of prompt learning and external knowledge
CN116662807A