Text material generation method and device, electronic equipment and computer program
By generating a hierarchical dynamic vocabulary database and constructing a hierarchical-question type sparse matrix, combined with graph neural networks and out-of-syllabus detection rules, the problem of insufficient cross-level synonym association and question type adaptation in existing technologies is solved, realizing efficient and accurate generation of text materials and meeting the flexibility and accuracy requirements of different exam levels.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING CENTURY TAL EDUCATION TECH CO LTD
- Filing Date
- 2026-01-08
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies cannot dynamically associate synonyms across levels when generating text materials, leading to misjudgments or omissions in out-of-syllabus detection. The selection of question types and vocabulary difficulty lacks dynamic adaptation, and the semantic rationality of the content is not quantitatively evaluated. As a result, the generated text materials are difficult to meet the accuracy and flexibility requirements of different exam levels.
By classifying vocabulary based on the original vocabulary database and exam parameters and attaching grammatical tags, a hierarchical dynamic vocabulary database is generated. The hierarchical synonyms are associated with the classified vocabulary, a hierarchical-question type sparse matrix is constructed, and a graph neural network is used to calculate the semantic energy value of the slots to optimize the filling process. The target text material is generated by combining the out-of-syllabus detection execution rules.
It achieves dynamic association of synonyms across levels, improves the accuracy of out-of-syllabus detection, dynamically binds question types and vocabulary difficulty, enhances the quality detection dimensions of text materials, ensures that the generated text materials meet multiple quality requirements in terms of difficulty, format and logic, and improves detection efficiency and accuracy.
Smart Images

