Adaptive writing method and system based on support style feature extraction and template generation
By constructing a stylistic feature reference space and adaptive template generation, the problems of insufficient consistency and adaptive generation in existing technologies are solved, thereby improving stability and consistency, and enhancing the flexibility and quality of the writing process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-28
AI Technical Summary
Existing intelligent writing technologies lack systematic modeling of stylistic features in professional writing across multiple scenarios, resulting in insufficient stylistic consistency and adaptive generation, making it difficult to maintain stable sentence structure and logical organization in long texts or multiple rounds of generation.
By acquiring historical text samples and current context of the target writing task, a set of stylistic description information is constructed. Parameters such as sentence length features, logical connection density, and the proportion of professional terms are extracted to generate a stylistic feature reference space. Template structures are automatically generated within the advantageous stylistic range. Adaptive text generation is performed by combining contextual semantic density and paragraph progression status, and stylistic consistency assessment and dynamic adjustment are conducted.
It achieves significant improvement in stylistic stability and overall consistency while maintaining semantic accuracy, avoiding stylistic drift, enhancing the flexibility and adaptability of the writing process, and improving the generation quality and controllability of professional writing tasks in multiple scenarios.
Smart Images

Figure CN121936469A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of adaptive writing technology, and more specifically, to an adaptive writing method and system based on supporting stylistic feature extraction and template generation. Background Technology
[0002] In multi-scenario professional writing, writing systems not only need to generate semantically correct text, but also need to maintain a stable and controllable style across different application scenarios. However, most existing intelligent writing technologies rely on fixed templates or end-to-end generation models. Their generation process is usually driven primarily by local contextual semantics, lacking systematic modeling and continuous constraints on stylistic features. This leads to cumulative shifts in sentence structure, logical organization, and word choice as the context changes, especially in long texts or multi-round generation processes. Particularly in writing scenarios with high requirements for stylistic consistency and logical rigor, such as technical specifications, operational guidelines, and evaluation reports, the rigid use of templates limits expressive flexibility, making it difficult for the text to dynamically adjust its structure and expression according to the task objectives. This creates an inherent contradiction between stylistic stability and adaptive generation. Due to the lack of effective modeling of the interaction between stylistic features and the writing process, existing technologies struggle to determine in real time whether the current text deviates from the target style during generation, and cannot adjust the generation strategy accordingly based on the degree of deviation. Ultimately, this results in stylistic drift, structural breaks, and insufficient overall controllability. Summary of the Invention
[0003] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide an adaptive writing method and system based on supporting stylistic feature extraction and template generation, in order to solve the problems mentioned in the background art.
[0004] To achieve the above objectives, the present invention provides the following technical solution: An adaptive writing method that supports stylistic feature extraction and template generation includes the following steps: Obtain historical text samples and current writing context corresponding to the target writing task, perform syntactic parsing and semantic structure annotation on the text, and construct a set of stylistic description information; Based on the aforementioned text description information set, text feature parameters such as sentence length, logical connection density, proportion of technical terms, and frequency of limiting expressions are extracted to obtain a text feature reference space. Based on the real-time features of the current writing context and the style feature reference space, similarity calculation is performed to obtain the style support parameters of each candidate style type, and the advantageous style range corresponding to the target writing task is determined. Within the advantageous writing style range, a corresponding writing template structure is automatically generated based on the structural distribution pattern of writing style features. The template structure includes fixed semantic slots, variable expression slots, and logical constraint rules, and weights are assigned to each slot to obtain a template constraint model. Under the influence of the template constraint model, combined with the contextual semantic density and paragraph progression state, text content that satisfies the target stylistic features is adaptively generated. The generated text is evaluated for stylistic feature consistency. When the consistency evaluation score deviates from the preset consistency evaluation score threshold, the template slot weights are dynamically adjusted and the text is regenerated.
[0005] In a preferred embodiment, the process of obtaining historical text samples and the current writing context corresponding to the target writing task, performing syntactic parsing and semantic structure annotation on the text, and constructing a stylistic description information set is as follows: In historical text samples and the current writing context, each text is segmented into sentences and paragraphs, and natural language processing tools are used to perform part-of-speech tagging, syntactic dependency analysis and semantic role tagging to extract sentence structure, logical connections and organizational features of topic paragraphs. For the syntactic structure of the above text, define syntactic vectors. Its components include sentence length Clause depth and sentence type encoding For semantic connection relationships, construct a semantic adjacency matrix. Its semantic adjacency matrix elements in This indicates the strength of the logical connection between sentence j and sentence k; Paragraph organization features are expressed as paragraph embedding vectors express; The eigenvectors and matrices are sorted and normalized in time order, and then processed according to the syntactic vectors. Semantic adjacency matrix and paragraph embedding vector Calculate the stylistic correlation coefficient between text fragments: Arrange the stylistic relevance coefficients of all fragments in textual order to obtain the final stylistic description information set. .
[0006] In a preferred embodiment, the process of extracting stylistic feature parameters such as sentence length, logical connection density, proportion of technical terms, and frequency of limiting expressions based on the stylistic description information set to obtain the stylistic feature reference space is as follows: In the set of text description information, the sentence is the smallest unit of analysis. The number of words in each sentence in each text sample is counted, and the average sentence length is calculated. Based on the semantic structure annotation results, logical connectors in the text are identified, and the frequency of occurrence of logical connectors in the text is counted as a logical connector density parameter. By combining a terminology database, the word units in the text are matched, the frequency of professional terms is counted, and the ratio of professional terms to the total number of word units in the text is normalized to calculate the percentage parameter of professional terms. For the frequency of restrictive expressions, we identify the patterns of restrictive expressions and count their proportion of occurrence in sentences, using this as the parameter for the frequency of restrictive expressions. The text feature vector is obtained by combining the average sentence length, logical connection density parameter, professional terminology ratio parameter, and restrictive expression frequency parameter. For different text types, we collect the corresponding text feature vector sets and perform statistical analysis on each feature dimension. The feature distribution areas of each genre are uniformly mapped to the same feature space to construct a genre feature reference space.
[0007] In a preferred embodiment, the process of calculating the similarity between the real-time features of the current writing context and the style feature reference space to obtain the style support parameters of each candidate style type, and determining the dominant style interval corresponding to the target writing task, is as follows: During the current writing process, feature extraction processing is performed on the real-time writing context in the same way as the historical text to obtain the average sentence length, logical connection density, proportion of professional terms and frequency of limiting expressions corresponding to the current context, and to obtain the real-time stylistic feature vector of the current context. For each candidate text type in the text feature reference space Obtain its corresponding feature distribution, using the feature mean vector. and covariance matrix Describe it; The similarity between the real-time text style feature vector and the feature distribution of each candidate text style type is calculated to construct the text style support parameter; The support parameters of each candidate text type are normalized and sorted according to their magnitude. The text type with the highest support is selected, and its corresponding feature distribution region is determined as the dominant text type interval for the target writing task.
[0008] In a preferred embodiment, within the dominant genre range, a corresponding writing template structure is automatically generated based on the structural distribution pattern of genre features. The template structure includes fixed semantic slots, variable expression slots, and logical constraint rules. The process of assigning weights to each slot to obtain a template constraint model is as follows: After determining the advantageous text style range corresponding to the target writing task, the structural annotation results of historical text samples within the advantageous text style range are retrieved, and the overall organizational form of the text is statistically analyzed to obtain typical structural patterns. According to the structural pattern, the text is divided into several semantic functional units, and according to their stable occurrence position and occurrence probability in the text, they are divided into fixed semantic slots and variable expression slots. For the connection method between adjacent semantic slots, extract the logical relationship type and formalize it into logical constraint rules; Based on the statistical distribution of the stylistic feature parameters within the dominant stylistic interval, a weight coefficient is assigned to each semantic slot. The fixed semantic slots, variable expression slots, logical constraint rules, and corresponding slot weights are integrated to form a constraint model for the writing template.
[0009] In a preferred embodiment, under the influence of the template constraint model, the process of adaptively generating text content that satisfies the target stylistic features, by combining contextual semantic density and paragraph progression state, is as follows: During the text generation process, the target semantic slot to be generated is determined based on the arrangement order and weight information of each semantic slot in the template constraint model, and the semantic function type and logical constraint rules corresponding to the slot are obtained. Calculate the semantic density parameter for the current writing context; The paragraph progression status parameters are determined based on the number of paragraphs in the generated text and the current semantic slot's position in the template. The generation intensity adjustment coefficient of the current slot is calculated by combining the semantic slot weight, semantic density parameter, and paragraph advancement status parameter. Based on the generation intensity adjustment coefficient and the corresponding logical constraint rules, the text generation model is invoked to generate content for the current semantic slot. Repeat the above process to generate the content of each semantic slot in turn, and dynamically update the context semantic density and paragraph progression status during the generation process until all semantic slots are generated, and obtain complete text content that meets the constraints of the target stylistic features.
[0010] In a preferred embodiment, the generated text undergoes a stylistic feature consistency assessment. When the consistency evaluation score deviates from a preset consistency evaluation score threshold, the process of dynamically adjusting the template slot weights and regenerating the text is as follows: After completing one round of text generation, the generated text is subjected to a stylistic feature extraction process consistent with the historical text and writing context to obtain the average sentence length, logical connection density, proportion of professional terms and frequency of limiting expressions corresponding to the generated text, forming a stylistic feature vector of the generated text. The stylistic feature vector of the generated text is compared with the feature distribution in the advantageous stylistic interval corresponding to the target writing task. The degree of deviation of the generated text from the target stylistic is calculated to obtain the stylistic consistency evaluation quantity. The stylistic consistency evaluation value is compared with a preset consistency evaluation value threshold. When the stylistic consistency evaluation value is greater than or equal to the consistency evaluation value threshold, it is determined that the stylistic features of the generated text meet the target requirements, and the generated text is directly output. When the stylistic consistency evaluation value is less than the consistency evaluation value threshold, it is determined that the generated text has a risk of stylistic deviation. When a stylistic deviation is detected, the influence weight of each semantic slot on the stylistic deviation is calculated in reverse based on the contribution of each stylistic feature to the consistency evaluation, and then the weight of the corresponding semantic slot in the template constraint model is dynamically adjusted. After completing the template slot weight adjustment, the text generation process is re-executed according to the updated template constraint model, and the above consistency assessment and weight adjustment steps are repeated until the stylistic consistency evaluation quantity meets the preset consistency evaluation quantity threshold.
[0011] In a preferred embodiment, an adaptive writing system that supports stylistic feature extraction and template generation includes a stylistic perception acquisition module, a stylistic feature extraction module, a stylistic support determination module, a template structure generation module, a constraint generation execution module, and a stylistic consistency feedback module. The text style perception and acquisition module is used to acquire historical text samples and the current writing context corresponding to the target writing task, perform syntactic parsing and semantic structure annotation on the text, and construct a text style description information set. The stylistic feature extraction module is used to extract stylistic feature parameters such as sentence length, logical connection density, proportion of professional terms, and frequency of limiting expressions based on the stylistic description information set, so as to obtain a stylistic feature reference space. The style support determination module is used to calculate the similarity between the real-time features of the current writing context and the style feature reference space to obtain the style support parameters of each candidate style type and determine the dominant style range corresponding to the target writing task. The template structure generation module is used to automatically generate a corresponding writing template structure within the advantageous text style range based on the structural distribution pattern of text style features. The template structure includes fixed semantic slots, variable expression slots, and logical constraint rules, and assigns weights to each slot to obtain a template constraint model. The constraint generation execution module is used to adaptively generate text content that satisfies the target stylistic features by combining the contextual semantic density and paragraph progression state under the action of the template constraint model. The stylistic consistency feedback module is used to evaluate the stylistic feature consistency of the generated text. When the consistency evaluation value deviates from the preset consistency evaluation value threshold, the template slot weight is dynamically adjusted and the text is regenerated.
[0012] The technical effects and advantages of this invention are as follows: 1. This invention organically integrates stylistic feature modeling, template structure generation, and writing process control, achieving perceptible, constrainable, and adjustable control over the writing generation process. Compared with existing technologies that rely solely on fixed templates or end-to-end generation, it can significantly improve stylistic stability and overall consistency while maintaining the semantic accuracy of the text.
[0013] 2. This invention constructs a stylistic feature reference space and introduces a stylistic support and dominant stylistic interval determination mechanism, enabling the writing system to actively identify and select the target stylistic during the generation process. This avoids stylistic drift caused by contextual accumulation in long texts and multi-round generation. At the same time, based on the template constraint model automatically generated by the dominant stylistic interval, it combines fixed semantic structure with variable expression methods. While ensuring logical integrity and expression standardization, it improves the flexibility and adaptability of the writing process. By evaluating the consistency of stylistic features of the generated text and dynamically adjusting the template slot weights, a closed-loop adaptive control mechanism is formed, enabling the generated results to continuously converge towards the target stylistic, thereby effectively reducing structural breaks and style loss of control, and improving the overall generation quality and controllability in multi-scenario professional writing tasks. Attached Figure Description
[0014] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings; Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 This is a flowchart of the system in Embodiment 2 of the present invention. Detailed Implementation
[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0016] Example 1: Figure 1 The present invention provides an adaptive writing method based on supporting stylistic feature extraction and template generation, comprising the following steps: Obtain historical text samples and current writing context corresponding to the target writing task, perform syntactic parsing and semantic structure annotation on the text, and construct a set of stylistic description information; Based on the aforementioned text description information set, text feature parameters such as sentence length, logical connection density, proportion of technical terms, and frequency of limiting expressions are extracted to obtain a text feature reference space. Based on the real-time features of the current writing context and the style feature reference space, similarity calculation is performed to obtain the style support parameters of each candidate style type, and the advantageous style range corresponding to the target writing task is determined. Within the advantageous writing style range, a corresponding writing template structure is automatically generated based on the structural distribution pattern of writing style features. The template structure includes fixed semantic slots, variable expression slots, and logical constraint rules, and weights are assigned to each slot to obtain a template constraint model. Under the influence of the template constraint model, combined with the contextual semantic density and paragraph progression state, text content that satisfies the target stylistic features is adaptively generated. The generated text is evaluated for stylistic feature consistency. When the consistency evaluation score deviates from the preset consistency evaluation score threshold, the template slot weights are dynamically adjusted and the text is regenerated.
[0017] In this embodiment of the invention, the process of obtaining historical text samples and the current writing context corresponding to the target writing task, performing syntactic parsing and semantic structure annotation on the text, and constructing a stylistic description information set containing sentence distribution, semantic connection relationships, and paragraph organization features is as follows: In historical text samples and the current writing context, each text is segmented into sentences and paragraphs, and natural language processing tools are used to perform part-of-speech tagging, syntactic dependency analysis and semantic role tagging to extract sentence structure, logical connections and organizational features of topic paragraphs. For the syntactic structure of the above text, define syntactic vectors. Its components include sentence length Clause depth and sentence type encoding For semantic connection relationships, construct a semantic adjacency matrix. Its semantic adjacency matrix elements in This indicates the strength of the logical connection between sentence j and sentence k; Paragraph organization features are expressed as paragraph embedding vectors This indicates that the components include the position of the topic sentence and the density of core words, which are used to characterize the macro structure of the text; The eigenvectors and matrices are sorted and normalized in time order, and then processed according to the syntactic vectors. Semantic adjacency matrix and paragraph embedding vector Calculate the stylistic correlation coefficient between text fragments: For example, the expression for calculating the stylistic relevance coefficient is as follows: ,in Let u be the syntactic vector of the text segment. Let v be the syntactic vector of the text segment. For the paragraph embedding vector of text segment u, For the paragraph embedding vector of text segment v, Let be the semantic adjacency matrix between text fragment u and text fragment v. , , They are respectively , , The preset scaling factor is used to balance the contributions of syntax, paragraph and semantic connectivity; Arrange the stylistic relevance coefficients of all fragments in textual order to obtain the final stylistic description information set. It not only reflects the local syntactic and semantic features of a single text, but also depicts the interrelationships between different text fragments and contexts.
[0018] In this embodiment of the invention, the process of extracting stylistic feature parameters such as sentence length, logical connection density, proportion of specialized terms, and frequency of limiting expressions based on the stylistic description information set, and statistically fitting the feature distributions of different stylistic types to obtain the stylistic feature reference space is as follows: In the text description information set, the sentence is the smallest unit of analysis. The number of words in each sentence in each text sample is counted and the average sentence length is calculated to characterize the overall rhythm and sentence complexity of the text. For example, the average sentence length of the nth text Defined as: ,in This represents the number of sentences in the text. Let be the number of lexical units in the i-th sentence; Based on the semantic structure annotation results, logical connectors representing causal, progressive, adversative, and parallel relationships in the text are identified, and the frequency of occurrence of logical connectors in the text is used as a logical connector density parameter. , used to characterize the explicitness of textual logic; By combining domain dictionaries or terminology databases, word units in the text are matched, the frequency of professional terms is counted, and the ratio (frequency of professional terms / total number of word units in the text) is normalized and calculated to determine the percentage of professional terms. This reflects the level of specialization of the text; For the frequency of restrictive expressions, we identify restrictive or limiting expression patterns such as "should," "may," "at least," and "not exceeding," and statistically analyze their proportion of occurrence in sentences, using this as a parameter for the frequency of restrictive expressions. It is used to describe the standardization and constraint strength of text expression; Average sentence length Logical connection density parameters Parameters of the proportion of professional terms and limiting expression frequency parameters The combination yields the stylistic feature vector: ; For different text types, a set of text feature vectors corresponding to the text samples is collected, and statistical analysis is performed on each dimension of the features. Preferably, the mean and variance are used to describe the feature distribution, forming the feature distribution region corresponding to each text type. The feature distribution areas of each text type are uniformly mapped to the same feature space to construct a text feature reference space, which is used to describe the differences in sentence complexity, logical explicitness and expressive constraint strength of different text types.
[0019] In this embodiment of the invention, the process of calculating the similarity between the real-time features of the current writing context and the style feature reference space to obtain the style support parameters of each candidate style type, and determining the dominant style range corresponding to the target writing task, is as follows: During the current writing process, feature extraction processing is performed on the real-time writing context in the same manner as historical texts to obtain the average sentence length, logical connection density, proportion of technical terms, and frequency of limiting expressions corresponding to the current context, thus obtaining the real-time stylistic feature vector of the current context: ,in, This indicates the average sentence length in the current context. Indicates logical connection density. Indicates the percentage of technical terms. Indicates the frequency of limiting expressions; For each candidate text type in the text feature reference space Obtain its corresponding feature distribution, using the feature mean vector. and covariance matrix This description is used to characterize the distribution range of this text type in the multidimensional feature space; The real-time text feature vector Similarity is calculated between the feature distribution of each candidate text type and the text type support parameters are constructed. For example, Mahalanobis distance is used. The similarity is calculated by indicating the degree of deviation between the current context and the k-th text type. ; According to the Mahalanobis distance Constructing stylistic support parameters This is used to quantify the degree of matching between the current context and the k-th text type. For example, the stylistic support parameter The calculation formula is as follows: ; It should be noted that the stylistic support parameter The larger the value, the higher the support of the current writing context for this genre; The support parameters of each candidate text type are normalized and sorted according to the size of the support parameters. The text type with the highest support is selected, and its corresponding feature distribution area is determined as the dominant text type interval for the target writing task. It should be noted that the dominant style range not only reflects the style type that best matches the current context, but also limits the range of fluctuations allowed in the style feature parameters during subsequent writing, thus providing a constraint basis for template generation and adaptive writing control.
[0020] In this embodiment of the invention, within the dominant text style interval, a corresponding writing template structure is automatically generated based on the structural distribution pattern of text style features. The template structure includes fixed semantic slots, variable expression slots, and logical constraint rules. The process of assigning weights to each slot to obtain a template constraint model is as follows: After determining the advantageous text style range corresponding to the target writing task, the structural annotation results of historical text samples within the advantageous text style range are retrieved. The overall organizational form of the text is statistically analyzed, and the paragraph hierarchy, functional paragraph order, and core semantic unit distribution patterns are extracted to obtain the typical structural pattern used to characterize the text style. Based on the structural pattern, the text is divided into several semantic functional units, and according to their stable occurrence positions and probabilities in the text, they are divided into fixed semantic slots and variable expression slots: In the historical text samples corresponding to the dominant text style interval, the text is functionally segmented according to the paragraph level annotation results, and each paragraph is mapped to a semantic functional unit to represent the independent semantic action block in the text; wherein, the semantic functional unit may include background description unit, condition constraint unit, process description unit or result description unit; Each semantic functional unit is numbered based on its occurrence position in the text, and its relative position distribution in different text samples is statistically analyzed. The average position stability of the j-th semantic functional unit is defined. for: ,in, This indicates the normalized position index of the semantic functional unit in the text. Its positional variance, The preset maximum position fluctuation threshold; At the same time, the frequency of occurrence of each semantic functional unit in historical text samples is statistically analyzed, and its occurrence probability is defined. for: ,in, This represents the number of texts containing the j-th semantic functional unit. Indicates the total number of texts included in the statistics; Based on average position stability With probability of occurrence Construct a semantic slot discrimination function: ,in, This is the semantic slot discrimination value. and These are the average position stability With probability of occurrence The preset proportional coefficient is used to balance the influence of structural stability and frequency of occurrence. When the semantic slot discrimination value of a semantic functional unit is greater than or equal to the preset semantic slot discrimination value threshold, the semantic functional unit is determined as a fixed semantic slot; when the semantic slot discrimination value is less than the preset semantic slot discrimination value threshold, it is determined as a variable expression slot. It should be noted that by simultaneously introducing positional stability and occurrence probability for discrimination, the method can distinguish content units that are structurally necessary but whose expression is variable in the target text, thereby providing a clear structural constraint basis for subsequent template generation and adaptive writing. It should be noted that fixed semantic slots are used to carry the core semantic content that must be presented in this text style, while variable expression slots are used to accommodate differentiated expressions under different writing tasks. For the connection methods between adjacent semantic slots, we extract the commonly used logical relationship types, including causal, progressive, parallel and adversative relationships, and formalize them into logical constraint rules to limit the connection order and expression methods between slots. Based on the statistical distribution of the feature parameters of each text style within the dominant text style interval, a weight coefficient is assigned to each semantic slot to reflect the importance of the slot in the target text style. For example, the weight of the j-th slot is defined as: ,in, This represents the frequency of occurrence of the j-th semantic slot in historical samples. This represents the total number of semantic slots, where m is the index of the semantic slot. The fixed semantic slots, variable expression slots, logical constraint rules, and corresponding slot weights are used. To achieve unified integration and form a constrained model for writing templates: ,in For the j-th semantic slot, The logical constraint rules associated with the j-th semantic slot describe the logical connection and expression constraints between the semantic slot and adjacent slots. The logical constraint rules include semantic order restrictions, logical relationship type constraints, and necessary conjunctions or sentence structure requirements to ensure the consistency of the overall text in terms of structure and logic. It should be noted that the template constraint model, through joint modeling of semantic slot structure and weights, not only limits the structural integrity of the writing content, but also provides a basis for adjusting the generation intensity and expression flexibility of different slots in the subsequent adaptive writing process.
[0021] In this embodiment of the invention, under the action of the template constraint model, the process of adaptively generating text content that satisfies the target stylistic features by combining the contextual semantic density and paragraph progression state is as follows: During the text generation process, the target semantic slot to be generated is determined based on the arrangement order and weight information of each semantic slot in the template constraint model, and the semantic function type and logical constraint rules corresponding to the slot are obtained to limit the topic scope and expression mode of the generated content.
[0022] Calculate the semantic density parameter for the current writing context to reflect the information carrying strength per unit text length; For example, the semantic density parameter of the current context Defined as: ,in, This indicates the number of semantic core concepts in the context. Indicates the total number of lexical units in the context; Based on the number of paragraphs in the generated text and the position of the current semantic slot in the template, the paragraph progress status parameters are determined to describe the text generation process and the overall structural completion. For example, define paragraph progression state parameters. for: ,in, Indicates the number of semantic slots that have been completed. This indicates the total number of semantic slots in the template; Comprehensive semantic slot weight semantic density parameters and paragraph progression status parameters Calculate the generation intensity adjustment coefficient for the current slot: ,in, This is the intensity adjustment coefficient. and Semantic density parameters Paragraph progression state parameters The preset scaling factor is used to balance the impact of information density and structural advancement on generation intensity; Based on the generation intensity adjustment coefficient and the corresponding logical constraint rules, the text generation model is invoked to generate content for the current semantic slot, so that it is consistent with the target text features in terms of information content, sentence complexity and expression norms. For example, the generation intensity adjustment coefficient is introduced as a control parameter into the decoding process of the text generation model. In each decoding step, the text generation model adjusts the probability distribution of candidate words according to the generation intensity adjustment coefficient of the current semantic slot, so that high-weight semantic units obtain a higher selection probability in the output. After decoding, the generation result is checked for logical consistency, and candidate texts that do not conform to the logical constraint rules are eliminated. Finally, the text content that matches the function of the current semantic slot and conforms to the target stylistic features is output. Repeat the above process to generate the content of each semantic slot in turn, and dynamically update the context semantic density and paragraph progression status during the generation process until all semantic slots are generated, and obtain complete text content that meets the constraints of the target stylistic features.
[0023] In this embodiment of the invention, the generated text undergoes a stylistic feature consistency assessment. When the consistency evaluation score deviates from a preset consistency evaluation score threshold, the process of dynamically adjusting the template slot weights and regenerating the text is as follows: After completing one round of text generation, a stylistic feature extraction process consistent with historical texts and writing context is performed on the generated text to obtain the average sentence length corresponding to the generated text. Logical connection density The proportion of professional terms and limiting expression frequency This forms the stylistic feature vector of the generated text: ; The stylistic feature vector of the generated text is compared with the feature distribution in the advantageous stylistic interval corresponding to the target writing task. The degree of deviation of the generated text from the target stylistic is calculated to obtain the stylistic consistency evaluation quantity. For example, a weighted distance method is used to define the stylistic consistency evaluation metric. : ,in, The feature mean vector representing the dominant text style interval. This is a feature weight matrix used to reflect the importance of different stylistic features in consistency assessment; The stylistic consistency evaluation value is compared with a preset consistency evaluation value threshold. When the stylistic consistency evaluation value is greater than or equal to the consistency evaluation value threshold, it is determined that the stylistic features of the generated text meet the target requirements, and the generated text is directly output. When the stylistic consistency evaluation value is less than the consistency evaluation value threshold, it is determined that the generated text has a risk of stylistic deviation. When a stylistic deviation is detected, the influence weight of each semantic slot on the stylistic deviation is calculated in reverse based on the contribution of each stylistic feature to the consistency evaluation, and then the weight of the corresponding semantic slot in the template constraint model is dynamically adjusted. For example, the weight of the j-th semantic slot is updated as follows: ,in, For the updated semantic slot weights, For adjustment coefficients, The preset consistency evaluation threshold; It should be noted that the adjustment coefficient The settings can be adaptively configured based on the actual application scenario, the stability requirements of the target text style, and the degree of deviation of the generated text; in some implementations... A smaller value can be chosen to achieve a smooth adjustment; in other implementations, A larger value can be taken to speed up the text convergence speed, but this invention does not limit this; After adjusting the template slot weights, the text generation process is re-executed based on the updated template constraint model, and the above consistency evaluation and weight adjustment steps are repeated until the stylistic consistency evaluation quantity meets the preset consistency evaluation quantity threshold, thereby achieving closed-loop adaptive control of the stylistic features of the generated text.
[0024] This invention organically integrates stylistic feature modeling, template structure generation, and writing process control, achieving perceptible, constrainable, and adjustable control over the writing generation process. Compared to existing technologies that rely solely on fixed templates or end-to-end generation, it can significantly improve stylistic stability and overall consistency while maintaining the semantic accuracy of the text.
[0025] This invention constructs a stylistic feature reference space and introduces a stylistic support and dominant stylistic interval determination mechanism, enabling the writing system to actively identify and select the target stylistic during the generation process. This avoids stylistic drift caused by contextual accumulation in long texts and multi-round generation. At the same time, based on the template constraint model automatically generated by the dominant stylistic interval, it combines fixed semantic structure with variable expression methods, improving the flexibility and adaptability of the writing process while ensuring logical integrity and expression standardization. By evaluating the consistency of stylistic features of the generated text and dynamically adjusting the template slot weights, a closed-loop adaptive control mechanism is formed, enabling the generated results to continuously converge towards the target stylistic, thereby effectively reducing structural breaks and style loss of control, and improving the overall generation quality and controllability in multi-scenario professional writing tasks.
[0026] Example 2: This example introduces an adaptive writing system based on supporting stylistic feature extraction and template generation, such as... Figure 2 As shown, it includes a style perception and acquisition module, a style feature extraction module, a style support determination module, a template structure generation module, a constraint generation and execution module, and a style consistency feedback module. The text style perception and acquisition module is used to acquire historical text samples and the current writing context corresponding to the target writing task, perform syntactic parsing and semantic structure annotation on the text, and construct a text style description information set. The stylistic feature extraction module is used to extract stylistic feature parameters such as sentence length, logical connection density, proportion of professional terms, and frequency of limiting expressions based on the stylistic description information set, so as to obtain a stylistic feature reference space. The style support determination module is used to calculate the similarity between the real-time features of the current writing context and the style feature reference space to obtain the style support parameters of each candidate style type and determine the dominant style range corresponding to the target writing task. The template structure generation module is used to automatically generate a corresponding writing template structure within the advantageous text style range based on the structural distribution pattern of text style features. The template structure includes fixed semantic slots, variable expression slots, and logical constraint rules, and assigns weights to each slot to obtain a template constraint model. The constraint generation execution module is used to adaptively generate text content that satisfies the target stylistic features by combining the contextual semantic density and paragraph progression state under the action of the template constraint model. The stylistic consistency feedback module is used to evaluate the stylistic feature consistency of the generated text. When the consistency evaluation value deviates from the preset consistency evaluation value threshold, the template slot weight is dynamically adjusted and the text is regenerated.
[0027] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0028] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.
[0029] It should be understood that, in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0030] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system and method described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0031] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways.
[0032] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An adaptive writing method based on supporting stylistic feature extraction and template generation, characterized by: Includes the following steps: Obtain historical text samples and current writing context corresponding to the target writing task, perform syntactic parsing and semantic structure annotation on the text, and construct a set of stylistic description information; Based on the aforementioned text description information set, text feature parameters such as sentence length, logical connection density, proportion of technical terms, and frequency of limiting expressions are extracted to obtain a text feature reference space. Based on the real-time features of the current writing context and the style feature reference space, similarity calculation is performed to obtain the style support parameters of each candidate style type, and the advantageous style range corresponding to the target writing task is determined. Within the advantageous writing style range, a corresponding writing template structure is automatically generated based on the structural distribution pattern of writing style features. The template structure includes fixed semantic slots, variable expression slots, and logical constraint rules, and weights are assigned to each slot to obtain a template constraint model. Under the influence of the template constraint model, combined with the contextual semantic density and paragraph progression state, text content that satisfies the target stylistic features is adaptively generated. The generated text is evaluated for stylistic feature consistency. When the consistency evaluation score deviates from the preset consistency evaluation score threshold, the template slot weights are dynamically adjusted and the text is regenerated.
2. The adaptive writing method based on supporting stylistic feature extraction and template generation according to claim 1, characterized in that: The process of obtaining historical text samples and the current writing context corresponding to the target writing task, performing syntactic parsing and semantic structure annotation on the text, and constructing a stylistic description information set is as follows: In historical text samples and the current writing context, each text is segmented into sentences and paragraphs, and natural language processing tools are used to perform part-of-speech tagging, syntactic dependency analysis and semantic role tagging to extract sentence structure, logical connections and organizational features of topic paragraphs. For the syntactic structure of the above text, define syntactic vectors. Its components include sentence length Clause depth and sentence type encoding For semantic connection relationships, construct a semantic adjacency matrix. Its semantic adjacency matrix elements in This indicates the strength of the logical connection between sentence j and sentence k; Paragraph organization features are expressed as paragraph embedding vectors express; The eigenvectors and matrices are sorted and normalized in time order, and then processed according to the syntactic vectors. Semantic adjacency matrix and paragraph embedding vector Calculate the stylistic correlation coefficient between text fragments: Arrange the stylistic relevance coefficients of all fragments in textual order to obtain the final stylistic description information set. .
3. The adaptive writing method based on supporting stylistic feature extraction and template generation according to claim 2, characterized in that: Based on the aforementioned stylistic description information set, the process of extracting stylistic feature parameters such as sentence length, logical connection density, proportion of specialized terms, and frequency of limiting expressions to obtain the stylistic feature reference space is as follows: In the set of text description information, the sentence is the smallest unit of analysis. The number of words in each sentence in each text sample is counted, and the average sentence length is calculated. Based on the semantic structure annotation results, logical connectors in the text are identified, and the frequency of occurrence of logical connectors in the text is counted as a logical connector density parameter. By combining a terminology database, the word units in the text are matched, the frequency of professional terms is counted, and the ratio of professional terms to the total number of word units in the text is normalized to calculate the percentage parameter of professional terms. For the frequency of restrictive expressions, we identify the patterns of restrictive expressions and count their proportion of occurrence in sentences, using this as the parameter for the frequency of restrictive expressions. The text feature vector is obtained by combining the average sentence length, logical connection density parameter, professional terminology ratio parameter, and restrictive expression frequency parameter. For different text types, we collect the corresponding text feature vector sets and perform statistical analysis on each feature dimension. The feature distribution areas of each genre are uniformly mapped to the same feature space to construct a genre feature reference space.
4. The adaptive writing method based on supporting stylistic feature extraction and template generation according to claim 3, characterized in that: The process of calculating the similarity between the real-time features of the current writing context and the style feature reference space to obtain the style support parameters of each candidate style type, and determining the dominant style interval corresponding to the target writing task is as follows: During the current writing process, feature extraction processing is performed on the real-time writing context in the same way as the historical text to obtain the average sentence length, logical connection density, proportion of professional terms and frequency of limiting expressions corresponding to the current context, and to obtain the real-time stylistic feature vector of the current context. For each candidate text type in the text feature reference space Obtain its corresponding feature distribution, using the feature mean vector. and covariance matrix Describe it; The similarity between the real-time text style feature vector and the feature distribution of each candidate text style type is calculated to construct the text style support parameter; The support parameters of each candidate text type are normalized and sorted according to their magnitude. The text type with the highest support is selected, and its corresponding feature distribution region is determined as the dominant text type interval for the target writing task.
5. The adaptive writing method based on supporting stylistic feature extraction and template generation according to claim 4, characterized in that: Within the dominant genre range, a corresponding writing template structure is automatically generated based on the structural distribution pattern of genre features. This template structure includes fixed semantic slots, variable expression slots, and logical constraint rules. The process of assigning weights to each slot to obtain the template constraint model is as follows: After determining the advantageous text style range corresponding to the target writing task, the structural annotation results of historical text samples within the advantageous text style range are retrieved, and the overall organizational form of the text is statistically analyzed to obtain typical structural patterns. According to the structural pattern, the text is divided into several semantic functional units, and according to their stable occurrence position and occurrence probability in the text, they are divided into fixed semantic slots and variable expression slots. For the connection method between adjacent semantic slots, extract the logical relationship type and formalize it into logical constraint rules; Based on the statistical distribution of the stylistic feature parameters within the dominant stylistic interval, a weight coefficient is assigned to each semantic slot. The fixed semantic slots, variable expression slots, logical constraint rules, and corresponding slot weights are integrated to form a constraint model for the writing template.
6. The adaptive writing method based on supporting stylistic feature extraction and template generation according to claim 5, characterized in that: Under the influence of the template constraint model, and by combining contextual semantic density and paragraph progression, the process of adaptively generating text content that satisfies the target stylistic features is as follows: During the text generation process, the target semantic slot to be generated is determined based on the arrangement order and weight information of each semantic slot in the template constraint model, and the semantic function type and logical constraint rules corresponding to the slot are obtained. Calculate the semantic density parameter for the current writing context; The paragraph progression status parameters are determined based on the number of paragraphs in the generated text and the current semantic slot's position in the template. The generation intensity adjustment coefficient of the current slot is calculated by combining the semantic slot weight, semantic density parameter, and paragraph advancement status parameter. Based on the generation intensity adjustment coefficient and the corresponding logical constraint rules, the text generation model is invoked to generate content for the current semantic slot. Repeat the above process to generate the content of each semantic slot in turn, and dynamically update the context semantic density and paragraph progression status during the generation process until all semantic slots are generated, and obtain complete text content that meets the constraints of the target stylistic features.
7. The adaptive writing method based on supporting stylistic feature extraction and template generation according to claim 6, characterized in that: The process of performing a stylistic feature consistency assessment on the generated text, and dynamically adjusting the template slot weights and regenerating the text when the consistency score deviates from the preset consistency score threshold, is as follows: After completing one round of text generation, the generated text is subjected to a stylistic feature extraction process consistent with the historical text and writing context to obtain the average sentence length, logical connection density, proportion of professional terms and frequency of limiting expressions corresponding to the generated text, forming a stylistic feature vector of the generated text. The stylistic feature vector of the generated text is compared with the feature distribution in the advantageous stylistic interval corresponding to the target writing task. The degree of deviation of the generated text from the target stylistic is calculated to obtain the stylistic consistency evaluation quantity. The stylistic consistency evaluation value is compared with a preset consistency evaluation value threshold; when the stylistic consistency evaluation value is greater than or equal to the consistency evaluation value threshold, it is determined that the stylistic features of the generated text meet the target requirements, and the generated text is directly output. When the stylistic consistency evaluation score is less than the consistency evaluation score threshold, it is determined that the generated text has a risk of stylistic deviation. When a stylistic deviation is detected, the influence weight of each semantic slot on the stylistic deviation is calculated in reverse based on the contribution of each stylistic feature to the consistency evaluation, and then the weight of the corresponding semantic slot in the template constraint model is dynamically adjusted. After completing the template slot weight adjustment, the text generation process is re-executed according to the updated template constraint model, and the above consistency assessment and weight adjustment steps are repeated until the stylistic consistency evaluation quantity meets the preset consistency evaluation quantity threshold.
8. An adaptive writing system based on supporting stylistic feature extraction and template generation, used to implement the adaptive writing method based on supporting stylistic feature extraction and template generation as described in any one of claims 1-7, characterized in that: It includes a style perception and acquisition module, a style feature extraction module, a style support determination module, a template structure generation module, a constraint generation and execution module, and a style consistency feedback module; The text style perception and acquisition module is used to acquire historical text samples and the current writing context corresponding to the target writing task, perform syntactic parsing and semantic structure annotation on the text, and construct a text style description information set. The stylistic feature extraction module is used to extract stylistic feature parameters such as sentence length, logical connection density, proportion of professional terms, and frequency of limiting expressions based on the stylistic description information set, so as to obtain a stylistic feature reference space. The style support determination module is used to calculate the similarity between the real-time features of the current writing context and the style feature reference space to obtain the style support parameters of each candidate style type and determine the dominant style range corresponding to the target writing task. The template structure generation module is used to automatically generate a corresponding writing template structure within the advantageous text style range based on the structural distribution pattern of text style features. The template structure includes fixed semantic slots, variable expression slots, and logical constraint rules, and assigns weights to each slot to obtain a template constraint model. The constraint generation execution module is used to adaptively generate text content that satisfies the target stylistic features by combining the contextual semantic density and paragraph progression state under the action of the template constraint model. The stylistic consistency feedback module is used to evaluate the stylistic feature consistency of the generated text. When the consistency evaluation value deviates from the preset consistency evaluation value threshold, the template slot weight is dynamically adjusted and the text is regenerated.