Text imitation processing method and device based on class text and medium
By enhancing the initial prompts and optimizing the loop, the quality of text imitation output from large models is automatically improved, solving the difficulty for users to manually adjust prompts and achieving an efficient and stable imitation process.
Patent Information
- Application Number
- CN202511702437.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2025-12-19
AI Technical Summary
In the process of text imitation, existing large-scale language models suffer from low similarity between the generated result and the reference text due to the ambiguity of the initial prompts from the user. Users need to manually adjust the prompts, which is time-consuming, laborious, and relies on professional knowledge.
The system generates intermediate prompts by enhancing the initial prompts, and introduces preset conditions and optimization loops into the large model to automatically diagnose and optimize the prompts to improve the similarity of the imitated text.
It automatically improves the similarity between the imitated text and the reference text, reduces manual intervention, lowers the technical threshold, and ensures the stability and high quality of the output results.
Smart Images

Figure CN121168421A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic digital data processing technology, and in particular to a text imitation processing method, device and medium based on text-like formats. Background Technology
[0002] In recent years, with the rapid development of large-scale language model (large model) technology, its use for text generation, rewriting, and imitation has become an important application in the field of natural language processing. In practical applications, users often want large models to imitate a given reference text (such as an excellent report, an article in a specific style, etc.) to generate new content. The usual practice is for the user to provide an initial prompt word to instruct the model to imitate the text.
[0003] However, users' initial prompts are often short, vague, or unprofessional (e.g., "Please imitate this document to write a document"). Large-scale models often cannot directly generate text with high similarity to the reference text based on these prompts, failing to meet the user's imitation writing needs. In such cases, users typically need to analyze the reasons for the unsatisfactory results generated by the large model and attempt to modify the initial prompts. This process is not only time-consuming and laborious but also highly dependent on the user's own professional knowledge and experience, posing a high barrier to entry for ordinary users, and the final result is difficult to guarantee.
[0004] Therefore, how to automatically improve the similarity between the parody text output by the large model and the reference text is an urgent problem to be solved. Summary of the Invention
[0005] The purpose of this invention is to provide a text imitation processing method, device, and medium based on text-like structures, so as to automatically improve the similarity between the imitation text output by a large model and the reference text.
[0006] According to a first aspect of the present invention, a text imitation processing method based on text-like structures is provided, comprising the following steps: Obtain initial prompts and reference text input by the user; the initial prompts are used to instruct the large model to perform a writing task based on the reference text.
[0007] The initial prompt word is enhanced to obtain the intermediate prompt word.
[0008] Input the intermediate prompt words and reference text into the large model, and obtain the first output text of the large model.
[0009] If the difference between the first output text and the reference text does not meet the preset conditions, the intermediate prompt words are optimized through the large model to obtain the first optimized prompt word.
[0010] Input the first optimization suggestion word and the reference text into the large model, and obtain the first optimized text output by the large model.
[0011] If the difference between the first optimized text and the reference text meets the preset conditions, then the first optimized text is determined as the target output text to be displayed to the user.
[0012] Furthermore, the method also includes a process of obtaining the difference between the first output text and the reference text, which includes: inputting the first output text, the reference text, and a first preset prompt word into the large model; the first preset prompt word is used to instruct the large model to obtain several preset type difference values between the first output text and the reference text, the several preset types including at least one of the following types: structure, language style, and logic.
[0013] Furthermore, the preset conditions include: the difference values of each preset type between the first output text and the reference text are all less than or equal to the preset difference threshold.
[0014] Furthermore, optimizing intermediate prompts using a large model includes: Obtain the preset types whose difference values are greater than a preset difference threshold from the plurality of preset types, and input the preset types whose difference values are greater than the preset difference threshold, intermediate prompt words, and second preset prompt words into the large model. The second prompt word is used to instruct the large model to optimize the intermediate prompt words according to the preset types whose difference values are greater than the preset difference threshold from the plurality of preset types.
[0015] Furthermore, the initial prompt word enhancement process includes sending the initial prompt word and the prompt word enhancement instruction together to the large model so that the large model can enhance the initial prompt word.
[0016] Furthermore, the method also includes: If the difference between the first optimized text and the reference text does not meet the preset conditions, the first optimized prompt word is optimized using a large model to obtain the second optimized prompt word.
[0017] Input the second optimization suggestion word and the reference text into the large model, and obtain the second optimization text output by the large model.
[0018] If the difference between the second optimized text and the reference text meets the preset conditions, then the second optimized text is determined as the target output text to be displayed to the user.
[0019] Furthermore, the method also includes: if the difference between the first output text and the reference text meets a preset condition, then the first output text is determined as the target output text to be displayed to the user.
[0020] Furthermore, the method also includes: The number of times the large model optimizes the prompt words is obtained. If the number of times is greater than or equal to a preset threshold, and the difference between the optimized text corresponding to the prompt word obtained in the last optimization and the reference text does not meet the preset conditions, then the deviation value between the optimized text corresponding to the prompt word obtained by the large model for each optimization of the prompt word and the reference text is obtained, and the optimized text corresponding to the minimum deviation value is determined as the target output text to be displayed to the user; wherein, the deviation value between any optimized text and the reference text is obtained according to the preset difference values of each type between the optimized text and the reference text.
[0021] According to a second aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described text imitation processing method based on text-like structures.
[0022] According to a third aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described text imitation processing method based on text-like structures.
[0023] Compared with the prior art, the present invention has at least the following beneficial effects: This invention enhances the user's ambiguous initial intent through a prompt word enhancement process, transforming it into richer, more understandable intermediate prompt words. This improves the accuracy of instructions from the source, resulting in higher quality first output text generated by the large model and better alignment with the reference text. Furthermore, by introducing an automatic judgment and prompt word optimization loop based on preset conditions, this invention establishes a self-improving closed-loop system. This system automatically diagnoses deficiencies in the output text (such as structural or stylistic deviations) and optimizes the prompt words accordingly, ultimately outputting a target output text (i.e., a paraphrased text) with high similarity to the reference text. This significantly reduces reliance on manual intervention, achieving automatic prompt word optimization and automatically improving the similarity between the paraphrased text output by the large model and the reference text.
[0024] This invention transforms the uncontrollable, one-time generation process into a controllable, iterative process that gradually approaches the target. Even if the initial generation is unsatisfactory, the system can continuously improve through subsequent optimization steps, ensuring the stability and reliability of the final output and reducing the risk of task failure. From the user's perspective, only initial prompts and reference text are needed to automatically obtain high-quality imitation results, without requiring professional prompt engineering knowledge or tedious manual debugging. This significantly lowers the technical threshold and improves the efficiency of human-computer interaction and user experience. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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 the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 A flowchart of a text imitation processing method based on text-like structures provided in an embodiment of the present invention. Detailed Implementation
[0027] 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.
[0028] Example 1: According to this embodiment, as Figure 1 As shown, a text imitation processing method based on text-like structures is provided, including the following steps: S100, obtain the initial prompt words and reference text input by the user; the initial prompt words are used to instruct the large model to perform the writing task based on the reference text.
[0029] In this embodiment, the initial prompt is a user-provided, raw instruction expressing their text generation needs. For example, the initial prompt could be: "Write a text similar to the reference text."
[0030] In this embodiment, the reference text (i.e., the similar text) is a text example provided by the user that the large model should emulate. It defines the characteristics that the target text should possess in terms of structure, language style, logic, etc.
[0031] In this embodiment, "large model" refers to a large-scale language model, such as GPT-4 or ERNIE, which is an artificial intelligence model capable of understanding and generating natural language text.
[0032] S200, perform prompt enhancement processing on the initial prompt word to obtain the intermediate prompt word.
[0033] In this embodiment, prompt enhancement processing refers to the process of expanding and optimizing a short, vague prompt into a detailed, specific, structured prompt that is more instructive for the large model. As a specific implementation, prompt enhancement processing of the initial prompt includes sending the initial prompt and prompt enhancement instructions together to the large model for enhancement. As another specific implementation, a prompt enhancement instruction is pre-set; this instruction itself is a high-quality prompt, for example: "You are a prompt optimization expert." The instructions further state: "Please expand and optimize the user-provided original prompt to make it more specific and clear, and include explicit requirements for text structure, language style, and paragraph logic." Finally, the instructions state: "Please directly output the optimized prompt; do not output any other content."
[0034] In this embodiment, the intermediate prompt word is a higher-quality prompt word obtained by enhancing the initial prompt word. As a specific implementation, the large model analyzes and reconstructs the initial prompt word according to the requirements of the prompt word enhancement instruction, and outputs an optimized intermediate prompt word.
[0035] Based on S200, this embodiment enhances the processing to transform the user's ambiguous intent into instructions that are easier for the large model to execute precisely, laying the foundation for generating a high-quality draft.
[0036] S300: Input the intermediate prompt words and reference text into the large model, and obtain the first output text of the large model.
[0037] In this embodiment, the intermediate prompt words and reference text are combined and input into the large model. Specifically, the combination method is as follows: the reference text is provided to the large model as a contextual example. For example, the following text is added to the end of the intermediate prompt words: Please pay special attention to the writing style and structure of the following text: [Insert reference text here].
[0038] In this embodiment, the text output by the large model after inputting intermediate prompt words and reference text is the first output text.
[0039] S400, if the difference between the first output text and the reference text does not meet the preset conditions, the intermediate prompt words are optimized through the large model to obtain the first optimized prompt word.
[0040] In one specific implementation, if the difference between the first output text and the reference text meets a preset condition, the first output text is determined as the target output text to be displayed to the user.
[0041] As a specific implementation, the method further includes a process for obtaining the differences between the first output text and the reference text. This process includes: inputting the first output text, the reference text, and a first preset prompt word into a large model; the first preset prompt word is used to instruct the large model to obtain several preset type difference values between the first output text and the reference text, wherein the several preset types include at least one of the following types: structure, language style, and logic. The first preset prompt word is an instruction from a specialized knowledge large model to perform text difference analysis; the preset type difference value is a quantitative score of the degree of difference between texts on a specific dimension, which includes at least one of the following dimensions: structure, language style, and logic. Structure refers to the organization of the text, such as chapter division, paragraph arrangement, and heading hierarchy; language style refers to the linguistic characteristics presented by the text, such as formal, colloquial, academic, ornate, and concise; logic refers to the connection and reasoning relationships between viewpoints, arguments, and examples in the text.
[0042] As a specific implementation method, the first preset prompt is pre-set, for example: Please analyze the degree of difference between the two input texts in three aspects: structure, language style, and logic. Please give a score of 0 to 1 for each aspect, where 0 represents exactly the same and 1 represents completely different. Please output the degree of difference in the above three aspects in the format of structure: X, language style: Y, logic: Z, where X is the degree of difference between the two input texts in terms of structure, Y is the degree of difference between the two input texts in terms of language style, and Z is the degree of difference between the two input texts in terms of logic.
[0043] In this embodiment, the preset condition is the criterion for determining whether the output text meets the user's imitation requirements. As a specific implementation, the preset condition includes: the difference values of each preset type between the first output text and the reference text are all less than or equal to a preset difference threshold. The preset difference threshold is a pre-set maximum difference value acceptable to the user; for example, the preset difference threshold is 0.2 or 0.3 (0 represents identical, 1 represents completely different).
[0044] As a specific implementation, optimizing intermediate prompt words through a large model includes: obtaining preset types whose corresponding difference values are greater than a preset difference threshold from the plurality of preset types, and inputting the preset types whose corresponding difference values are greater than the preset difference threshold, intermediate prompt words, and a second preset prompt word into the large model. The second prompt word is used to instruct the large model to optimize intermediate prompt words based on the preset types whose corresponding difference values are greater than the preset difference threshold from the plurality of preset types.
[0045] The second preset prompt is a specific instruction that guides the large model on how to optimize prompts based on differences in a specific dimension. The second preset prompt is pre-defined, and the current prompt is an intermediate prompt. According to the evaluation, the generated text differs significantly from the reference text in terms of [Please insert weaknesses here, such as structure and logic]. Please modify and strengthen the above prompts to address these weaknesses, guiding the model to better mimic these aspects of the reference text in the next generation. Please directly output the optimized new prompts.
[0046] Therefore, by inputting the type of weak link (e.g., structure and logic), intermediate prompts, and second preset prompts into the large model, the large model, based on instructions, revises the original prompts for structure and logic, and outputs the first optimized prompt. For example, it might add the following to the original intermediate prompts: Special note: The article structure must strictly imitate the five-paragraph argument structure of the reference text, and ensure that there is a rigorous causal logical relationship between the arguments and evidence within each paragraph.
[0047] S500: Input the first optimization suggestion word and reference text into the large model, and obtain the first optimization text output by the large model.
[0048] In this embodiment, the first optimized prompt word is obtained by optimizing the intermediate prompt word, and is more targeted; based on the first optimized prompt word, it is expected to improve the previous shortcomings (i.e., the preset types whose corresponding difference values are greater than the preset difference thresholds among the several preset types).
[0049] S600, if the difference between the first optimized text and the reference text meets the preset conditions, then the first optimized text is determined as the target output text to be displayed to the user.
[0050] In this embodiment, a new round of evaluation and judgment is performed on the result after the first optimization (i.e., the first optimized text). The evaluation and judgment process is similar to that of S400, and will not be described again here.
[0051] In one specific implementation, the method further includes: S610, if the difference between the first optimized text and the reference text does not meet the preset conditions, then the first optimized prompt word is optimized through the large model to obtain the second optimized prompt word.
[0052] In this embodiment, if the difference between the first optimized text and the reference text does not meet the preset conditions, the next round of optimization is initiated.
[0053] S620: Input the second optimization prompt word and reference text into the large model, and obtain the second optimization text output by the large model.
[0054] S630, if the difference between the second optimized text and the reference text meets the preset conditions, then the second optimized text is determined as the target output text to be displayed to the user.
[0055] In this embodiment, if the difference between the result of the current round of optimization and the reference text does not meet the preset conditions, the next round of optimization is entered. This process is a loop of evaluation-optimization prompt words-regeneration until the difference between the result of the current round of optimization and the reference text meets the preset conditions or the number of loops reaches the upper limit.
[0056] In one specific implementation, the method further includes: obtaining the number of times the large model optimizes the prompt word; if the number of times is greater than or equal to a preset number threshold, and the difference between the optimized text corresponding to the prompt word obtained in the last optimization and the reference text does not meet a preset condition, then obtaining the deviation value between the optimized text corresponding to the prompt word obtained by the large model each time it optimizes the prompt word and the reference text, and determining the optimized text corresponding to the minimum deviation value as the target output text to be displayed to the user; wherein, the deviation value between any optimized text and the reference text is obtained according to each preset type of difference value between the optimized text and the reference text.
[0057] The preset number of optimization attempts is the maximum number of optimization attempts set to prevent infinite loops, such as 3 or 5. The deviation value is a single numerical value that comprehensively measures the overall difference between the optimized text and the reference text, calculated from the difference values of each preset type. As a specific implementation, the deviation value is calculated using a weighted geometric mean or a weighted arithmetic mean. Assuming there are n preset types, and the difference value of the i-th preset type is d... i The weight of the i-th preset type is w i Then the deviation value D = ∑ n i=1 (d) i ×w i ), ∑ n i=1 w i =1, w i >0. For example, if the weights of structure, language style, and logic are 0.4, 0.3, and 0.3 respectively, and the differences in structure, language style, and logic between an optimized text and a reference text are 0.2, 0.5, and 0.3 respectively, then the deviation value D between the optimized text and the reference text is D = 0.4 × 0.2 + 0.3 × 0.5 + 0.3 × 0.3 = 0.32.
[0058] This embodiment enhances the user's ambiguous initial intent through a prompt word enhancement process, transforming it into richer, more understandable intermediate prompt words. This improves the accuracy of the instructions from the source, resulting in higher quality first output text generated by the large model and better alignment with the reference text. Furthermore, by introducing an automatic judgment and prompt word optimization loop based on preset conditions, this embodiment establishes a self-improving closed-loop system. This system automatically diagnoses deficiencies in the output text (such as structural or stylistic deviations) and optimizes the prompt words accordingly. The final output text (i.e., the imitated text) exhibits high similarity to the reference text. This significantly reduces reliance on manual intervention, achieving automatic optimization of prompt words and automatically improving the similarity between the imitated text output by the large model and the reference text.
[0059] This embodiment transforms the uncontrollable, one-time generation process into a controllable, iterative process that gradually approaches the target. Even if the initial generation is unsatisfactory, the system can continuously improve through subsequent optimization steps, ensuring the stability and reliability of the final output and reducing the risk of task failure. From the user's perspective, only initial prompts and reference text are needed to automatically obtain high-quality imitation results, without requiring professional prompt engineering knowledge or tedious manual debugging. This significantly lowers the technical threshold and improves the efficiency of human-computer interaction and user experience.
[0060] Example 2: This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps: Obtain initial prompts and reference text input by the user; the initial prompts are used to instruct the large model to perform a writing task based on the reference text.
[0061] The initial prompt word is enhanced to obtain the intermediate prompt word.
[0062] Input the intermediate prompt words and reference text into the large model, and obtain the first output text of the large model.
[0063] If the difference between the first output text and the reference text does not meet the preset conditions, the intermediate prompt words are optimized through the large model to obtain the first optimized prompt word.
[0064] Input the first optimization suggestion word and the reference text into the large model, and obtain the first optimized text output by the large model.
[0065] If the difference between the first optimized text and the reference text meets the preset conditions, then the first optimized text is determined as the target output text to be displayed to the user.
[0066] Example 3: This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it performs the following steps: Obtain initial prompts and reference text input by the user; the initial prompts are used to instruct the large model to perform a writing task based on the reference text.
[0067] The initial prompt word is enhanced to obtain the intermediate prompt word.
[0068] Input the intermediate prompt words and reference text into the large model, and obtain the first output text of the large model.
[0069] If the difference between the first output text and the reference text does not meet the preset conditions, the intermediate prompt words are optimized through the large model to obtain the first optimized prompt word.
[0070] Input the first optimization suggestion word and the reference text into the large model, and obtain the first optimized text output by the large model.
[0071] If the difference between the first optimized text and the reference text meets the preset conditions, then the first optimized text is determined as the target output text to be displayed to the user.
[0072] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. It should also be understood that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.
Claims
1. A text imitation processing method based on a text-like text, characterized by, The method comprises the following steps: obtaining an initial prompt word input by a user and reference text; the initial prompt word is used to instruct a large model to perform a writing task according to the reference text; the initial prompt word is subjected to prompt word enhancement processing to obtain an intermediate prompt word; the intermediate prompt word and the reference text are input into the large model to obtain first output text output by the large model; if a difference between the first output text and the reference text does not satisfy a preset condition, the intermediate prompt word is optimized by the large model to obtain a first optimized prompt word; the first optimized prompt word and the reference text are input into the large model to obtain first optimized text output by the large model; if a difference between the first optimized text and the reference text satisfies the preset condition, the first optimized text is determined as target output text to be shown to the user.
2. The text-based text imitation processing method according to claim 1, characterized by, The method further comprises a process of obtaining the difference between the first output text and the reference text, which comprises inputting the first output text, the reference text and a first preset prompt word into the large model; the first preset prompt word is used to instruct the large model to obtain a plurality of preset type difference values of the first output text and the reference text, and the plurality of preset types comprise at least one of the following types: structure, language style and logic.
3. The text-based text generation processing method according to claim 2, characterized by, The preset condition comprises that each preset type difference value of the first output text and the reference text is less than or equal to a preset difference threshold.
4. The text-based text generation processing method according to claim 3, characterized by, Optimizing the intermediate prompt word by the large model comprises: obtaining a preset type corresponding to a difference value greater than a preset difference threshold in the plurality of preset types, and inputting the preset type corresponding to the difference value greater than the preset difference threshold in the plurality of preset types, the intermediate prompt word and a second preset prompt word into the large model; the second prompt word is used to instruct the large model to optimize the intermediate prompt word according to the preset type corresponding to the difference value greater than the preset difference threshold in the plurality of preset types.
5. The text-based text generation processing method according to claim 1, characterized by, The prompt word enhancement processing on the initial prompt word comprises: sending the initial prompt word and a prompt word enhancement instruction to the large model together to perform enhancement processing on the initial prompt word by the large model.
6. The text-based text generation processing method according to claim 1, characterized by, The method further comprises: if the difference between the first optimized text and the reference text does not satisfy the preset condition, optimizing the first optimized prompt word by the large model to obtain a second optimized prompt word; inputting the second optimized prompt word and the reference text into the large model to obtain second optimized text output by the large model; if the difference between the second optimized text and the reference text satisfies the preset condition, the second optimized text is determined as target output text to be shown to the user.
7. The text-based text generation processing method according to claim 1, characterized by, The method further comprises: if the difference between the first output text and the reference text satisfies the preset condition, the first output text is determined as target output text to be shown to the user.
8. The text-based text generation processing method according to claim 1, characterized by, The method further comprises: The number of times that the large model optimizes the prompt word is obtained. If the number of times is greater than or equal to a preset number threshold, and the difference between the optimized text corresponding to the prompt word obtained by the last optimization and the reference text does not satisfy a preset condition, then the deviation values of the optimized texts corresponding to the prompt words obtained by the large model each time the prompt word is optimized are obtained, and the optimized text corresponding to the minimum deviation value is determined as the target output text to be displayed to the user. Any optimized text and the reference text are obtained according to the respective preset type difference values of the optimized text and the reference text.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the text imitation processing method based on the text class as claimed in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the text imitation processing method based on the text class as claimed in any one of claims 1 to 8.