Figure CN121480458B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of text processing, and more particularly to methods, apparatus, electronic devices, and computer programs for generating text materials. Background Technology
[0002] In the field of educational assessment, the need for automated generation of text materials such as standardized test questions, classroom quizzes, and online learning platform exercises is becoming increasingly urgent. Especially for standardized tests at different levels, such as tiered tests for different age groups or language proficiency levels, it is essential to ensure that the generated text materials are highly matched to the target test standards in terms of vocabulary difficulty, question type suitability, and scenario logic, in order to meet the application needs of large-scale test creation, personalized teaching support, and efficient question bank construction.
[0003] Currently, there is a text material generation scheme in the relevant technical field. This scheme stores vocabulary for different exam levels by pre-setting a fixed vocabulary hierarchy list, selects the corresponding question type based on a manually defined question type rule base, fills the text content with static template slots, and finally completes the quality check by verifying whether the text length matches the fixed list one by one.
[0004] However, the methods described above rely on fixed tiered vocabulary lists, making it impossible to dynamically associate synonyms across different levels. Furthermore, the detection of out-of-syllabus content depends solely on direct matching between vocabulary and the fixed list, which can easily lead to misjudgments or omissions. At the same time, the selection of question types and vocabulary difficulty lack a dynamic adaptation mechanism, and the semantic rationality of the content is not quantitatively evaluated during the slot filling process. This can result in the generated text materials having issues such as mismatch between vocabulary difficulty and question types, and logical contradictions in the content, making it difficult to meet the requirements of different exam levels for the accuracy and flexibility of the text materials. Summary of the Invention
[0005] This application provides a method, apparatus, electronic device, and computer program for generating text materials, aiming to maximize the matching degree between vocabulary difficulty and question types in the generated text materials, and to meet the requirements of different examination levels for the accuracy and flexibility of text materials.
[0006] To solve the above technical problems,
[0007] On the one hand, embodiments of this application provide a method for generating textual materials, including:
[0008] Based on the original vocabulary database and exam parameters, the vocabulary is classified and grammatical tags are attached. Then, the synonyms of the classified vocabulary are associated to generate a hierarchical dynamic vocabulary database. Based on the hierarchical dynamic vocabulary database, the out-of-syllabus detection process of the text to be tested is preset to generate out-of-syllabus detection execution rules.
[0009] Based on the exam parameters and the hierarchical dynamic vocabulary database, a hierarchical-question type sparse matrix is constructed. The effective question type combinations are extracted from the hierarchical-question type sparse matrix through bitwise operations to generate the question type configuration results.
[0010] Based on the question type configuration results, a scenario constraint graph is constructed, and the out-of-syllabus detection execution rules are called to filter out non-out-of-syllabus words. The slot semantic energy value of non-out-of-syllabus words is calculated by combining graph neural network to optimize filling and generate slot filling results.
[0011] Based on the hierarchical dynamic vocabulary library, the out-of-scope detection execution rules are invoked to perform out-of-scope detection on the words in the slot filling results, and length and scene consistency detection are performed simultaneously. The target text material is generated based on the detection results.
[0012] On the other hand, a device for generating textual material is provided, comprising:
[0013] The vocabulary rule generation module is used to classify words and attach grammatical tags based on the original vocabulary database and exam parameters. Then, it associates the synonyms of the classified words to generate a hierarchical dynamic vocabulary database. Based on the hierarchical dynamic vocabulary database, it presets the out-of-syllabus detection process of the text to be tested and generates out-of-syllabus detection execution rules.
[0014] The configuration result acquisition module is used to construct a level-question type sparse matrix based on the exam parameters and the hierarchical dynamic vocabulary library, extract effective question type combinations from the level-question type sparse matrix through bitwise operations, and generate question type configuration results.
[0015] The slot filling module is used to construct a scenario constraint graph based on the question type configuration results, and call the out-of-syllabus detection execution rules to filter out non-out-of-syllabus words. It also uses graph neural networks to calculate the slot semantic energy value of non-out-of-syllabus words to optimize filling and generate slot filling results.
[0016] The text material generation module is used to perform out-of-scope detection on the words in the slot filling result based on the hierarchical dynamic vocabulary library, call the out-of-scope detection execution rules, simultaneously perform length and scene consistency detection, and generate target text material based on the detection results.
[0017] On the other hand, a computer device is provided, the device including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the method for generating textual material as described above.
[0018] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored therein, the at least one instruction or the at least one program being loaded and executed by a processor to implement the method for generating text material as described above.
[0019] On the other hand, a computer program is provided that includes computer instructions, which, when executed by a processor, implement the method for generating textual material as described above.
[0020] The beneficial effects of this application are as follows:
[0021] 1. Existing solutions rely on fixed, hierarchical vocabulary lists and judge out-of-syllabus content solely through direct matching, failing to associate cross-level synonyms and prone to misjudgments or omissions. This application proposes a solution that "based on the original vocabulary database and exam parameters, classifies vocabulary by level and adds grammatical tags, associates synonyms of the classified vocabulary, generates a hierarchical dynamic vocabulary database, and generates out-of-syllabus detection execution rules based on a pre-set out-of-syllabus detection process in this vocabulary database." The hierarchical dynamic vocabulary database, by associating cross-level synonyms, breaks the hierarchical isolation of fixed lists, allowing out-of-syllabus detection to refer to the hierarchical attributes of synonyms. Compared to existing solutions that rely solely on single-word matching, this provides a more comprehensive coverage of vocabulary relationships. Furthermore, the out-of-syllabus detection execution rules are pre-set based on the hierarchical dynamic vocabulary database, allowing subsequent steps to directly call these rules. Compared to existing solutions that "only verify each word at the end," this achieves a unified standard for the entire out-of-syllabus detection process, reducing misjudgments caused by delayed detection timing or inconsistent standards, and making the out-of-syllabus judgment more reasonable than existing solutions.
[0022] 2. Existing solutions select question types based on a manually defined, fixed question type rule base, without considering vocabulary difficulty, which easily leads to a mismatch between question types and the vocabulary difficulty of the target exam level. This application proposes a solution that "constructs a level-question type sparse matrix based on exam parameters and a hierarchical dynamic vocabulary base, and extracts effective question type combinations from the matrix through bitwise operations to generate question type configuration results." The construction of the level-question type sparse matrix is directly linked to exam parameters and the hierarchical dynamic vocabulary base, clearly defining the target level and the vocabulary difficulty range for that level. This ensures that the question types for each level in the matrix match the vocabulary difficulty of that level. Compared to existing solutions where "question type rules are not related to vocabulary difficulty," this achieves dynamic binding between question types and vocabulary difficulty. Furthermore, by extracting effective question type combinations through bitwise operations, compared to existing solutions that "manually adjust the question type rule base," this approach can quickly respond to changes in exam parameters and generate question type combinations adapted to the current vocabulary difficulty. The adaptation efficiency between question types and vocabulary difficulty is higher than existing solutions, and the accuracy of the adaptation is more in line with the requirements of the target exam level.
[0023] 3. Existing solutions only check text length and word matching one by one, resulting in a single detection dimension and low efficiency. This application proposes a solution that "based on the hierarchical dynamic vocabulary library, calls the out-of-scope detection execution rules to perform out-of-scope detection on words in the slot filling results, simultaneously performs length and scene consistency detection, and generates target text materials based on the detection results." This solution simultaneously performs out-of-scope, length, and scene consistency detection, which is more comprehensive than the existing solution's "single-dimensional, one-by-one detection," covering multiple quality requirements of text materials in terms of difficulty, format, and logic. The out-of-scope detection reuses the out-of-scope detection execution rules and hierarchical dynamic vocabulary library generated in the first step, avoiding redundant definition of detection standards. Compared with the existing solution's "detection without a reuse mechanism," the detection efficiency is higher, and the detection standards are unified throughout the entire process, resulting in better quality stability of the generated target text materials than existing solutions. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a schematic diagram of the overall process of a method for generating text materials provided in an embodiment of this application;
[0026] Figure 2 A schematic diagram illustrating the execution flow of a method for generating text materials provided in an embodiment of this application;
[0027] Figure 3 This is a hardware structure block diagram of an electronic device for a method of generating text materials, as provided in an embodiment of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0029] Reference Figure 1 and Figure 2 A method for generating textual materials, comprising:
[0030] Based on the original vocabulary database and exam parameters, the vocabulary is classified and grammatical tags are attached. Then, the synonyms of the classified vocabulary are associated to generate a hierarchical dynamic vocabulary database. Based on the hierarchical dynamic vocabulary database, the out-of-syllabus detection process of the text to be tested is preset to generate out-of-syllabus detection execution rules.
[0031] Based on the exam parameters and the hierarchical dynamic vocabulary database, a hierarchical-question type sparse matrix is constructed. The effective question type combinations are extracted from the hierarchical-question type sparse matrix through bitwise operations to generate the question type configuration results.
[0032] Based on the question type configuration results, a scenario constraint graph is constructed, and the out-of-syllabus detection execution rules are called to filter out non-out-of-syllabus words. The slot semantic energy value of non-out-of-syllabus words is calculated by combining graph neural network to optimize filling and generate slot filling results.
[0033] Based on a hierarchical dynamic vocabulary library, the out-of-scope detection execution rules are invoked to perform out-of-scope detection on the words in the slot filling results, and length and scene consistency detection are performed simultaneously. The target text material is then generated based on the detection results.
[0034] Specifically, the process of generating a hierarchical dynamic vocabulary database and implementing rules for exceeding the syllabus is as follows: First, obtain the original vocabulary database and exam parameters. The original vocabulary database contains all the basic vocabulary to be processed, and the exam parameters include the target exam level, such as a beginner exam for teenagers, an intermediate exam for adults, etc., as well as information such as the range of vocabulary difficulty. Based on the original vocabulary database and exam parameters, perform multi-granular hierarchical processing on the vocabulary in the original vocabulary database. For example, according to the vocabulary difficulty requirements of different levels in the exam parameters, the vocabulary is divided into sub-vocabulary sets corresponding to the exam level, and each hierarchical word is... Each entry is accompanied by an additional grammatical tag, which identifies the grammatical attributes of the entry. A doubly linked list is used to associate synonyms with the tiered vocabulary. Specifically, for each tiered vocabulary, a bidirectional linking relationship is established between the vocabulary and its synonyms in the doubly linked list, forming a cross-level vocabulary network. This cross-level vocabulary network enables rapid lookup and association of synonyms across different exam levels. The results of multi-granularity tiered processing, grammatical tags, and the cross-level vocabulary network are integrated to generate a hierarchical dynamic vocabulary database. This hierarchical dynamic vocabulary database stores the vocabulary corresponding to each exam level, the grammatical tags of the vocabulary, and the synonym associations.
[0035] Next, based on the hierarchical dynamic vocabulary, a pre-defined out-of-scope detection process for the text to be tested is established: First, a real-time word segmentation and part-of-speech tagging process is set for the text to be tested, that is, the text to be tested is split into independent words according to the pre-defined word segmentation rules, and the part of speech of each word is labeled, such as noun, verb, etc.; then, after the text to be tested is executed through the real-time word segmentation and part-of-speech tagging process, the rules of the current level hash table in the hierarchical dynamic vocabulary are pre-defined, where the current level hash table is the vocabulary storage structure corresponding to the target exam level in the hierarchical dynamic vocabulary. The key of the hash table is the word, and the value is the grammatical tag and synonym association information of the word. Pre-matching this hash table can quickly determine whether the word belongs to the target exam level; then, for words that do not match the current level hash table in the hierarchical dynamic vocabulary, a pre-trained bidirectional encoder representation language model is used. The BERT Transformers algorithm initiates a word vector backtracking process, which involves converting unmatched words into word vectors and querying a hierarchical dynamic vocabulary for words semantically similar to these vectors. Finally, it sets a similarity criterion between the unmatched words and words at any level higher than the current level in the hierarchical dynamic vocabulary. For example, it calculates the cosine similarity between the unmatched word vector and the higher-level word vectors, sets a similarity threshold, and integrates the word vector backtracking process with this similarity criterion to generate an out-of-scope detection execution rule. This rule is used to determine whether the words in the text being tested exceed the target exam level.
[0036] The process of generating question type configuration results is as follows: First, obtain the exam parameters and a hierarchical dynamic vocabulary database. Based on the exam parameters, determine the target question types corresponding to each exam level. For example, the target question types corresponding to the beginner exam are vocabulary selection questions and short sentence reading comprehension questions, while the target question types corresponding to the intermediate exam are long passage reading comprehension questions and writing questions. Combined with the hierarchical dynamic vocabulary database, determine the vocabulary difficulty adaptation range of the target question types corresponding to each exam level. That is, based on the difficulty attributes of the vocabulary of each exam level in the hierarchical dynamic vocabulary database, determine the exam level range to which the vocabulary that can be used in each target question type belongs. For example, the vocabulary selection questions of the beginner exam can only use vocabulary from the beginner exam level.
[0037] Based on the mapping relationship between each exam level and the corresponding target question type and vocabulary difficulty range, a level-question type sparse matrix is constructed. The rows of this matrix represent the exam level, such as row 1 representing the elementary exam and row 2 representing the intermediate exam. The columns represent all selectable question types, such as column 1 representing vocabulary multiple choice questions and column 2 representing short sentence reading comprehension questions. The elements at the intersection of the matrix take the value of "1" or "0". "1" indicates that the corresponding exam level is compatible with the question type and the vocabulary difficulty of the question type is within the vocabulary difficulty range. "0" indicates that the corresponding exam level is not compatible with the question type or the vocabulary difficulty does not meet the requirements. At the same time, this sparse matrix supports hot-loading configuration, that is, without recompiling the system, the adaptation relationship between the exam level and the question type can be updated by modifying the values of the matrix elements.
[0038] A bitwise AND operation is performed on the question type identifiers corresponding to the values representing "enabled" in the level-question type sparse matrix. A value of "1" indicates that the question type is enabled. Question type identifiers that match the current exam level are then filtered. For example, if the current exam level is the beginner level, a bitwise AND operation is performed on the question type identifiers corresponding to the columns with a value of "1" in the corresponding row of that level. All question type identifiers that meet the criteria are retained. Based on the question type rules corresponding to the filtered question type identifiers, a question type configuration result is generated. This question type configuration result includes all question types that are suitable for the current exam level and the specific rules for each question type, such as the number of questions and the percentage of marks.
[0039] Next, the process of generating the slot filling results is as follows: First, obtain the question type configuration results, and determine the scenario requirements for generating the text based on the question type configuration results. For example, if the question type configuration results include writing questions, the scenario requirements for generating the text are short essays that conform to daily communication scenarios or academic scenarios. Combined with scenario knowledge, such as common expressions in daily communication scenarios and the standard usage of professional terms in academic scenarios, construct a constraint relationship graph of scenario-intention-role. In this graph, the "Scenario" node includes scenario types such as daily communication and academic, the "Intention" node includes intention types such as information notification and request for help, and the "Role" node includes role types such as student, teacher, and doctor. The nodes are connected by directed edges to represent the constraint relationship. For example, the "Daily Communication Scenario" node points to the "Information Notification Intention" node, indicating that daily communication scenarios often include information notification intentions. At the same time, determine the required slots and mutual exclusion rules. For example, the required slots corresponding to "Daily Communication Scenario - Information Notification Intention" are "Time Slot" and "Location Slot". The mutual exclusion rule is that "Academic Terminology Slot" and "Daily Communication Scenario" cannot exist at the same time.
[0040] The system invokes out-of-syllabus detection rules to perform out-of-syllabus detection on candidate words to be filled into slots. This involves determining whether candidate words exceed the current exam level based on the out-of-syllabus detection rules and filtering out non-out-of-syllabus words. Semantic relationships between slots corresponding to non-out-of-syllabus words are modeled using a Graph Neural Network (GNN). Each slot corresponding to a non-out-of-syllabus word is treated as a graph node, and semantic relationships between slots, such as the relationship between a "time slot" and a "location slot" representing the time and location of an event, are treated as graph edges. The semantic matching score between each node and other nodes is calculated using the message passing mechanism of the GNN, and a weighted sum is obtained to obtain the coherence energy. This coherence energy reflects the degree of semantic coherence between slots. Finally, the system checks the logical constraints between slots corresponding to non-out-of-syllabus words and other filled slots. For example, if the "time slot" is filled with "May 2024", ... The "Location Slot" is filled with "School". The system checks whether the two are logically consistent, such as whether the school is operating normally at that time. The context energy is obtained based on the degree of constraint satisfaction. The higher the degree of constraint satisfaction, the higher the context energy. The frequency of each non-out-of-syllabus word in the historical slot filling data is counted. The frequency is normalized by converting the frequency value to a value between 0 and 1. Then, it is combined with the preset weight to calculate the frequency energy. Words with excessive frequency correspond to lower frequency energy to avoid the slot filling content being too monotonous. The coherence energy, context energy and frequency energy are integrated according to the set weight to calculate the slot semantic energy value.
[0041] The filling order and combination of non-overhead vocabulary are optimized based on the semantic energy value of the slots, prioritizing the selection of non-overhead vocabulary combinations with higher semantic energy values for filling. At the same time, the completeness of required slots is checked. If any required slots are missing, such as the "time slot" not being filled, the slot is automatically filled based on scenario knowledge and non-overhead vocabulary. Through the above processing, a slot filling result is generated, which includes the non-overhead vocabulary and complete semantic logic content corresponding to each slot.
[0042] Finally, the process for generating the target text material is as follows: First, obtain the slot filling results, call the out-of-scope detection execution rules on the slot filling results, and perform out-of-scope detection in combination with the hierarchical dynamic vocabulary library. That is, according to the out-of-scope detection execution rules, first match the current level hash table in the hierarchical dynamic vocabulary library. If no words are matched, filter out the out-of-scope words in the slot filling results through word vector backtracking and similarity judgment, and record the position and number of out-of-scope words.
[0043] Synchronous length detection is performed, which checks whether the text length of the slot filling result meets the set length requirements. The set length requirements are determined based on the exam parameters and question type configuration results. For example, the text length requirement for writing questions is 300-500 words. If the text length of the slot filling result exceeds or falls short of this range, the length deviation information is recorded.
[0044] Synchronous execution of scene consistency detection: First, a lightweight bidirectional encoder representation from transformers (Lightweight BERT) model is trained. The input layer of this model receives text generation prompts and slot filling results. The text generation prompts include the scene requirements for text generation, such as "a short text for daily communication scenarios". The hidden layer of the model captures the semantic association between the text generation prompts and the slot filling results through an attention mechanism and calculates the degree of semantic matching between the two. The output layer of the model outputs the logical matching degree, which is used to reflect the consistency between the slot filling results and the scene requirements of the text generation prompts. The higher the logical matching degree, the better the scene consistency.
[0045] The target text material is generated based on the detection results of out-of-syllabus detection, length detection, and scene consistency detection. The process involves determining whether all three detection results meet the standards. If the number of out-of-syllabus words is 0, the text length is within the set range, and the logical matching degree reaches the set threshold, the slot filling result is directly used as the target text material. If any detection result does not meet the standards, a differential prompt is automatically generated, containing information about the reason for the detection failure, such as "There are 3 out-of-syllabus words: XX, XX, XX" or "The text length is only 200 characters; 100-300 characters need to be added." Based on the differential prompt, the slot filling result is adjusted, such as replacing out-of-syllabus words with non-out-of-syllabus words or adding text content. Then, the out-of-syllabus detection, length detection, and scene consistency detection are re-executed.
[0046] Meanwhile, an exponential backoff strategy is adopted to limit the number of retries: an initial retry interval is set, such as 1 second, and a maximum number of retries is set, such as 3 times; after each adjustment of the slot filling result, the test is repeated. If the test still does not meet the standard, the retry interval is increased exponentially, such as 2 times, that is, the second retry interval is 2 seconds, and the third retry interval is 4 seconds; when the number of retries reaches the maximum number of retries or the retry interval exceeds the preset maximum interval, such as exceeding 10 seconds, the retries are stopped. If the test meets the standard at this time, the adjusted slot filling result is used as the target text material, and the target text material is finally generated.
[0047] Existing solutions use static template slot filling, which does not evaluate the semantic rationality of the content and is prone to logical contradictions. This application proposes a solution that "constructs a scenario constraint graph based on the question type configuration results, calls out-of-syllabus detection rules to filter out non-out-of-syllabus words, combines graph neural networks to calculate the slot semantic energy value of non-out-of-syllabus words to optimize filling, and then completes the slot filling result through conflict detection": The scenario constraint graph is constructed based on the question type configuration results, which clarifies the mandatory and mutually exclusive rules of the slots and defines the boundaries of the filling content from the perspective of scenario logic. Compared with the existing solution of "static filling without scenario constraints", it reduces the logical conflicts of the slot content; the combination of graph neural network to calculate the slot semantic energy value to optimize filling, through quantitative evaluation of the semantic association between slots, such as coherence energy and context energy, makes the semantic matching degree of the filling content higher than the existing solution of "filling without quantitative evaluation"; the conflict detection and completion step further verifies the filling result and automatically fills in the missing mandatory slots. Compared with the existing solution of "no conflict handling after filling", it further reduces the logical contradictions of slot filling, and the generated filling content is more logically consistent with the scenario requirements of the text material.
[0048] Optionally, vocabulary is classified and grammatical tags are attached. Then, synonyms of the classified vocabulary are associated to generate a hierarchical dynamic vocabulary database. This includes: performing multi-granularity classification processing on vocabulary based on the original vocabulary database and test parameters, attaching grammatical tags to each classified entry; associating synonyms of the classified vocabulary through a doubly linked list to form a cross-level vocabulary network; and integrating the results of multi-granularity classification processing, grammatical tags, and cross-level vocabulary network to generate a hierarchical dynamic vocabulary database.
[0049] Specifically, the process begins by acquiring the original vocabulary database and exam parameters. The original vocabulary database is a dataset storing the basic vocabulary to be processed, containing basic information such as spelling and basic definitions. The exam parameters include the hierarchical division of the target exam system, such as primary school, junior high school, and senior high school levels, and corresponding vocabulary difficulty indicators for each level, such as word frequency and grammatical complexity. Based on the original vocabulary database and exam parameters, the difficulty attributes of each word in the original vocabulary database are extracted. This is done by querying a vocabulary frequency database, such as vocabulary usage frequency data based on large-scale corpus statistics, and analyzing the grammatical structure of the words, such as whether they contain complex tense changes or are polysyllabic words, to obtain the difficulty attribute data for each word.
[0050] Based on difficulty attribute data, vocabulary is processed using a multi-granularity hierarchical method: The first granularity is based on exam level, assigning vocabulary to corresponding exam level subsets. For example, frequently used and grammatically simple words like "apple" and "book" are assigned to the elementary school level subset, while less frequently used and grammatically complex words like "analysis" and "consequence" are assigned to the high school level subset. The second granularity, within each exam level subset, is further divided according to the grammatical type of the vocabulary, such as nouns, verbs, and adjectives, forming a two-level subset of level-grammatical type. Through this multi-granularity hierarchical processing, a multi-granularity hierarchical result is obtained, which clearly defines the exam level and grammatical type to which each word belongs.
[0051] For each categorized term in the multi-granularity hierarchical result, its grammatical features are extracted, such as verb tense forms and noun singular / plural forms. A grammatical tag is then attached to each categorized term to identify its specific grammatical attributes. For example, the verb "write" in the high school passage set is tagged with a grammatical tag containing "verb - base form write - past tense write - past participle written". Through this process, a multi-granularity hierarchical vocabulary set with grammatical tags is obtained, providing foundational data for subsequently constructing a cross-level vocabulary network.
[0052] Next, a multi-granularity hierarchical vocabulary set with grammatical tags is obtained. For each word in this set, a synonym query is performed based on a pre-built synonym association database. This database is constructed based on semantic similarity calculations from a large-scale text corpus and stores the synonym relationships and semantic similarity values between words. For each word, words with semantic similarity reaching a set threshold are selected from the synonym association database to form synonym groups for that word. For example, synonym groups for "big" include "large" and "huge," with "large" specifically belonging to the junior high school level and "huge" to the senior high school level.
[0053] Based on a set of synonyms and multi-granularity hierarchical vocabulary with grammatical tags, a doubly linked list is used to connect the synonyms of the hierarchical vocabulary: a doubly linked list node is created for each word, and each node stores the word itself, its corresponding grammatical tag, and the exam level information; for words in the same synonym group, a bidirectional pointer relationship is established between their corresponding doubly linked list nodes. Taking "big" corresponding to the primary school level and "large" corresponding to the junior high school level as an example, a forward pointer to the "large" node is added to the "big" node, and a reverse pointer to the "big" node is added to the "large" node; if "large" is also a synonym for "huge" corresponding to the senior high school level, a forward pointer to the "huge" node is added to the "large" node, and a reverse pointer to the "large" node is added to the "huge" node.
[0054] Through the aforementioned doubly linked list operations, a cross-level vocabulary network is formed. The core feature of this network is that it can trace back to other words at different exam levels in the same synonym group through any word node along the bidirectional pointers. Moreover, each node carries the grammatical label and level information of the word. This is different from the traditional technical solution that only associates synonyms within a single level. It solves the problem of missing semantic associations between words across levels in the traditional solution and provides data support for tracing the level of synonyms during subsequent out-of-syllabus testing.
[0055] Next, we obtain multi-granularity hierarchical results, grammatical tags, and cross-level vocabulary networks. We first integrate the multi-granularity hierarchical results and grammatical tags, binding the multi-granularity hierarchical information of each word, such as exam level and grammar type, with the corresponding grammatical tags to form basic data units of "vocabulary-hierarchical information-grammatical tags", such as "write-high school level-verb-infinitive write-past tense write-past participle written".
[0056] The basic data units are integrated with a cross-level vocabulary network: the corresponding basic data units are embedded in each doubly linked list node of the cross-level vocabulary network, so that each node not only stores the word itself, but also fully contains the word's hierarchical information and grammatical tags; at the same time, an index structure is built for the cross-level vocabulary network, with the word's spelling as the primary key and the index value being the address of the doubly linked list node corresponding to the word. Through this index structure, the node position of any word in the cross-level vocabulary network can be quickly located, improving the efficiency of word query and association.
[0057] A dynamic update mechanism is configured for the integrated cross-level vocabulary network: Word update trigger conditions are set, such as the input of new words or adjustments to the level difficulty indicators in the exam parameters. When the trigger conditions are met, the system automatically performs the aforementioned multi-granularity hierarchical classification and grammatical tag attachment operations on the new words. Then, through the addition of doubly linked list nodes and pointer associations, the new words are integrated into the cross-level vocabulary network. Simultaneously, for words whose level affiliation changes due to adjustments in exam parameters, the hierarchical information in their nodes is automatically updated, and the pointer associations of related synonym nodes are adjusted to ensure that the cross-level vocabulary network always remains adapted to the exam parameters. Through the above integration and configuration, a hierarchical dynamic vocabulary database is generated. This database contains both the hierarchical and grammatical attributes of words, and possesses cross-level semantic association and dynamic update capabilities. It can directly provide data support for the generation of subsequent out-of-syllabus detection execution rules and the construction of a level-question type sparse matrix.
[0058] Optionally, the process of attaching grammatical tags includes: based on the grammatical attributes of the vocabulary, performing verb tense tagging and noun singular / plural tagging on each categorized entry; and attaching the verb tense tagging results and noun singular / plural tagging results as grammatical tags to the corresponding entries.
[0059] Specifically, the process first obtains a hierarchical vocabulary set and a pre-built grammatical attribute knowledge base. The hierarchical vocabulary set is a vocabulary dataset that has undergone multi-granular hierarchical processing, and each vocabulary entry carries information about its corresponding exam level. The grammatical attribute knowledge base includes two core sub-bases: a verb tense rule base and a noun singular / plural rule base. The verb tense rule base stores the basic tense changes of different verbs and their corresponding rules, while the noun singular / plural rule base stores the singular to plural changes of different nouns and their corresponding rules. Verbs include regular and irregular verbs, basic tense changes such as simple present tense and simple past tense, and names include regular and irregular nouns.
[0060] Based on the grammatical attribute knowledge base, the grammatical type of each entry in the hierarchical vocabulary set is first determined: by comparing the feature identifiers of verbs and nouns in the grammatical attribute knowledge base, such as verbs often being able to be paired with "to" to form infinitives and nouns often being able to be paired with quantifiers "a / an", the grammatical type of each entry is determined, resulting in a vocabulary-grammatical type correspondence table. This correspondence table clarifies whether each hierarchical entry belongs to a verb or a noun. When determining the grammatical type of each entry, it is only determined to be a verb or a noun, which is in line with the core grammatical requirements in the generation of exam text materials.
[0061] For entries identified as verbs in the term-grammar type correspondence table, the verb tense rule library in the grammar attribute knowledge base is invoked to perform verb tense annotation for each verb entry: First, it is identified whether the verb entry is a regular or irregular verb. Regular verbs, such as "work" and "play," conform to the rule of adding "-ed" to form the past tense, while irregular verbs, such as "go" and "eat," do not have fixed change rules. For regular verbs, their basic tense change forms are generated according to the rules in the verb tense rule library, such as the third-person singular form of the simple present tense, the simple past tense, and the present participle form. For irregular verbs, their preset basic tense change forms are directly retrieved from the verb tense rule library. The verb entries and their corresponding basic tense change forms are associated and recorded to obtain the verb tense annotation results, which clearly define the complete tense change information of each verb entry.
[0062] For entries identified as nouns in the noun-grammar type correspondence table, the noun singular / plural rule library in the grammar attribute knowledge base is invoked to perform noun singular / plural annotation on each noun entry: First, it is identified whether the noun entry is a regular or irregular noun. Regular nouns, such as "book" and "pen," conform to the rule of adding "-s" to form the plural, while irregular nouns, such as "child" and "mouse," do not have fixed rules for changing. For regular nouns, their plural forms are generated according to the rules in the noun singular / plural rule library. For irregular nouns, their preset plural forms are directly retrieved from the noun singular / plural rule library. The noun entries and their corresponding plural forms are associated and recorded to obtain the noun singular / plural annotation result, which clarifies the singular and plural form information of each noun entry.
[0063] Next, the verb tense tagging results, noun singular / plural tagging results, and the hierarchical term set are obtained. First, the verb tense tagging results and noun singular / plural tagging results are standardized in format, converting both types of tagging results into a unified structured format of "term - grammatical attribute - attribute value". For example, the standardized format for the verb term "write" is "write-present tense third person singular-writes; write-past tense-wrote; write-present participle-writing", and the standardized format for the noun term "child" is "child-singular-child; child-plural-children". Through format standardization, standardized grammatical tagging data is obtained. This data ensures the consistency of the format of the tagging results for different grammatical types, facilitating subsequent association with terms.
[0064] Based on standardized syntax annotation data, each term in the hierarchical term set is matched with corresponding standardized syntax annotation data: through precise matching of term names, such as matching the hierarchical term "write" with the corresponding entry in the standardized syntax annotation data, and matching the hierarchical term "child" with the corresponding entry in the standardized syntax annotation data, the association relationship between each hierarchical term and the standardized syntax annotation data is established, and term-syntax annotation association data is obtained. This data clarifies the complete syntax annotation information corresponding to each hierarchical term.
[0065] The standardized syntax annotation data in the term-grammar annotation association data is used as syntax tags and attached to the corresponding hierarchical terms: In the metadata information of the hierarchical terms, a new "grammar tag" field is added, and the matched standardized syntax annotation data is written into this field. For example, the "grammar tag" field of the hierarchical term "write" is written as "simple present tense third person singular: writes; simple past tense: written; present participle: writing; past participle: written", and the "grammar tag" field of the hierarchical term "child" is written as "singular: child; plural: children". Through the above additional operations, a hierarchical vocabulary set with grammatical tags is obtained. Each hierarchical vocabulary entry in this set fully carries the examination level information and grammatical tag information, which can be directly used for the construction of subsequent cross-level vocabulary networks. When associating synonyms, it can quickly filter out synonyms with matching grammatical attributes based on grammatical tags. For example, when associating the verb "write" with the synonym "compose", it can be confirmed through the grammatical tags that both are verbs and that the tense change rules are compatible. This avoids the problem of grammatical attribute mismatch caused by the traditional method of associating synonyms based solely on semantics, and improves the grammatical rationality of vocabulary collocation in subsequent text material generation.
[0066] Optionally, based on a hierarchical dynamic vocabulary, a pre-defined out-of-scope detection process for the text to be detected is established to generate out-of-scope detection execution rules. This includes: setting up a real-time word segmentation and part-of-speech tagging process for the text to be detected based on the hierarchical dynamic vocabulary; pre-defined rules for prioritizing matching the current level hash table in the hierarchical dynamic vocabulary after the text to be detected undergoes real-time word segmentation and part-of-speech tagging; for words that do not match the current level hash table in the hierarchical dynamic vocabulary, initiating a word vector backtracking process in conjunction with a pre-trained bidirectional encoder representation language model; setting similarity judgment criteria between the matched words and any level words in the hierarchical dynamic vocabulary higher than the current level, and integrating the word vector backtracking process with the similarity judgment criteria to generate out-of-scope detection execution rules.
[0067] Specifically, firstly, a hierarchical dynamic vocabulary database is acquired. This database stores vocabulary corresponding to each exam level, grammatical tags for the vocabulary, and cross-level synonym relationships. Each exam level also includes corresponding vocabulary grammatical attribute statistics, such as the proportion of nouns, verbs, and adjectives in that level, and the part-of-speech distribution of commonly used words. Based on the vocabulary grammatical attribute statistics in the hierarchical dynamic vocabulary database, the word segmentation granularity standard for the text to be tested is determined. For example, if the vocabulary of the target exam level is mainly basic monosyllabic words, such as in elementary school exams, the word segmentation granularity is set to a "single character + basic word" combination mode to avoid splitting "apple" into meaningless fragments such as "app" and "le". If the target exam level contains many multisyllabic compound words, such as in high school exams, the word segmentation granularity is set to a "compound word priority segmentation" mode to ensure that compound words such as "breakfast" and "blackboard" are completely identified as independent words.
[0068] Based on the granularity standard of word segmentation, a real-time word segmentation process for the text to be detected is set up: First, the character encoding of the text to be detected is unified, for example, converting texts with different encoding formats into a unified UTF-8 encoding to avoid word segmentation deviations caused by encoding differences; then, a word segmentation algorithm optimized based on the examination scenario is called. This algorithm has a built-in hierarchical dynamic vocabulary library containing vocabulary dictionaries for each examination level. During the word segmentation process, it prioritizes matching words of the corresponding level. For example, when processing the text to be detected with the target as primary school level, it prioritizes recognizing primary school level words such as "cat" and "dog". Then, the unmatched character sequences are split according to the granularity standard of word segmentation to obtain the preliminary word segmentation results.
[0069] Based on the preliminary word segmentation results and the grammatical tags in the hierarchical dynamic vocabulary, a part-of-speech tagging process is defined: each word in the preliminary word segmentation results is matched with the corresponding grammatical tag in the hierarchical dynamic vocabulary, and the part-of-speech information in the grammatical tag is extracted; for special words whose part of speech is not clearly defined in the grammatical tag, such as the polysemous word "run" which can be the verb "running" or the noun "journey", the part-of-speech tagging is completed by combining the context of the word in the text to be detected, such as "runfast" where "run" is followed by the adverb "fast", and "alongrun" where "run" is followed by the adjective "long". Finally, the part-of-speech tagging process is obtained, which clarifies the complete processing steps from the text to be detected to the result of "word segmentation + part-of-speech tagging", and provides standardized input for the subsequent word matching stage of out-of-scope detection.
[0070] Then, a hierarchical dynamic vocabulary database and real-time word segmentation and part-of-speech tagging process are obtained. The vocabulary set corresponding to the target exam level is extracted from the hierarchical dynamic vocabulary database. Based on this vocabulary set, a hash table for the current level is constructed. The "key" of the hash table is the vocabulary itself, such as "teacher" and "student", and the "value" is the exam level confirmation information and grammatical tag corresponding to the vocabulary. The exam level confirmation information is such as "primary school level - core vocabulary", and the grammatical tag is such as "noun - singular teacher - plural teacher". The construction of the hash table uses the chaining method to resolve hash collisions, ensuring that different grammatical forms of the same vocabulary, such as "teacher" and "teachers", can be stored together.
[0071] Based on the current-level hash table and the real-time word segmentation and part-of-speech tagging process, the following rule is preset: after the text to be detected is segmented and tagged, it will be matched against the current-level hash table first. The "word segmentation + part-of-speech tagging" result output by the real-time word segmentation and part-of-speech tagging process is clearly defined as the matching input. Each word in the result is used as a "key" to perform an exact match query in the current-level hash table. If the query is successful, that is, the word exists in the "key" of the current-level hash table, the examination level confirmation information in the hash table "value" is extracted, and the word is determined to be "a word that meets the target level". The matching result of the word is recorded. If the query is unsuccessful, that is, the word does not exist in the "key" of the current-level hash table, the word is marked as "a word to be further judged" and its syllabus is not determined at this time.
[0072] Simultaneously, a priority mechanism is established for this matching rule: in the out-of-syllabus detection process, the current-level hash table matching step has higher priority than other subsequent judgment steps. That is, the "word segmentation + part-of-speech tagging" results of the text to be detected must first be matched through the current-level hash table, and only the "words to be further judged" that do not match will enter the subsequent processing stage. The reason for this priority mechanism is that the current-level hash table is directly associated with the vocabulary of the target exam level in the hierarchical dynamic vocabulary library, which has high accuracy and efficiency. It can quickly filter out most of the words that meet the target level, reducing the processing load of subsequent complex judgment steps. This is different from the inefficient mode of "first global comparison and then hierarchical filtering" in traditional out-of-syllabus detection, thus improving the overall efficiency of out-of-syllabus detection. Through the above design, the rule of prioritizing matching the current-level hash table in the hierarchical dynamic vocabulary library after word segmentation and tagging of the text to be detected is fully preset. This rule clarifies the input, steps, result judgment, and priority of word matching, providing a basis for the preliminary screening stage of out-of-syllabus detection.
[0073] Next, the “vocabularies to be further judged” are obtained, which are the words that did not hit the current level hash table mentioned above. Then, a hierarchical dynamic vocabulary and a pre-trained Bidirectional Encoder Representations from Transformers (BERT) language model are obtained. The BERT model is a model fine-tuned based on exam scenario corpus. The fine-tuning corpus comes from standardized text materials of various exam levels, such as exam questions and textbook selections. During the fine-tuning process, the semantic association ability of words is optimized, so that the model has a higher semantic discrimination of synonyms and similar-looking words in exam scenarios than the general BERT model.
[0074] Based on the fine-tuned BERT model, the word vector conversion process for miss words is defined as follows: The "words to be further judged" are input into the embedding layer of the BERT model, which converts the words into initial word vectors. These initial word vectors integrate the character features of the words with the semantic features of the exam scenario. Then, through the multi-head attention layer of the BERT model, the semantic association weights between the "words to be further judged" and exam-related words in the model's pre-training corpus are calculated, and the dimensional features of the initial word vectors are adjusted. Finally, the output layer outputs the final word vectors of the "words to be further judged". These final word vectors can accurately reflect the semantic attributes of the words in the exam scenario, providing a data foundation for subsequent semantic similarity comparison.
[0075] Extract all higher-level vocabulary sets from the hierarchical dynamic vocabulary database, i.e., vocabulary sets that are more difficult than the target exam level. For example, if the target is the primary school level, extract the vocabulary sets for the junior high school and senior high school levels. Perform the same word vector transformation process as described above on each word in the vocabulary set to obtain a higher-level vocabulary word vector database. This word vector database stores all higher-level vocabulary and their corresponding final word vectors.
[0076] Based on the final word vector of the "vocabulary to be further judged" and the higher-level vocabulary word vector library, a word vector backtracking process is set up: First, a word vector index table is established. This index table uses the final word vector of the vocabulary in the higher-level vocabulary word vector library as the "index item" and the corresponding vocabulary and its higher-level information, such as "junior high school - extended vocabulary", as the "index value". Then, through the K-Nearest Neighbors (KNN) algorithm, the word vector index table is queried for the word vectors of the Top-K higher-level vocabulary that are semantically similar to the final word vector of the "vocabulary to be further judged". The corresponding vocabulary and its level information are obtained, and the word vector backtracking is completed. This process clarifies the tracing steps from "vocabulary to be further judged" to "similar higher-level vocabulary", providing a semantic association basis for subsequent out-of-syllabus judgment.
[0077] Finally, the final word vectors of the "vocabularies to be further judged", the higher-level vocabulary word vector library and the word vector backtracking process are obtained. Based on the vocabulary difficulty control requirements of the exam scenario, a similarity calculation method is set. The cosine similarity algorithm is used to calculate the similarity between the final word vectors of the "vocabularies to be further judged" and the final word vectors of the words in the higher-level vocabulary word vector library. This algorithm reflects the degree of semantic similarity by calculating the cosine value of the angle between the two vectors. The closer the cosine value is to 1, the more similar the two words are semantically, which is consistent with the over-syllabus judgment logic in the exam scenario that "semantically similar words may belong to the same difficulty level".
[0078] To determine the similarity between the unmatched vocabulary and any vocabulary at a higher level in the hierarchical dynamic vocabulary database, the following criteria are established: First, the semantic similarity distribution data between the target exam level and higher-level vocabulary in the hierarchical dynamic vocabulary database is statistically analyzed. For example, the average cosine similarity between elementary and middle school vocabulary, and between elementary and high school vocabulary, is calculated. Based on this distribution data, a similarity threshold is set. For instance, if the average similarity between elementary and middle school vocabulary is 0.5, and between elementary and high school vocabulary is 0.3, then the similarity threshold is set to 0.6. When the cosine similarity between the "vocabulary to be further judged" and a higher-level vocabulary is greater than 0.6, it indicates that the vocabulary to be judged is semantically highly similar to the higher-level vocabulary, exceeding the difficulty range of the target exam level. If it is less than or equal to 0.6, it indicates a weak semantic connection, and it is not considered beyond the syllabus at this time.
[0079] The word vector backtracking process is integrated with the similarity judgment criteria: First, the integration logic is clarified. After the word vector backtracking process obtains similar higher-level words for the "words to be further judged", the cosine similarity between the two is calculated. If the similarity exceeds the set threshold, the word to be judged is judged as an "out-of-scope word". If it does not exceed the threshold or does not backtrack to a similar higher-level word, it is judged as "meets the target level word". Then, this logic is connected with the above-mentioned real-time word segmentation and part-of-speech tagging process, the current level hash table matching rules, and the word vector backtracking process to form a complete out-of-scope detection logic chain: text to be detected → real-time word segmentation and part-of-speech tagging → priority matching of the current level hash table, if it hits, it is compliant → if it does not hit, word vector backtracking → calculate the similarity with higher-level words → if it exceeds the threshold, it is out-of-scope / if it does not exceed the threshold, it is compliant.
[0080] Finally, the logic chain is transformed into standardized out-of-scope detection execution rules. The rules clearly define the inputs and outputs, processing steps, judgment criteria, and exception handling for each stage, such as the default judgment result when word vector backtracking fails. These out-of-scope detection execution rules can be directly called by subsequent steps for non-out-of-scope word filtering and final out-of-scope detection, ensuring the uniformity of out-of-scope detection standards throughout the entire process as much as possible. This solves the problem of inconsistent judgments caused by scattered rules in traditional out-of-scope detection and improves the reliability of out-of-scope detection results.
[0081] Optionally, based on the exam parameters and a hierarchical dynamic vocabulary database, a hierarchical-question type sparse matrix is constructed. Effective question type combinations are extracted from the hierarchical-question type sparse matrix through bitwise operations to generate question type configuration results. This includes: determining the target question types corresponding to each exam level based on the exam parameters; determining the vocabulary difficulty adaptation range of the target question types corresponding to each exam level based on the hierarchical dynamic vocabulary database; constructing a hierarchical-question type sparse matrix based on the mapping relationship between each exam level and the corresponding target question type and vocabulary difficulty adaptation range (the hierarchical-question type sparse matrix supports hot-loading configuration); performing a bitwise AND operation on the question type identifiers corresponding to the "enabled" values in the hierarchical-question type sparse matrix to filter question type identifiers that match the current exam level; and generating question type configuration results based on the question type rule combinations corresponding to the filtered question type identifiers.
[0082] Specifically, firstly, the exam parameters and a hierarchical dynamic vocabulary database are obtained. The exam parameters include the hierarchical division of the target exam system and the ability assessment objectives of each level, such as the beginner level focusing on vocabulary recognition and the advanced level focusing on text comprehension and analysis. The hierarchical dynamic vocabulary database stores the vocabulary set corresponding to each exam level, vocabulary difficulty attributes such as frequency of use and grammatical complexity, and cross-level synonym relationships.
[0083] Based on the ability assessment objectives in the exam parameters, the target question types corresponding to each exam level are determined. For example, if the ability assessment objective of the entry-level exam is "basic vocabulary recognition and simple grammar application", then the corresponding target question types are set as vocabulary selection questions and single sentence fill-in-the-blank questions; if the ability assessment objective of the basic-level exam is "short text comprehension and basic writing", then the corresponding target question types are set as short reading comprehension questions and sentence rewriting questions; if the ability assessment objective of the advanced-level exam is "long text analysis and comprehensive writing", then the corresponding target question types are set as long reading comprehension questions and argumentative essay writing questions. This matching yields a level-target question type correspondence table, which clarifies the question types suitable for each exam level.
[0084] Based on the level-target question type correspondence table, and combined with a hierarchical dynamic vocabulary database, the vocabulary difficulty adaptation range for the target question type corresponding to each exam level is determined. For each level's target question type, the vocabulary difficulty attributes of that level are extracted from the hierarchical dynamic vocabulary database. For example, the common usage of beginner-level vocabulary is ≥80%, and the grammatical complexity is ≤2; the common usage of basic-level vocabulary is ≥60%, and the grammatical complexity is ≤3. Then, the difficulty range is adjusted according to the characteristics of the question type. For example, the difficulty of the option vocabulary in beginner-level vocabulary multiple-choice questions should be consistent with the difficulty of the question stem vocabulary, while the difficulty of the fill-in-the-blank vocabulary in beginner-level single-sentence fill-in-the-blank questions can be slightly lower than the difficulty of the question stem vocabulary. Through adjustment, a vocabulary difficulty adaptation range specific to each level's question type is formed, and finally, the mapping relationship between level-question type-vocabulary difficulty adaptation range is obtained. This mapping relationship provides core data support for the subsequent construction of a level-question type sparse matrix.
[0085] Then, the mapping relationship between level, question type, and vocabulary difficulty is obtained. Based on this mapping relationship, the dimensions and element meanings of the level-question type sparse matrix are defined: the "rows" of the matrix represent the exam levels, with each row corresponding to one exam level, such as row 1 corresponding to the beginner level, row 2 corresponding to the basic level, and row 3 corresponding to the advanced level. The row label is the name of the exam level and the core competency assessment target of that level. The "columns" of the matrix represent all selectable question types, with each column corresponding to one question type, such as column 1 corresponding to vocabulary selection questions and column 2 corresponding to short reading comprehension questions. The column label is the name of the question type and the assessment focus of that question type, such as "vocabulary selection questions - assessing basic vocabulary recognition". The "element values" at the intersection of the rows and columns of the matrix are only "1" or "0", where "1" indicates that the corresponding exam level is compatible with the question type and the vocabulary difficulty of the question type meets the corresponding vocabulary difficulty range, and "0" indicates that the corresponding exam level is not compatible with the question type or the vocabulary difficulty does not meet the requirements.
[0086] Based on the above definition, a sparse matrix of levels and question types is constructed: traverse the mapping relationship of level-question type-vocabulary difficulty adaptation range, and fill in "1" at the corresponding intersection position of each "exam level-target question type" combination, and fill in "0" for "exam level-question type" combinations that are not listed as target question types; since each exam level only adapts to a few question types, the number of "0" in the matrix is much greater than the number of "1", which conforms to the characteristics of a sparse matrix. The storage space occupied can be reduced by using sparse matrix storage formats such as COO format and CSR format, thereby improving the efficiency of subsequent data reading and operation.
[0087] Configure hot-loading functionality for the level-question-type sparse matrix: Design a matrix configuration file, such as in XML or JSON format, to store the matrix's row labels, column labels, element values, and corresponding vocabulary difficulty adaptation range information. Set up a hot-loading trigger mechanism so that when the adaptation relationship between exam levels and question types needs to be updated, such as adding a new question type, the system does not need to stop running. Only the configuration file needs to be modified and a loading command triggered. The system can automatically read the updated configuration file and regenerate the level-question-type sparse matrix, avoiding the problem of recompiling the system when modifying question types as in traditional hard-coding methods, thus improving the system's responsiveness to changes in exam standards. Through the above construction and configuration, a hot-loading-supported level-question-type sparse matrix is obtained, which fully reflects the adaptation relationship between exam levels, question types, and vocabulary difficulty.
[0088] Next, obtain the level-question type sparse matrix and the current exam level information. For example, if the exam level corresponding to the text material to be generated is the basic level, extract the row data corresponding to the current exam level from the level-question type sparse matrix. This row data contains the adaptation relationship between the current exam level and all available question types, with element values of "1" or "0". For example, the row data corresponding to the basic level is [1,1,0,0,1], where "1" corresponds to vocabulary selection questions, short reading comprehension questions, and sentence rewriting questions, and "0" corresponds to long reading comprehension questions and argumentative essay writing questions.
[0089] Each column of the level-question type sparse matrix is assigned a unique question type identifier, such as an 8-bit binary number. For example, the identifier for vocabulary selection questions is "00000001", the identifier for short reading comprehension questions is "00000010", the identifier for sentence rewriting questions is "00000100", the identifier for long reading comprehension questions is "00001000", and the identifier for argumentative essay writing questions is "00010000". This question type identifier is used for numerical association in subsequent bitwise operations.
[0090] Based on the row data and question type identifiers corresponding to the current exam level, question type identifiers corresponding to question types with an element value of "1" are selected. For example, in the basic level row data, the identifiers corresponding to question types with an element value of "1" indicating "enabled" are "00000001", "00000010", and "00000100". A bitwise AND operation is performed on the selected question type identifiers: the rule of the bitwise AND operation is "the result is 1 if all the same bits are 1, otherwise it is 0". This operation retains the common valid bits of all question type identifiers that match the current exam level, while filtering out the identifier bits that do not match the question types. Finally, a set of question type identifiers that match the current exam level is obtained. This set clearly defines the unique identifiers of all question types that can be used in the current exam level, providing a precise basis for question type selection in the subsequent generation of question type configuration results.
[0091] It should be noted that using bitwise operations to extract effective question type combinations is more efficient than the traditional traversal comparison method. Especially when there are many question types to choose from, such as more than 30, bitwise operations can complete the filtering of multiple question type identifiers in one calculation, while traditional traversal requires comparing the fit status of each question type one by one. In large-scale text material generation scenarios, this optimization can significantly improve the extraction speed of question type combinations.
[0092] Finally, a set of question type identifiers and a pre-built question type rule base that conform to the current exam level are obtained. The question type rule base stores the specific rules corresponding to each question type identifier, including the range of the number of questions for each question type (e.g., each vocabulary multiple-choice question contains 4 options), the vocabulary difficulty restrictions of the question stem and options (e.g., the vocabulary difficulty of the question stem for vocabulary multiple-choice questions must be consistent with the vocabulary difficulty range of the current level, and there must be no out-of-syllabus vocabulary in the options), the text length requirements for each question type (e.g., the text length of short reading comprehension questions must be controlled within a set range), and the knowledge points tested by each question type (e.g., sentence rewriting questions focus on testing tense conversion, etc.). Moreover, the rules in the question type rule base are associated with the vocabulary difficulty attributes of the hierarchical dynamic vocabulary database, so that the vocabulary requirements in the rules can be implemented.
[0093] Based on the question type identifier set, specific rules corresponding to each question type identifier are extracted from the question type rule base to obtain the question type rule set for the current level. For example, if the current exam level is basic, and the question type identifier set includes identifiers for vocabulary selection questions and short reading comprehension questions, then rules such as the number of questions, vocabulary difficulty, and knowledge points tested for these three question types are extracted from the question type rule base to form the basic level question type rule set.
[0094] Perform rule compatibility verification on the current level's question type rule set: check whether there are conflicts between rules for different question types, such as whether the vocabulary difficulty requirements for vocabulary selection questions are consistent with those for short reading comprehension questions, and whether there are logical contradictions between the text length requirements for sentence rewriting questions and the length requirements for other question types; if conflicts exist, adjust them based on the vocabulary difficulty attributes in the hierarchical dynamic vocabulary database and the ability assessment objectives in the exam parameters to ensure that all question type rules revolve around the unified exam level requirements, resulting in a compatible set of rules for the current level's question types.
[0095] Based on the compatible set of question type rules for the current level, a question type configuration result is generated. This result is presented in a structured format, including the current exam level, a list of compatible question types (including corresponding question type identifiers and names), and specific rules for each question type, including the number of questions, vocabulary difficulty range, text length requirements, and assessed knowledge points. For example, "Basic Level - Vocabulary Selection Questions: 10 questions, vocabulary difficulty range ≥60% of basic level common usage, question stem length 5-10 words, assessed knowledge points: noun singular / plural and verb tenses; Basic Level - Short Reading Comprehension Questions: 5 questions, text length 200-300 words, vocabulary difficulty range ≥60% of basic level common usage, assessed knowledge points: detail finding and main idea comprehension." This question type configuration result can be directly used as the basis for constructing a scenario constraint graph, ensuring that the content generated for subsequent slot filling matches the question type requirements and minimizing logical contradictions caused by the disconnect between traditional question type configuration and content generation.
[0096] Optionally, a scenario constraint graph is constructed based on the question type configuration results, and out-of-syllabus detection execution rules are invoked to filter out non-out-of-syllabus words. A graph neural network is then used to calculate the slot semantic energy value of the non-out-of-syllabus words to optimize filling and generate slot filling results. This includes: determining the scenario requirements of the generated text based on the question type configuration results; constructing a scenario-intent-role constraint relationship graph based on scenario knowledge to determine mandatory slots and mutual exclusion rules; invoking out-of-syllabus detection execution rules to perform out-of-syllabus detection on candidate words to be filled into slots, filtering out non-out-of-syllabus words; modeling the semantic association between slots corresponding to non-out-of-syllabus words based on a graph neural network, calculating slot semantic energy values, including coherence energy, context energy, and frequency energy; optimizing the filling order and combination of non-out-of-syllabus words based on the slot semantic energy values, while checking whether mandatory slots are complete, and triggering automatic completion for missing slots to generate slot filling results.
[0097] Specifically, first, the question type configuration results are obtained. These results include a list of question types suitable for the current exam level and specific rules for each question type, such as the number of questions, vocabulary difficulty range, and assessed knowledge points. Based on the question type and assessed knowledge points in the question type configuration results, the scenario requirements for generating the text are determined. For example, if the question type configuration results include "writing questions for everyday communication scenarios," then the scenario requirements for generating the text are "simulating everyday scenarios such as teacher-student dialogues and shopping consultations, using concise and colloquial language, and containing a clear information delivery intention." If it includes "reading comprehension questions for academic discussion scenarios," then the scenario requirements are "developing around basic subject concepts, using rigorous and formal language, and having a clear logical structure." Through this mapping, the definition of the text generation scenario requirements is obtained, clarifying the scenario attributes and expression requirements of the generated content.
[0098] A pre-built scenario knowledge base is acquired, which stores scenario element information categorized by scenario type. This includes typical intents corresponding to the scenario, such as the "information inquiry" intent in daily communication scenarios and the "opinion expression" intent in academic scenarios; core roles, such as the "student" role in daily communication scenarios and the "teacher" role in academic scenarios; and constraints between scenario elements, such as the "price inquiry" intent of the "customer" role in a "shopping consultation scenario" requiring a "quote" response from the "shop assistant" role. Based on the text-generated scenario requirement definition, matching scenario element information is extracted from the scenario knowledge base to obtain a scenario-intent-role candidate set. This set contains the intents and role types that may be involved in the current scenario.
[0099] Based on the scenario-intent-role candidate set, a constraint relationship graph of scenario-intent-role is constructed: a directed graph structure is adopted, and the nodes in the graph are divided into three categories: "Scene Node", which marks the name and core features of the current text generation scenario; "Intent Node", which marks the specific intent type and expression form in the scenario; and "Role Node", which marks the role identity and language style characteristics in the scenario. The directed edges between nodes represent the constraint relationship, and the edge labels indicate the constraint content. For example, the edge label of "Daily Communication Scenario Node" → "Information Inquiry Intent Node" is "Must include key information such as time / location", and the edge label of "Information Inquiry Intent Node" → "Student Role Node" is "Use polite spoken language".
[0100] In the constraint relationship graph, mandatory slots and mutual exclusion rules are determined: Intent nodes in the graph are traversed, and mandatory slots are determined based on the intent fulfillment requirements. For example, in the "shopping consultation scenario - price inquiry intent," the mandatory slots are "product name slot" and "price range slot." Mutual exclusion rules are set for different combinations of role nodes and intent nodes. For example, in the "academic discussion scenario - student role node" and "use colloquial vocabulary slot" are mutually exclusive, and in the "daily communication scenario - teacher role node" and "use subject-specific terminology slot" are mutually exclusive. Through this construction, a complete scenario constraint graph is obtained, which provides a scenario logic framework and constraint basis for subsequent slot filling.
[0101] Then, the required slot information and hierarchical dynamic vocabulary library in the scenario constraint graph are obtained. Based on the type of the required slot, such as "time slot", "product name slot" and "opinion slot", words of the corresponding type and that are within the range of vocabulary difficulty of the current exam level are extracted from the hierarchical dynamic vocabulary library as a set of candidate words to be filled into the slot. For example, the candidate word set for "daily communication scenario - time slot" includes time expression words within the current exam level, such as "Monday" and "3 pm", and the candidate word set for "shopping consultation scenario - product name slot" includes common item name words within the current level, ensuring that the type and difficulty of the candidate words are suitable for the slot requirements.
[0102] The out-of-scope detection execution rule is obtained, which clarifies the process and standards for determining out-of-scope words. For example, it first matches the current level hash table; if no match is found, it uses word vector backtracking and similarity judgment. The out-of-scope detection execution rule is invoked to perform out-of-scope detection on each word in the candidate word set to be filled into the slot: the candidate word is input into the matching process of the out-of-scope detection execution rule. First, an exact match is performed on the current level hash table; if a match is found, it is determined to be a "non-out-of-scope word"; if no match is found, the word vector backtracking process is initiated to calculate the semantic similarity between the candidate word and higher-level words. If the similarity does not exceed a set threshold, it is determined to be a "non-out-of-scope word"; otherwise, it is determined to be an "out-of-scope word".
[0103] The results of out-of-syllabus detection are filtered, removing out-of-syllabus words from the candidate word set and retaining all non-out-of-syllabus words, forming a non-out-of-syllabus word candidate set. Simultaneously, each word in the non-out-of-syllabus word candidate set is affixed with a slot adaptation tag, indicating the type of required slot for the word. For example, "Monday" is tagged with "Time Slot Adaptation," facilitating subsequent slot filling categorized by type. This filtering process differs from the traditional "fill first, then detect" model, filtering out out-of-syllabus words in advance to avoid rework due to out-of-syllabus words after filling, improving the efficiency and compliance of slot filling. The final result is a non-out-of-syllabus word candidate set with slot adaptation tags, which can be directly used in subsequent filling optimization stages.
[0104] Next, a scene constraint graph and a candidate set of non-over-the-top vocabulary with slot adaptation labels are obtained. All required slot information is extracted from the scene constraint graph, and the candidate set of non-over-the-top vocabulary is classified according to slot type to obtain a slot-vocabulary correspondence table. This table clarifies the list of non-over-the-top vocabulary that can be filled in each required slot. Based on the slot-vocabulary correspondence table, the input structure of the Graph Neural Network (GNN) is determined. Each required slot is used as a graph node of the GNN. The node feature vector contains slot type features, such as the feature vector [1,0,0] corresponding to the "time slot" and [0,1,0] corresponding to the "product name slot," along with the semantic features of the non-over-the-top vocabulary under that slot, which are obtained through a pre-trained word vector model. The semantic relationships between slots are used as edges of the graph, such as the "event occurrence association" between the "time slot" and the "location slot," and the "attribute correspondence association" between the "product name slot" and the "price range slot." The edge feature vectors are labeled with the association type and strength.
[0105] In this application, the BERT model is based on a mature, general-purpose pre-trained BERT model, with its core functionality achieved through customized fine-tuning specific to the examination scenario. For the basic model selection, the core architecture of BERT, such as the native bidirectional Transformer encoder and multi-head attention mechanism, is directly adopted. BERT-Base is selected as the standard version, consisting of a 12-layer Transformer with 110M parameters, while Lightweight BERT is selected as the lightweight version, consisting of a 6-layer Transformer with 30M parameters. General-purpose pre-trained weights are reused to reduce training costs. Scenario-based fine-tuning is the core step. First, a three-level exam-specific corpus is constructed, covering textbook selections, past exam questions, and structured corpora labeled with "vocabulary difficulty - exam level." After deduplication, hierarchical segmentation, and length standardization preprocessing, this corpus is used for model fine-tuning. Second, a multi-task joint fine-tuning objective is designed. Building upon traditional Masked Language Modeling (MLM) and Next Sentence Prediction (NSP), new tasks of vocabulary level classification and question type-semantic matching are added. A weighted integration of multi-task loss functions focuses on the needs of the exam scenario. Finally, a hierarchical parameter fine-tuning strategy is adopted, freezing the lower-level parameters to retain general semantic capabilities and unfreezing the upper-level parameters to adapt to the exam scenario. Precise training parameters such as learning rate and batch size are used to ensure optimal model optimization. Further optimization occurs in the functional adaptation stage. A semantic similarity calculation head is added to the standard BERT, and a scene element attention layer and level adaptation factor are added to the lightweight BERT, respectively matching the core requirements of out-of-syllabus detection and scene consistency detection. This allows the model output to directly serve the entire text generation process, solving the technical shortcomings of the general BERT model in exam scenarios, such as semantic bias and limited functionality.
[0106] The word vector model is not an independent model, but rather a functional output form of the BERT model. Its acquisition process is an organic combination of BERT model word vector generation and exam-specific optimization. Word vector generation is based on a fine-tuned BERT model. After the input words are standardized, an input sequence of "[CLS] + word + [SEP]" is constructed according to BERT word segmentation rules. Standard BERT extracts the 768-dimensional hidden layer output vector corresponding to the [CLS] tag, while lightweight BERT obtains a 64-dimensional vector through mean pooling of sub-word vectors. All vectors are L2 normalized to ensure uniform module length. The core optimization lies in its tailored approach to exam scenarios. First, it embeds hierarchical attributes, converting vocabulary exam levels into 16-dimensional one-hot encoded vectors, which are then concatenated with word vectors generated by BERT, enabling the word vectors to carry difficulty differentiation information. Second, it integrates grammatical attributes, extracting grammatical labels from vocabulary and converting them into 8-dimensional binary encoded vectors, further enriching the feature dimensions of the word vectors and supporting grammatical validity verification. Third, it adapts to functional scenarios; for out-of-syllabus detection scenarios, it retains a complete 792-dimensional vector to ensure comprehensive information, while for slot semantic energy value calculation scenarios, it reduces the dimensionality to 128 dimensions through principal component analysis (PCA) to improve computational efficiency. This approach breaks through the limitations of traditional word vectors that only contain semantic information, achieving a multi-dimensional representation of "semantics + difficulty + grammar." Furthermore, all optimization steps are deeply integrated with hierarchical dynamic vocabulary databases, out-of-syllabus detection rules, and other technical modules to ensure that the word vectors can more accurately adapt to the core requirements of text material generation.
[0107] A GNN model structure adapted to slot filling scenarios is constructed, which consists of a three-layer core structure:
[0108] Node Embedding Layer: Receives the initial feature vectors of slot nodes, performs non-linear transformations on the features through a fully connected layer, fuses slot type and lexical semantic information, and outputs updated node embedding vectors to enhance the discriminative power of node features. Message Passing Layer: Employs an attention mechanism to calculate message weights between adjacent nodes. For slot node pairs with strong semantic association, such as "product name slot" and "price range slot," higher attention weights are assigned to make message passing more focused on key associations. Message aggregation functions, such as mean aggregation, are used to integrate messages from adjacent nodes into the current node, updating the node embedding vector and enabling the interaction of semantic information between slots. Energy Calculation Layer: Based on the updated node embedding vectors... For each edge feature vector, coherence energy, context energy, and frequency energy are calculated: Coherence energy: The cosine similarity between the embedding vectors of each slot node is calculated and weighted to obtain the coherence energy. The higher the similarity, the higher the coherence energy. Context energy: Based on the constraint relationship in the scene constraint graph, the logical matching degree between the words to be filled in each slot and the words in other slots is checked. For example, the logical matching degree between "3 pm" and "school" is higher than that between "3 am" and "school". The context energy is obtained by scoring the matching degree. Frequency energy: The frequency of use of each non-out-of-syllabus word in the historical slot filling data is statistically analyzed, normalized, and then calculated with preset weights to avoid content monotony caused by excessive repetition of high-frequency words.
[0109] The coherence energy, context energy, and frequency energy are integrated according to set weights to obtain the slot semantic energy value corresponding to each non-out-of-syllabus word. This energy value quantifies the semantic rationality and scene adaptability of word filling. Among them, the weight value is retrieved from the scene knowledge base based on the scene type. For example, the coherence energy weight is higher in daily communication scenes, and the context energy weight is higher in academic scenes.
[0110] Finally, obtain the slot semantic energy value, the non-out-of-scope vocabulary candidate set with slot adaptation tags, and the scene constraint graph. For each mandatory slot, sort the corresponding non-out-of-scope vocabulary according to the slot semantic energy value from high to low to obtain the vocabulary filling priority list for each slot. The higher the energy value of the vocabulary, the higher the filling priority and the more likely it is to enter the candidate filling combination.
[0111] Based on a vocabulary filling priority list, the filling order and combination of non-out-of-syllabus words are optimized: A greedy algorithm is used to first select the words with the highest priority in each slot to form an initial filling combination, and calculate the overall semantic energy value of this combination, such as the weighted sum of the energy values of words in each slot. Then, words in different slots are replaced with words of lower priority, and the overall energy value of the new combination is calculated. The filling combination with the highest overall energy value is retained as the optimized slot filling candidate scheme. This optimization process ensures that the filling combinations achieve a better state in terms of semantic coherence and scene adaptability, which, unlike the traditional "random selection filling" or "single-dimensional sorting filling" methods, improves the overall quality of the filled content.
[0112] Perform a mandatory slot integrity check on the optimized slot filling candidate schemes: traverse all mandatory slots defined in the scene constraint graph and check whether each mandatory slot in the candidate scheme has a corresponding filling word; if all mandatory slots are filled, it is determined to be "fully filled"; if there are unfilled mandatory slots, trigger the automatic completion mechanism, select the word with the highest semantic energy value from the non-out-of-scope word candidate set with slot adaptation tags to complete the missing slot, and recalculate the overall semantic energy value after completion to ensure that the completed combination still meets the semantic rationality requirements.
[0113] After completion, the filled combinations are checked again to ensure they conform to the mutual exclusion rules in the scene constraint graph. For example, does the "student role" filling combination contain "academic terminology slots"? Does the "daily communication scene" filling combination contain "complex clause structures"? If mutual exclusion conflicts exist, the words in the conflicting slots are adjusted to secondary priority words that conform to the mutual exclusion rules and are not beyond the scope of the curriculum, until there are no conflicts. Through the above optimization, completion, and conflict checking, a slot filling result is generated. This result contains non-beyond the scope of the curriculum words for all required slots, and is semantically coherent and scene-appropriate, and can be directly used as the basic input for generating target text materials.
[0114] Optionally, the calculation of slot semantic energy value includes: taking the slots corresponding to each non-over-the-top word as graph nodes, the semantic associations between slots as graph edges, calculating the semantic matching score of each graph node with other graph nodes based on the message passing mechanism of the graph neural network, and obtaining the coherence energy by weighted summation; checking the logical constraints between the slots corresponding to each non-over-the-top word and other filled slots, and obtaining the context energy based on the degree of constraint satisfaction; counting the occurrence frequency of each non-over-the-top word in the historical slot filling data, normalizing the occurrence frequency and calculating it with preset weights to obtain the frequency energy; and integrating the coherence energy, context energy and frequency energy according to the set weights to calculate the slot semantic energy value.
[0115] Specifically, firstly, a candidate set of non-out-of-syllabus vocabulary with slot adaptation labels and a scene constraint graph are obtained. All mandatory slot types, such as "event slots," are extracted from the scene constraint graph. Each mandatory slot is used as a graph node in a graph neural network. An initial feature vector is constructed for each graph node. This vector contains two parts: firstly, the slot type feature, which uses one-hot encoding, such as "time slot" corresponding to [1,0,0] and "location slot" corresponding to [0,1,0]; secondly, the aggregated semantic features of non-out-of-syllabus vocabulary under the slot, which are obtained by converting vocabulary into vectors and taking the average value after using a word vector model optimized for exam scenarios. This model is fine-tuned based on real exam corpora to enhance the semantic capture ability of vocabulary in educational scenarios, thus obtaining the initial feature matrix of the slot nodes.
[0116] Based on the semantic relationships between slots in the scene constraint graph, such as the "temporal relationship" between "time slot" and "event slot" and the "spatial relationship" between "location slot" and "event slot", the edge structure of the graph is constructed: undirected edges are established for slot node pairs with semantic relationships, each edge corresponds to a relationship type label, such as "temporal relationship" or "spatial relationship", and relationship strength weights are assigned to the edges. The weights are set based on the frequency of slot relationships in the scene knowledge base. For example, the "time-event" relationship has a high frequency of occurrence in daily communication scenarios, so the weight is set to 0.8, and the "location-event" relationship weight is set to 0.7. An edge feature matrix and an adjacency matrix are formed. In the adjacency matrix, "1" indicates that there is an edge between nodes, and "0" indicates that there is no edge. The matrix element values are the relationship strength weights of the edges.
[0117] The optimized attention mechanism message-passing GNN model is used to calculate the semantic matching score. This model adds a slot association attention layer to the traditional GNN. The specific process is as follows: Node feature update: The initial feature matrix of the slot node is input into the node embedding layer. The features are non-linearly transformed through a fully connected layer to output a node embedding vector with uniform dimension; Attention weight calculation: The slot association attention layer receives the node embedding vector and the edge feature matrix. For each node, the attention weight with its neighboring nodes is calculated. Combining the association type label and association strength weight of the edge, higher attention coefficients are assigned to core association types such as "temporal association" and "spatial association" to make the model more focused on key semantic associations; Message passing and aggregation: According to the attention weight, the weighted sum of the embedding vectors of the neighboring nodes is used as the message of the current node. The message and the current node embedding vector are aggregated through a gated recurrent unit (GRU) to output the updated node embedding vector; Semantic matching score generation: The cosine similarity between the updated embedding vectors of any two slot nodes is calculated. This similarity is the semantic matching score between the two slots. The higher the score, the stronger the semantic association between the slots. The semantic matching scores between all slot nodes are weighted and summed according to the association strength weight of the edges to obtain the coherence energy. This energy value directly reflects the semantic coherence of the non-overlapping word combinations in each slot.
[0118] Then, obtain the scene constraint graph and the non-out-of-scope vocabulary candidate set for each slot. Extract the logical constraint rules between slots from the scene constraint graph. These rules are divided into two categories: one is dependency constraint rules, such as the vocabulary of the "event slot" must match the vocabulary of the "time slot" in terms of time sequence, such as the "exam" event must match time words such as "morning / afternoon". The other is mutual exclusion constraint rules, such as the vocabulary of the "low-priced goods slot" and the vocabulary of the "high-end brand slot" in the "shopping scenario" cannot appear at the same time. Organize these rules into a slot logical constraint table to clarify the associated slot pairs and constraint content of the constraint relationship.
[0119] Based on the slot logical constraint table, a logical constraint check matrix is constructed: the rows and columns of the matrix represent mandatory slots, and the elements at the intersections store the constraint type and check criteria for the corresponding slot pairs. For example, the intersection of the "Time Slot" row and the "Event Slot" column stores "Dependency Constraint - Event words must conform to the temporal rationality of time words", and the intersection of the "Low-Priced Goods Slot" row and the "High-End Brand Slot" column stores "Mutual Exclusion Constraint - Valid words cannot be filled at the same time".
[0120] For each slot corresponding to a non-out-of-syllabus word, the state of the filled slots is simulated: Assuming a slot is filled with a word from its candidate set, this word is designated as the "filled word," and the candidate words for other slots are designated as "words to be filled." The logical constraints between the words to be filled and the filled words are checked one by one. The checking process uses a constraint satisfaction scoring mechanism: if the dependency constraint rule is met, such as the "exam" event matching the "afternoon" time, the constraint satisfaction score is a set positive value, such as 0.8; if the dependency constraint rule is not met, such as the "exam" event matching the "late night" time, the score is a set negative value, such as 0.2; if a mutual exclusion constraint rule is triggered, the score is 0; if there is no direct constraint relationship, the score is the base score, such as 0.5.
[0121] For all candidate words in each slot, the average constraint satisfaction score between each candidate word and the words in other filled slots is calculated. This average score is the context energy of the non-out-of-scope word corresponding to that slot. This energy value differs from the traditional evaluation method that only relies on semantic similarity. By introducing contextual logical constraints, it more accurately reflects the logical rationality of word filling and avoids filling results that are "semantically coherent but logically contradictory".
[0122] Next, the historical slot filling database and the candidate set of non-out-of-syllabus words for each slot are obtained. The historical slot filling database stores the actual words filled in each slot during the generation of past text materials and the corresponding quality feedback of the generated text, such as the manually annotated "content diversity score". The historical slot filling database is classified by slot type, and the frequency of occurrence of each non-out-of-syllabus word in the corresponding slot is counted, that is, the proportion of the number of times the word was used in the historical filling to the total number of times the slot was filled, resulting in a historical frequency table of words.
[0123] Considering that overuse of high-frequency words can lead to monotonous content generation, this application introduces a frequency decay factor to optimize the frequency of occurrence: a frequency decay coefficient is set, which is dynamically adjusted based on the historical content diversity score. The lower the diversity score, the larger the decay coefficient. For example, when the diversity score is below 0.6, the decay coefficient is set to 0.7. The historical frequency of occurrence of the word is multiplied by the frequency decay coefficient to obtain the optimized word adjustment frequency, thus avoiding high-frequency words from gaining excessive weight simply because of their high frequency.
[0124] The optimized vocabulary adjustment frequencies are normalized: the adjustment frequencies of all non-out-of-syllabus words are divided by the sum of their adjustment frequencies to obtain normalized frequency values, ensuring that the sum of the normalized frequency values of all words is 1. Preset weights are obtained, which are set according to the scenario type. For example, in daily communication scenarios where content diversity is highly required, the preset weight is set to 0.3; in academic scenarios where vocabulary stability is highly required, the preset weight is set to 0.1. The normalized frequency values are multiplied by the preset weights to obtain frequency energy. This energy value effectively balances the diversity and stability of the generated content while ensuring the rationality of vocabulary usage.
[0125] Finally, coherence energy, context energy, and frequency energy are obtained, along with a pre-constructed scene-weight mapping table. This mapping table sets the weight allocation ratio of the three types of energy according to different text generation scenes, such as daily communication, academic discussion, and story creation. For example: Daily communication scene: coherence energy weight α=0.4, context energy weight β=0.4, frequency energy weight γ=0.2, this scene focuses on semantic coherence and logical rationality; Academic discussion scene: coherence energy weight α=0.3, context energy weight β=0.5, frequency energy weight γ=0.2, this scene focuses on logical rigor; Story creation scene: coherence energy weight α=0.5, context energy weight β=0.3, frequency energy weight γ=0.2, this scene focuses on semantic fluency.
[0126] Based on the current text generation scenario requirements, the weights α, β, and γ are obtained from the question type configuration results and retrieved from the scenario-weight mapping table to ensure that the weight allocation is highly adapted to the scenario requirements. The coherence energy, context energy, and frequency energy are multiplied by their respective weights, and then the products are added together to obtain the slot semantic energy value, which is also the quantitative indicator of the rationality of the slot combination. The calculation formula is: "Slot semantic energy value = α × coherence energy + β × context energy + γ × frequency energy".
[0127] To ensure the validity of the energy values, an energy value calibration mechanism is implemented: the mean and standard deviation of the slot semantic energy values corresponding to all non-out-of-scope words are calculated, and energy values exceeding the range of "mean ± 2 × standard deviation" are adjusted to this range to avoid extreme values interfering with subsequent filling optimization. The calibrated slot semantic energy values quantify the comprehensive suitability of each non-out-of-scope word in slot filling, providing a core quantitative basis for subsequent filling order and combination optimization. Unlike traditional single-dimensional evaluation methods, this energy value achieves a comprehensive evaluation of the filling words from multiple dimensions, including semantics, logic, and diversity, thus improving the quality and reliability of the slot filling results.
[0128] Optionally, based on the hierarchical dynamic vocabulary, the out-of-scope detection execution rules are invoked to perform out-of-scope detection on the words in the slot filling results, and length and scene consistency detection are performed simultaneously. This includes: based on the hierarchical dynamic vocabulary, invoking the out-of-scope detection execution rules to perform out-of-scope detection on the words in the slot filling results, and filtering out out-of-scope words; detecting whether the text length of the slot filling results meets the set length requirements, and performing length detection; inputting the text generation prompts and slot filling results into the lightweight bidirectional encoder representation language model, outputting the logical matching degree, and performing scene consistency detection.
[0129] Specifically, first, the slot-filling results and a hierarchical dynamic vocabulary are obtained. The slot-filling results contain all non-out-of-syllabus vocabulary for all required slots, forming a complete text fragment, such as "On a weekend morning, students look up information in the school library." The hierarchical dynamic vocabulary stores the vocabulary set, grammar tags, and cross-level synonym relationships for the current exam level. Text preprocessing is performed on the slot-filling results, including removing redundant spaces and standardizing character encoding (e.g., converting to UTF-8 format), resulting in standardized slot-filled text to ensure input consistency for subsequent testing.
[0130] The out-of-syllabus detection execution rule is invoked, which includes a complete process of "real-time word segmentation and part-of-speech tagging → current-level hash table matching → word vector backtracking → similarity judgment". The standardized slot-filled text is input into the real-time word segmentation and part-of-speech tagging process of the out-of-syllabus detection execution rule. According to the preset word segmentation granularity standard, such as "basic word priority segmentation" when the current exam level is basic, the text is segmented into independent words, such as "weekend", "morning", "student", "school", "library", "look up", and "materials". The part-of-speech tagging of each word is then labeled, such as noun, verb, etc., to obtain the word segmentation-part-of-speech tagging results.
[0131] Based on the word segmentation and part-of-speech tagging results and the current-level hash table in the hierarchical dynamic vocabulary, where the key is the word and the value is the hierarchical confirmation information and grammatical label, a priority matching process is performed: each word segment is used as the "key" to query the current-level hash table; if a match is found, it is determined to be a "compliant word"; otherwise, it is marked as a "word to be backtracked". For "words to be backtracked", a pre-trained bidirectional encoder representation language model is invoked to generate word vectors, and word vector backtracking is performed in the higher-level vocabulary set of the hierarchical dynamic vocabulary to calculate the semantic similarity between the words to be backtracked and the higher-level vocabulary.
[0132] A similarity threshold is set, such as 0.65 for the basic level exam. If the similarity between the word to be traced and any word at a level higher than the current level exceeds the threshold, it is judged as an "out-of-syllabus word"; if it does not exceed the threshold or no similar word is traced back, it is judged as a "compliant word". All words judged as out-of-syllabus are compiled into an out-of-syllabus word list to complete the out-of-syllabus detection. This process differs from the traditional detection method that only relies on a fixed vocabulary list. By combining a hierarchical dynamic vocabulary database with word vector backtracking, the false positive rate of out-of-syllabus words is reduced and the reliability of the detection is improved.
[0133] Then, obtain the slot filling results and question type configuration results. Extract the text length requirements for the current question type from the question type configuration results. These requirements are divided into two categories: overall length requirements and slot length requirements. For example, the text length requirement for the "event description slot" is 50-80 characters, and the text length requirement for the "opinion statement slot" is 30-50 characters. Organize these requirements into a length detection standard table to clarify the detection dimensions and corresponding numerical ranges.
[0134] Based on the length detection standard table, a length detection matrix is constructed: the rows of the matrix represent detection dimensions, such as "overall length," "event description slot length," and "opinion statement slot length," etc., and the columns represent detection indicators, including "actual length," "minimum required length," "maximum required length," and "whether it meets the standard." The elements at the intersection are used to store the detection data for the corresponding dimension. For example, the "minimum required length" column in the "overall length" row is filled with 200 characters, and the "maximum required length" column is filled with 300 characters.
[0135] Perform length statistics on the slot filling results: First, count the total number of characters in the text, including punctuation marks but excluding redundant spaces, and enter this count into the "Actual Length" column of the "Overall Length" row in the length detection matrix. Then, split the slot filling results by slot type, count the number of characters in the filling content of each slot, and enter this count into the "Actual Length" column of the corresponding slot length row. For example, the filling content for the "Event Description Slot" is "Students are researching in the school library to prepare for next week's science report," and its character count is 38, which is entered into the corresponding "Actual Length" column.
[0136] Length compliance judgment: For each detection dimension, if the actual length is within the range of "minimum required length - maximum required length", mark "Yes" in the "Compliant" column; if the actual length is less than the minimum required length, mark "Insufficient length" and calculate the difference. For example, if the actual length is 180 characters and the minimum requirement is 200 characters, the difference is -20 characters; if the actual length is greater than the maximum required length, mark "Exceeded length" and calculate the difference. For example, if the actual length is 320 characters and the maximum requirement is 300 characters, the difference is +20 characters. The detection results are compiled into a length detection report, clearly defining the specific differences between compliant and non-compliant dimensions, providing a quantitative basis for subsequent text adjustments. This process, through multi-dimensional length detection, avoids the problem of local slot length non-compliance caused by traditional methods that only detect the overall length.
[0137] Finally, the scenario constraint graph and examination parameters are obtained. The core elements of the generated text are extracted from the scenario constraint graph. For example, the core elements of "daily communication scenario" are "lifelike roles, colloquial expressions, and clear information intent". Combined with the hierarchical ability requirements in the examination parameters, such as the basic level requirement of "clear scenario logic and no obvious semantic contradictions", a scenario consistency training dataset is constructed. This dataset contains a triplet of "text generation prompt - standard text - logical matching degree label". The text generation prompt is a description of the core elements of the scenario, such as "generate daily dialogue text between teachers and students, including the intent of homework consultation". The standard text is a reference text that meets the scenario requirements. The logical matching degree label is a manually labeled score of 0-1, where 1 point represents a complete match and 0 points represent a complete mismatch.
[0138] The optimized lightweight bidirectional encoder represents the language model. Compared with traditional models, this model includes: a scene element attention layer: a scene element attention layer is added to the hidden layer of the model. The core scene elements in the input text are generated as prompts, such as "teacher-student dialogue" and "homework consultation". These elements are assigned higher attention weights, so that the model can focus more on the key features of the scene during calculation; a hierarchical adaptation output layer: a hierarchical adaptation factor is added to the output layer. For example, the hierarchical adaptation factor is set to 0.8 for the basic level exam and 0.9 for the advanced level. This factor dynamically adjusts the logical matching threshold of the output according to the exam level to ensure that the model adapts to the consistent requirements of different levels of scenes.
[0139] The model training process is as follows: The text-generated prompts and standard text input models from the scene consistency training dataset are used to capture key scene features through the scene element attention layer, and semantic associations are calculated through the Transformer encoder. Finally, the logical matching degree prediction value is output through the hierarchical adaptation output layer. The error between the prediction value and the manually labeled value is calculated using the cross-entropy loss function. The model parameters are optimized by backpropagation until the accuracy of the model on the validation set reaches a set threshold, such as 92%. The model training is then completed, and the scene consistency detection model is obtained.
[0140] The current text-generated prompt, which is a description of the core elements of the scene extracted from the scene constraint graph, is input into the trained scene consistency detection model along with the slot filling result. The model outputs a logical matching degree in the range of 0-1. If the matching degree is greater than or equal to the hierarchical adaptation factor (e.g., when the basic level adaptation factor is 0.8), the matching degree is considered "scene consistent," and the scene consistency detection passes. If the matching degree is less than the hierarchical adaptation factor, the scene is considered "inconsistent," and the reason for the inconsistency is output. This process achieves quantitative detection of scene consistency through a customized, lightweight model, which differs from the subjective mode of traditional manual judgment, improving detection efficiency and objectivity.
[0141] Optionally, the target text material is generated based on the detection results, including: determining whether the detection results of out-of-scope detection, length detection, and scene consistency detection all meet the standards; if all detection results meet the standards, the slot filling result is directly used as the target text material; if there are detection results that do not meet the standards, a differential prompt is automatically generated, and the slot filling result is adjusted based on the differential prompt before re-detection until the detection result meets the standards to generate the target text material; wherein, the differential prompt contains the reason information for the detection failure, and an exponential backoff strategy is used to limit the number of retries.
[0142] Specifically, first, obtain the out-of-scope detection results, length detection results, and scene consistency detection results. The out-of-scope detection results include a list of out-of-scope words; if it is empty, it means there are no out-of-scope words. The length detection results include a length detection report, which indicates whether each detection dimension meets the standard. The scene consistency detection results include the logical matching degree and the determination of whether it meets the standard. For example, if the logical matching degree is greater than or equal to the hierarchical adaptation factor, it meets the standard.
[0143] Construct a detection result judgment matrix. The rows of this matrix represent three types of detection items: "Out-of-scope detection," "Length detection," and "Scene consistency detection." The columns represent judgment dimensions: "Detection result details," "Whether it meets the standard," and "Reason for non-compliance." Fill the "Detection result details" column of the corresponding row with the three types of detection results: the "Out-of-scope detection" row should contain a list of out-of-scope terms; the "Length detection" row should contain the compliance status from the length detection report, such as "Overall length meets the standard, event description slot length is insufficient"; and the "Scene consistency detection" row should contain the logical matching degree value and the compliance judgment, such as "Logical matching degree 0.85, meets the standard."
[0144] Define the judgment rules: For out-of-scope detection, if the out-of-scope vocabulary list is empty, it is judged as "meets the standard"; otherwise, it is "does not meet the standard". The reason for not meeting the standard is to fill in the name of the out-of-scope vocabulary. For length detection, if all detection dimensions meet the standard, it is judged as "meets the standard"; otherwise, it is "does not meet the standard". The reason for not meeting the standard is to fill in the difference between the dimension that did not meet the standard and the length. For scene consistency detection, if the logical matching degree is greater than or equal to the hierarchical adaptation factor, it is judged as "meets the standard"; otherwise, it is "does not meet the standard". The reason for not meeting the standard is to fill in the difference between the matching degree value and the threshold.
[0145] According to the judgment rules, values are assigned to the "Whether it meets the standard" and "Reasons for non-compliance" columns of the test result judgment matrix. Finally, it is checked whether all three types of test items have a "Yes" column. If all are "Yes", the overall test result is judged to meet the standard; otherwise, it is judged that there are items that do not meet the standard. This matrix-based judgment method differs from the traditional single-dimensional judgment, and can clearly present the compliance status and root causes of problems for each test item, providing clear guidance for subsequent adjustments.
[0146] Then, obtain the overall detection results and slot filling results. If the overall detection results are determined to be "fully compliant with standards", then perform text normalization processing on the slot filling results. This processing includes three core operations: format unification: adjust the text layout according to the format requirements in the question type configuration results. For example, short writing questions need to add a title, and the title format is "[Scene Name] + Text Type". Paragraph division: for multiple-choice questions, the options need to be arranged in the order of "A / B / C / D" and left-aligned.
[0147] Syntax validation: Call the grammar tags in the hierarchical dynamic vocabulary library to check the grammatical correctness of the slot filling results, such as whether the verb tense matches the time slot vocabulary, such as "yesterday" corresponding to the past tense verb, whether the noun singular and plural matches the quantity vocabulary, such as "three" corresponding to the plural noun. If there are minor grammatical deviations, such as the spelling error "studnet", it will be automatically corrected to the correct form "student".
[0148] Semantic optimization: Based on the language style requirements in the scenario constraint graph, adjust the text expression. For example, in daily communication scenarios, it is necessary to enhance the colloquialism and change "to study" to "study". In academic scenarios, it is necessary to improve the rigor and change "approximately" to "about".
[0149] Through text normalization, standardized text with uniform format, correct grammar, and appropriate style is obtained. The standardized text is then associated and stored with the detection result judgment matrix to generate text material metadata, which includes the generation time, corresponding exam level, question type, and detection pass / fail status. Finally, the standardized text and metadata are integrated and output as target text material, supporting common formats such as DOCX and TXT. This process ensures that the target text material not only meets the detection standards but also conforms to the format and expression requirements of actual usage scenarios, allowing it to be directly used for exam question setting or practice material generation without additional manual adjustments.
[0150] Next, the detection result judgment matrix and slot filling results are obtained. The "reason for non-compliance" information of the non-compliant detection items is extracted from the matrix. Based on this information, differential prompts are automatically generated. The differential prompts adopt a three-part structure of "problem location + adjustment suggestion + reference basis" and generate customized content for different non-compliance types.
[0151] If the item that fails to meet the standard is due to being outside the scope of the test, the differential prompt will be: "[Problem Location] Outside the scope of the test fails: There is an outside-scope word 'analyze'; [Adjustment Suggestion] Replace it with a word with a similar meaning within the current level, such as 'study' or 'check'; [Reference Basis] Basic-level vocabulary list in the hierarchical dynamic vocabulary database";
[0152] If the failure is due to length detection, the differential prompt will be: "[Problem Identification] Length Detection Failed: Event description slot length is less than 25 characters; [Adjustment Suggestion] Supplement event details, such as time, location, and specific actions. For example, 'researching materials in the school library' can be supplemented as 'researching scientific report-related materials in the school library on Saturday morning'; [Reference Basis] The event description slot length requirement in the question type configuration results is 50-80 characters."
[0153] If the non-compliance item is related to scenario consistency detection, such as low logical matching degree, the differential prompt content is: "[Problem Location] Scenario consistency detection failed: logical matching degree 0.72 < threshold 0.8; [Adjustment Suggestion] Optimize the logical association of slot words, such as in the 'Weekend Plan' scenario, change 'attend academic conference' to 'attend classmate reunion'; [Reference Basis] The core element of daily communication scenarios in the scenario constraint graph is 'lifestyle activities'."
[0154] After generating differential hints, the slot filling results are automatically adjusted based on the differential hints: the candidate set of non-out-of-scope words with slot adaptation tags is called, out-of-scope words are replaced, for example, non-out-of-scope words with similar semantics are selected, content is supplemented for slots with insufficient length, for example, non-out-of-scope words that match the scenario are selected to expand details, and semantic correction is performed on logically mismatched content, for example, words that match the core elements of the scenario are selected, and the adjusted slot filling results are obtained.
[0155] At the same time, the optimized exponential backoff strategy is activated to limit the number of retries. The specific process is as follows:
[0156] Parameter initialization: Set the initial retry interval, such as T0=1 second; the maximum number of retries, such as N=3 times; the exponent, such as k=2; and the current number of retries, such as n=0. Retry detection: Re-enter the adjusted slot filling result to perform out-of-scope detection, length detection, and scene consistency detection, and increment the current number of retries n by 1. Interval adjustment: If the re-detection still fails to meet the requirements, and n < N, adjust the retry interval to T. n =T0×k n, If T1 = 2 seconds when n = 1, and T2 = 4 seconds when n = 2, then wait for T... n Then, adjustments and tests are performed again; termination criteria: if the retest meets the standard, or if n=N reaches the maximum number of retries, the retries are terminated. If the test meets the standard at the time of termination, the adjusted slot filling result is processed into the target text material according to the process in step 42; if n=N still does not meet the standard, a prompt "Manual intervention is required" is output, while all adjustment records and test results are retained for easy manual problem location.
[0157] The combination of precise adjustments guided by differential prompts and the optimized exponential backoff strategy not only avoids the inefficiency caused by blind adjustments, but also controls resource consumption through incremental intervals, which is different from the traditional fixed interval retry mode, thus improving the adjustment success rate and system resource utilization.
[0158] Optionally, an exponential backoff strategy is adopted to limit the number of retries, including: setting an initial retry interval and a maximum number of retries; re-testing after each adjustment of the slot filling result, and if the test still does not meet the standard, increasing the retry interval exponentially; stopping retries when the number of retries reaches the maximum number of retries or the retry interval exceeds the preset maximum interval, and if the test meets the standard at this time, using the adjusted slot filling result as the target text material.
[0159] Specifically, first, exam parameters and system resource configuration information are obtained. The exam parameters include the text generation complexity for the current exam level, and the system resource configuration information includes the currently available computing resources. Based on the text generation complexity and system resource configuration, a parameter decision matrix is constructed. The rows of this matrix represent the "exam level," and the columns represent the "suggested initial retry interval," "suggested maximum number of retry attempts," and "suggested maximum interval." The matrix element values are determined through statistical analysis of historical generation data. For example, basic-level text is less difficult to adjust, historically requiring an average of two retries to meet the standard, while advanced-level text is more difficult to adjust, requiring approximately four retries.
[0160] Parameter dynamic adaptation rules are set as follows: When the CPU utilization threshold is ≤60% and the memory usage limit is ≥80% in the system resource configuration, the upper limit suggested value in the matrix can be used; when the CPU utilization threshold is >70% and the memory usage limit is <60%, the lower limit suggested value in the matrix is used to balance retry efficiency and resource consumption. For example, for a basic-level exam with sufficient system resources, the initial retry interval is suggested to be 1 second, the maximum number of retries is suggested to be 3, and the preset maximum interval is suggested to be 8 seconds; for an advanced-level exam with limited system resources, the initial retry interval is suggested to be 2 seconds, the maximum number of retries is suggested to be 4, and the preset maximum interval is suggested to be 16 seconds.
[0161] Based on the dynamic parameter adaptation rules, corresponding values are selected from the parameter decision matrix as the final settings for the initial retry interval T0, the maximum number of retries N_max, and the preset maximum interval T_max. These parameters are stored in the retry control parameter table, and a timestamp of the parameter's effective date and the corresponding examination level identifier are added to the parameter table for easy tracking and adjustment later. This dynamic parameter setting method differs from the traditional fixed parameter mode, allowing for flexible adjustment according to the complexity of the actual scenario and the system state, avoiding resource waste or insufficient retries.
[0162] Then, obtain the retry control parameter table, the adjusted slot filling result and the detection result judgment matrix. Read the initial retry interval T0 and the exponent multiple k from the retry control parameter table. For example, it is set to 2 based on the exam scenario optimization to balance the interval increment speed and retry efficiency. Initialize the current retry count counter n to 0 and the current retry interval T_current to the initial retry interval T0.
[0163] The adjusted slot filling results are re-entered into the aforementioned detection process, namely, out-of-scope detection, length detection, and scene consistency detection, to obtain a new round of detection result judgment matrix. The overall detection results are then checked against the judgment rules to ensure they meet the standards. If the overall detection results meet the standards, the process terminates; otherwise, it executes a retry interval update operation: the current retry count counter n is incremented by 1 to obtain the updated current retry count n_new = n + 1, and the current retry interval T_current is calculated using the formula "T_new = T_current × k" to obtain the updated retry interval T_new.
[0164] To prevent the updated retry interval T_new from growing indefinitely, an interval upper limit check is introduced: T_new is compared with the preset maximum interval T_max in the retry control parameter table. If T_new ≤ T_max, the current retry interval is updated to T_new; if T_new > T_max, the current retry interval is forcibly set to T_max, and an interval over-limit log is generated, recording the over-limit time, the current number of retries, and the difference between the actual calculated interval and T_max. The updated current retry count n_new and the current retry interval T_new or T_max are synchronized to the retry status record table. This table stores the number of retries, the interval, and the corresponding detection results for each retry in chronological order, forming a retry process trajectory.
[0165] Based on the updated current retry interval T_new or T_max, a timed wait mechanism is initiated, with the wait duration being the current retry interval. During the wait, resource usage for this text generation task is paused, freeing up CPU and memory for other tasks. After the wait ends, the process returns to the slot filling result adjustment stage. A new differential hint is generated based on the latest detection result judgment matrix, and the slot filling result is adjusted again, entering the next round of detection and retry interval update cycle. This mechanism, combining interval updates and resource release, reduces the pressure of repeated detection in a short period through exponentially increasing intervals and improves the overall system throughput through resource scheduling.
[0166] Next, obtain the retry status record table, the retry control parameter table, and the latest detection result judgment matrix. Read the current retry count n_new and the current retry interval T_current from the retry status record table, and read the maximum retry count N_max and the preset maximum interval T_max from the retry control parameter table.
[0167] The system performs dual termination condition checks: Retry count termination condition: Check whether the current retry count n_new has reached the maximum retry count N_max, i.e., n_new≥N_max; Retry interval termination condition: Check whether the current retry interval T_current exceeds the preset maximum interval T_max, i.e., T_current>T_max.
[0168] If any of the above termination conditions are met, the retry process stops; if none are met, the process returns to the re-detection step to continue the next round of adjustment, detection, and interval update. After stopping the retry, the latest detection result judgment matrix is checked again to determine whether the overall detection result meets the standard: if it meets the standard, the current adjusted slot filling result is processed according to the standard-compliant text normalization process, including format unification, syntax verification, and semantic optimization, to generate standardized text and associate it with the detection result metadata, outputting it as the target text material; if it still does not meet the standard, a retry termination report is generated, which includes the number of retries, intervals, detection result details, and reasons for non-compliance, and triggers a manual intervention prompt, such as displaying "Retry has terminated, manual adjustment of slot filling result is required" on the system console, to facilitate quick manual problem location.
[0169] To ensure the traceability of the retry process, the retry status record table, retry termination report, and the corresponding text generation task identifier are associated and stored in the retry log database. The log database supports queries by exam level, generation time, retry result, and other dimensions. This design of dual termination conditions and result classification avoids system resource exhaustion caused by infinite retries and provides data support for subsequent optimization through complete log records. Unlike the traditional single termination condition model, this design improves the reliability and maintainability of the retry mechanism.
[0170] This application also provides a text material generation apparatus, including:
[0171] The vocabulary rule generation module is used to classify words and attach grammatical tags based on the original vocabulary database and exam parameters, associate synonyms of the classified words, generate a hierarchical dynamic vocabulary database, and based on the hierarchical dynamic vocabulary database, preset the out-of-syllabus detection process of the text to be tested and generate out-of-syllabus detection execution rules.
[0172] The configuration result acquisition module is used to construct a hierarchical-question type sparse matrix based on the exam parameters and the hierarchical dynamic vocabulary library, extract effective question type combinations through bitwise operations, and generate question type configuration results;
[0173] The slot filling module is used to construct a scenario constraint graph based on the question type configuration results, call the out-of-syllabus detection execution rules to filter out non-out-of-syllabus words, and combine graph neural networks to calculate the slot semantic energy value of non-out-of-syllabus words to optimize filling and generate slot filling results.
[0174] The text material generation module is used to perform out-of-scope detection on the words in the slot filling result based on the hierarchical dynamic vocabulary library, call the out-of-scope detection execution rules, simultaneously perform length and scene consistency detection, and generate target text material based on the detection results.
[0175] Specifically, the vocabulary rule generation module classifies words and adds grammatical tags based on the original vocabulary database and exam parameters, associates synonyms of the classified words, generates a hierarchical dynamic vocabulary database, and based on the hierarchical dynamic vocabulary database, presets the out-of-syllabus detection process for the text to be tested and generates out-of-syllabus detection execution rules.
[0176] Then, the configuration result acquisition module constructs a hierarchical-question type sparse matrix based on the exam parameters and a hierarchical dynamic vocabulary library. It then extracts effective question type combinations through bitwise operations to generate the question type configuration result. Next, the slot filling module constructs a scenario constraint graph based on the question type configuration result, calls out-of-syllabus detection rules to filter out non-out-of-syllabus words, and uses a graph neural network to calculate the slot semantic energy value of non-out-of-syllabus words to optimize filling, generating the slot filling result.
[0177] Finally, the text material generation module, based on the hierarchical dynamic vocabulary library, calls the out-of-scope detection execution rules to perform out-of-scope detection on the words in the slot filling results, simultaneously performs length and scene consistency detection, and generates target text material based on the detection results.
[0178] This application provides a text material generation device, which can be a terminal or a server, including a processor and a memory. The memory stores at least one instruction or at least one program, which is loaded and executed by the processor to implement the text material generation method provided in the above method embodiments.
[0179] Memory is used to store software programs and modules. The processor executes these stored software programs and modules to perform various functional applications and generate textual materials. Memory mainly includes a program storage area and a data storage area. The program storage area stores the operating system, application programs required for functions, etc.; the data storage area stores data created based on device usage, etc. Furthermore, memory may include high-speed random access memory (RAM) and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory may also include a memory controller to provide the processor with access to the memory.
[0180] The methods and embodiments provided in this application can be executed in electronic devices such as mobile terminals, computer terminals, servers, or similar computing devices. Figure 3 This is a hardware structure block diagram of an electronic device for a method of generating text materials provided in an embodiment of this application. (See diagram below.) Figure 3As shown, the electronic device 900 can vary significantly due to differences in configuration or performance. It may include one or more central processing units (CPUs) 910 (CPUs 910 may include, but are not limited to, microprocessors such as MCUs or programmable logic devices such as FPGAs), a memory 930 for storing data, and one or more storage media 920 (e.g., one or more mass storage devices) for storing application programs 923 or data 922. The memory 930 and storage media 920 may be temporary or persistent storage. The program stored in the storage media 920 may include one or more modules, each module may include a series of instruction operations on the electronic device. Furthermore, the CPU 910 may be configured to communicate with the storage media 920 and execute the series of instruction operations in the storage media 920 on the electronic device 900. Electronic device 900 may also include one or more power supplies 960, one or more wired or wireless network interfaces 950, one or more input / output interfaces 940, and / or one or more operating systems 921, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0181] The input / output interface 940 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the electronic device 900. In one example, the input / output interface 940 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 940 may be a radio frequency (RF) module for wireless communication with the Internet.
[0182] Embodiments of this application also provide a computer-readable storage medium, which can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method for generating text material in the method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the method for generating text material provided in the above method embodiment.
[0183] Optionally, in this embodiment, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0184] According to one aspect of this application, a computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
[0185] It should be understood that this application is not limited to the processes and structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method of generating a text material, characterized by, The method comprises the following steps: Based on the original vocabulary library and the test parameters, the vocabulary is graded and a grammar tag is added, and then the synonym groups of the graded vocabulary are associated to generate a hierarchical dynamic vocabulary library, and based on the hierarchical dynamic vocabulary library, a super-standard detection process of the to-be-detected text is preset to generate a super-standard detection execution rule; According to the test parameters and the hierarchical dynamic vocabulary library, a hierarchical-question type sparse matrix is constructed, and effective question type combinations are extracted from the hierarchical-question type sparse matrix by bit operation to generate a question type configuration result; According to the question type configuration result, a scene constraint graph is constructed, and a non-super-standard vocabulary is screened by calling the super-standard detection execution rule, and a slot filling result is generated by combining the graph neural network to calculate the slot semantic energy value of the non-super-standard vocabulary to optimize filling, wherein the slot semantic energy value comprises coherence energy, context energy and frequency energy, and the coherence energy, context energy and frequency energy are calculated by integrating according to a set weight; The coherence energy is used to determine the semantic matching degree between slots, the context energy is used to determine the satisfaction degree of logical constraints between slots, and the frequency energy is used to determine the usage frequency of slot vocabulary; Based on the hierarchical dynamic vocabulary library, the super-standard detection execution rule is called to perform super-standard detection on the vocabulary in the slot filling result, and length and scene consistency detection are simultaneously performed, and a target text material is generated based on the detection result.
2. The generation method of claim 1, wherein, The method comprises the following steps: Based on the original vocabulary library and the test parameters, the vocabulary is graded and a grammar tag is added, and then the synonym groups of the graded vocabulary are associated to generate a hierarchical dynamic vocabulary library, and based on the hierarchical dynamic vocabulary library, a super-standard detection process of the to-be-detected text is preset to generate a super-standard detection execution rule; According to the test parameters and the hierarchical dynamic vocabulary library, a hierarchical-question type sparse matrix is constructed, and effective question type combinations are extracted from the hierarchical-question type sparse matrix by bit operation to generate a question type configuration result; According to the question type configuration result, a scene constraint graph is constructed, and a non-super-standard vocabulary is screened by calling the super-standard detection execution rule, and a slot filling result is generated by combining the graph neural network to calculate the slot semantic energy value of the non-super-standard vocabulary to optimize filling, wherein the slot semantic energy value comprises coherence energy, context energy and frequency energy, and the coherence energy, context energy and frequency energy are calculated by integrating according to a set weight; 3. The generation method of claim 2, wherein, The coherence energy is used to determine the semantic matching degree between slots, the context energy is used to determine the satisfaction degree of logical constraints between slots, and the frequency energy is used to determine the usage frequency of slot vocabulary; Based on the hierarchical dynamic vocabulary library, the super-standard detection execution rule is called to perform super-standard detection on the vocabulary in the slot filling result, and length and scene consistency detection are simultaneously performed, and a target text material is generated based on the detection result. The method comprises the following steps:
4. The generation method of claim 1, wherein, Based on the original vocabulary library and the test parameters, the vocabulary is graded and a grammar tag is added, and then the synonym groups of the graded vocabulary are associated to generate a hierarchical dynamic vocabulary library, and based on the hierarchical dynamic vocabulary library, a super-standard detection process of the to-be-detected text is preset to generate a super-standard detection execution rule; According to the test parameters and the hierarchical dynamic vocabulary library, a hierarchical-question type sparse matrix is constructed, and effective question type combinations are extracted from the hierarchical-question type sparse matrix by bit operation to generate a question type configuration result; 5. The generation method of claim 1, wherein, Determine the corresponding question type of each test level according to the test parameters, and determine the vocabulary difficulty adaptation range of the corresponding question type of each test level in combination with the hierarchical dynamic vocabulary library; Based on the mapping relationship between each test level and the corresponding question type and vocabulary difficulty adaptation range, a level-question type sparse matrix is constructed, and the level-question type sparse matrix supports hot loading configuration; Perform a bitwise AND operation on the question type identifier corresponding to the value representing "enabled" in the level-question type sparse matrix to filter the question type identifier that meets the current test level; Generate a question type configuration result according to the question type rule combination corresponding to the filtered question type identifier.
6. The generation method of claim 1, wherein, Construct a scene constraint graph according to the question type configuration result, and call the out-of-context detection execution rule to filter non-contextual vocabulary, calculate the slot semantic energy value of the non-contextual vocabulary by combining the graph neural network to optimize filling, and generate a slot filling result, including: Determine the scene requirements for generating text according to the question type configuration result, construct a scene-intent-role constraint relationship graph in combination with scene knowledge, and determine the mandatory slot and mutual exclusion rule; Call the out-of-context detection execution rule to perform out-of-context detection on the candidate vocabulary to be filled into the slot, and filter out the non-contextual vocabulary; Model the semantic association between slots corresponding to the non-contextual vocabulary based on the graph neural network, and calculate the slot semantic energy value; Optimize the filling order and combination of non-contextual vocabulary according to the slot semantic energy value, while checking whether the mandatory slot is complete, triggering automatic completion for missing slots to generate a slot filling result.
7. The generation method of claim 6, wherein, The calculation of the slot semantic energy value includes: Take each non-contextual vocabulary corresponding slot as a graph node, and the semantic association between slots as a graph edge, calculate the semantic matching score of each graph node and other graph nodes based on the message passing mechanism of the graph neural network, and weight the sum to obtain the coherence energy; Check the logical constraints of each non-contextual vocabulary corresponding slot and other filled slots, and obtain the context energy according to the constraint satisfaction degree; Statistically analyze the frequency of each non-contextual vocabulary in historical slot filling data, normalize the frequency, and calculate the frequency energy by combining the preset weight. Integrate the coherence energy, context energy, and frequency energy according to the set weight to calculate the slot semantic energy value.
8. The generation method of claim 1, wherein, Based on the hierarchical dynamic vocabulary library, the out-of-context detection execution rule is called to perform out-of-context detection on the vocabulary in the slot filling result, and the length and scene consistency detection is performed synchronously, including: Based on the hierarchical dynamic vocabulary library, the out-of-context detection execution rule is called to perform the out-of-context detection on the vocabulary in the slot filling result, and the out-of-context vocabulary is filtered; Detect whether the text length of the slot filling result meets the set length requirement to perform length detection; Input the text generation prompt and slot filling result into the lightweight bidirectional encoder representation language model, output the logical matching degree, and thus perform scene consistency detection.
9. The generation method of claim 1, wherein, Generate target text materials based on the detection results, including: Determine whether the detection results of the out-of-context detection, length detection, and scene consistency detection all meet the standard; If the detection results all meet the standard, directly take the slot filling result as the target text material; If the detection result does not meet the standard, a difference prompt is automatically generated, the slot filling result is adjusted based on the difference prompt, and then re-detected until the detection result meets the standard, so as to generate the target text material; The difference prompt contains reason information of detection failure, and an exponential backoff strategy is used to limit the number of retries.
10. The method of generating of claim 9, wherein, The exponential backoff strategy is used to limit the number of retries, including: Setting an initial retry interval and a maximum number of retries; After each adjustment of the slot filling result, if the detection still does not meet the standard, the retry interval is increased by an exponential factor; When the number of retries reaches the maximum number of retries or the retry interval exceeds the preset maximum interval, stop retrying, and if the detection meets the standard at this time, use the adjusted slot filling result as the target text material.
11. An apparatus for generating text material, characterized by It includes: A vocabulary rule generation module is used to grade the vocabulary based on the original vocabulary library and the test parameters, and to add grammar tags, then associate the near-synonyms of the graded vocabulary, to generate a hierarchical dynamic vocabulary library, and based on the hierarchical dynamic vocabulary library, preset the out-of-context detection process of the text to be detected, to generate the out-of-context detection execution rule; A configuration result acquisition module is used to construct a hierarchical-question type sparse matrix based on the test parameters and the hierarchical dynamic vocabulary library, extract effective question type combinations by bit operation on the hierarchical-question type sparse matrix, and generate a question type configuration result; A slot filling module is used to construct a scene constraint graph based on the question type configuration result, and to filter non-context vocabulary by calling the out-of-context detection execution rule, and to optimize the filling by calculating the slot semantic energy value of the non-context vocabulary based on the graph neural network, to generate the slot filling result, the slot semantic energy value including coherence energy, context energy and frequency energy, which are calculated by integrating the coherence energy, context energy and frequency energy according to the set weight; The coherence energy is used to determine the degree of semantic matching between slots, the context energy is used to determine the degree of satisfaction of logical constraints between slots, and the frequency energy is used to determine the frequency of use of slot vocabulary; A text material generation module is used to execute out-of-context detection on the vocabulary in the slot filling result based on the hierarchical dynamic vocabulary library and the out-of-context detection execution rule, to synchronize the execution of length and scene consistency detection, and to generate the target text material based on the detection result.
12. A computer device, comprising: The device includes a processor and a memory, the memory stores at least one instruction or at least one program, the at least one instruction or the at least one program is loaded and executed by the processor to realize the text material generation method of any one of claims 1-10.
13. A computer program, characterized in that, The computer program includes computer instructions, which are executed by the processor to realize the text material generation method of any one of claims 1- 10.
Citation Information
Patent Citations
Self-adaptive new word labeling system and method based on vocabulary text difficulty
CN112949259A
Middle and primary school test question intelligent generation method based on education big model
CN121257488A