Text data generation method, device, storage medium, and program product
Patent Information
- Application Number
- CN202511339055.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-18
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2045-09-18
AI Technical Summary
[0005]本申请的主要目的在于提供一种文本数据生成方法、设备、存储介质及程序产品,旨在解决在零样本或少样本场景下,生成多特征文本数据的质量受到影响的技术问题
[0039]本申请将提示文本输入第一级大语言模型得到特征大纲,其中,所述特征大纲包括所述提示文本描述的目标场景对应的多个特征类别及各个所述特征类别的枚举特征值;将所述特征大纲输入第二级大语言模型得到多个候选文本和各个所述候选文本各自的特征值组合,其中,所述候选文本的特征值组合包括各个所述特征类别下所述候选文本中的特征值且所述特征值组合内各个特征值无逻辑冲突;将所述候选文本和所述候选文本对应的特征值组合输入预设的评估模型得到文本匹配度评分,基于所述文本匹配度评分从各个所述候选文本中确定输出文本,其中,所述文本匹配度评分用于表征所述特征值组合与所述目标场景对应的多个特征类别之间的匹配度,将所述输出文本和所述输出文本对应的特征值组合作为文本数据输出。
Smart Images

Figure CN121167323B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning technology, and in particular to methods, devices, storage media and program products for generating text data. Background Technology
[0002] With the widespread application of large-scale language models (LLMs) in the field of natural language processing, the demand for high-quality text data has grown dramatically. In particular, in zero-shot or few-shot scenarios, traditional data collection methods are difficult to meet the diverse data generation needs due to their high cost, long cycle, and limited coverage of features.
[0003] Currently, there are two main solutions to the above problems. One is the single LLM direct generation method, which relies on the model's pre-trained knowledge and pattern recognition capabilities. In text generation, it freely associates and expands the text content based on the input keywords. However, the generation of a single LLM is often based on the model's inherent and potentially one-sided pattern associations, resulting in insufficient feature coverage in the generated data. The other is the rule template filling method, which relies on template design. However, the system cannot automatically identify and add new feature categories or feature values that are not explicitly defined in the template. This makes the method weak in generalization ability when facing new domains or complex scenarios in zero-sample / few-sample scenarios, and it is difficult to adapt to dynamically changing feature requirements. In other words, in zero-sample or few-sample scenarios, the current solution suffers from the problem of affecting the quality of multi-feature text data generation.
[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this application is to provide a text data generation method, device, storage medium, and program product, which aims to solve the technical problem that the quality of generated multi-feature text data is affected in zero-sample or few-sample scenarios.
[0006] To achieve the above objectives, this application proposes a text data generation method, the method comprising:
[0007] The prompt text is input into the first-level large language model to obtain the feature outline, wherein the feature outline includes multiple feature categories and enumerated feature values for each feature category;
[0008] The feature outline is input into the second-level large language model to obtain candidate texts and the feature value combination corresponding to the candidate texts. The feature value combination includes any enumerated feature value of each feature category and there is no logical conflict among the feature values in the feature value combination.
[0009] The candidate text and the corresponding feature value combination are input into the evaluation model to obtain the output text, wherein the output text is the text with the highest text matching degree among the candidate texts, and the text matching degree is the matching degree between the candidate text and the corresponding feature value combination.
[0010] The prompt text is input into the first-level large language model to obtain a feature outline, wherein the feature outline includes multiple feature categories corresponding to the target scene described by the prompt text and enumerated feature values of each feature category;
[0011] The feature outline is input into the second-level large language model to obtain multiple candidate texts and feature value combinations of each candidate text. The feature value combinations of the candidate texts include feature values of the candidate texts under each feature category and there is no logical conflict among the feature values in the feature value combinations.
[0012] The candidate text and the feature value combination corresponding to the candidate text are input into a preset evaluation model to obtain a text matching score. Based on the text matching score, the output text is determined from each of the candidate texts. The text matching score is used to characterize the matching degree between the feature value combination and multiple feature categories corresponding to the target scene.
[0013] The output text and its corresponding feature values are combined to output text data.
[0014] In one embodiment, the step of inputting the prompt text into the first-level large language model to obtain the feature outline includes:
[0015] Based on the prompt text, feature categories in the target scene are extracted, and feature values under the feature categories are enumerated to obtain enumerated feature values;
[0016] Output a feature outline containing the feature category and the enumerated feature values of the feature category in a preset language format.
[0017] In one embodiment, the step of extracting feature categories based on the prompt text includes:
[0018] The prompt text is input into the embedding layer of a pre-trained language model to generate a semantic vector;
[0019] From the dimensions stored in the entity-dimension mapping matrix of the pre-trained language model, determine the scene entity association dimension that matches the semantic vector;
[0020] Semantic clustering analysis is performed on the entity association dimension of the scene to obtain multiple dimension clusters, and category labels are assigned to each dimension cluster to obtain feature categories.
[0021] In one embodiment, the step of inputting the feature outline into a second-level large language model to obtain candidate texts and the feature value combination corresponding to the candidate texts includes:
[0022] Traverse each of the aforementioned feature categories, determine any enumerated feature value from the enumerated feature values of the feature category, and construct candidate feature combinations;
[0023] The candidate feature combinations are logically validated using a preset rule engine.
[0024] If a logical conflict of feature values is detected in the candidate feature combination, the conflicting feature value is determined from the candidate feature combination features, and the conflicting feature value is replaced by any enumerated feature value under the feature category corresponding to the conflicting feature value to update the candidate feature combination, and then the step of performing logical verification of the candidate feature combination through the preset rule engine is returned to be executed.
[0025] If no logical conflict in the feature values is detected in the candidate feature combination, then the candidate feature combination is determined as a feature value combination.
[0026] In one embodiment, the evaluation model includes multiple evaluation sub-models;
[0027] The step of combining the candidate text and its corresponding feature values and inputting them into a preset evaluation model to obtain a text matching score includes:
[0028] The candidate text and the corresponding feature value combination are input into each of the evaluation sub-models to obtain multiple feature matching scores. The evaluation sub-model is used to score the target feature category that matches the evaluation sub-model in each feature category. The feature matching score is used to characterize the matching degree between the target feature category and the target feature value. The target feature value is the feature value corresponding to the target feature category among the feature values included in the feature value combination of the candidate text.
[0029] The text matching score of the candidate text is determined based on the matching score of each feature.
[0030] In one embodiment, the step of determining the output text from each of the candidate texts based on the text matching score includes:
[0031] The candidate texts that meet the preset conditions are determined as the output texts, wherein the preset conditions are that the text matching score of the candidate text is greater than a first scoring threshold and the matching score of each feature of the candidate text is greater than a second scoring threshold.
[0032] In one embodiment, before the step of inputting the prompt text into the first-level large language model to obtain the feature outline, the text data generation method further includes:
[0033] Receive input text and detect whether there are semantic gaps in the input text;
[0034] If there are no semantic gaps in the input text, then the input text will be determined as the prompt text;
[0035] If there is semantic missingness in the input text, high-frequency entity words in the historical query are identified, the semantic correlation between the input text and the high-frequency entity words is calculated, and the entity word with the highest semantic correlation among the high-frequency entity words is filled into the input text to obtain the prompt text.
[0036] In addition, to achieve the above objectives, this application also proposes a text data generation device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the text data generation method as described above.
[0037] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the text data generation method described above.
[0038] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the text data generation method described above.
[0039] This application inputs the prompt text into a first-level large language model to obtain a feature outline, wherein the feature outline includes multiple feature categories corresponding to the target scene described by the prompt text and enumerated feature values of each feature category; inputs the feature outline into a second-level large language model to obtain multiple candidate texts and feature value combinations of each candidate text, wherein the feature value combinations of the candidate texts include feature values of the candidate texts under each feature category and there are no logical conflicts among the feature values in the feature value combinations; inputs the candidate texts and the feature value combinations corresponding to the candidate texts into a preset evaluation model to obtain a text matching score; and determines the output text from each candidate text based on the text matching score, wherein the text matching score is used to characterize the matching degree between the feature value combination and the multiple feature categories corresponding to the target scene; and outputs the output text and the feature value combinations corresponding to the output text as text data.
[0040] Compared to the single LLM direct generation method, which relies on inherent pattern association and generates data with limited feature coverage, and the rule template filling method, which lacks the ability to automatically identify new features and has weak generalization ability, this application first uses a first-level large language model to generate a feature outline containing multiple feature categories and enumerated feature values based on the prompt text data, breaking through the association limitations of a single LLM and systematically mining multi-dimensional features. Then, a second-level large language model generates candidate texts and feature value combinations based on the outline, which can flexibly respond to the feature requirements of new domains and overcome the fixed nature of rule templates. Finally, the output text is determined based on the score output by the evaluation model, and logically consistent outputs are selected to avoid logical conflicts between text and features. Therefore, this application improves the generation quality of multi-feature text data in zero-sample / few-sample scenarios through multi-level division of labor and complementary advantages. Attached Figure Description
[0041] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0042] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a flowchart illustrating the text data generation method of this application in Embodiment 1.
[0044] Figure 2 This is a flowchart illustrating Embodiment 2 of the text data generation method of this application;
[0045] Figure 3 This is a flowchart illustrating Embodiment 3 of the text data generation method of this application;
[0046] Figure 4 This is a flowchart illustrating Embodiment 4 of the text data generation method of this application;
[0047] Figure 5 This is a schematic diagram of the architecture of a text data generation system provided in an embodiment of this application;
[0048] Figure 6 A simplified flowchart illustrating a text data generation method provided in an embodiment of this application;
[0049] Figure 7 This is a schematic diagram of the device structure of the hardware operating environment involved in the text data generation method in the embodiments of this application. Detailed Implementation
[0050] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0051] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0052] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions. The following description uses a text data generation device as an example to illustrate this embodiment and the subsequent embodiments.
[0053] Based on this, embodiments of this application provide a method for generating text data, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the text data generation method of this application.
[0054] In this embodiment, the text data generation method includes steps S10 to S30:
[0055] Step S10: Input the prompt text into the first-level large language model to obtain a feature outline, wherein the feature outline includes multiple feature categories corresponding to the target scene described by the prompt text and enumerated feature values of each feature category.
[0056] The prompt text is the instruction text received by the text data generation device to guide the generation of text data, such as generating a popular science article about the range technology of new energy vehicles. It contains the theme, goal, or key requirements of the generation task. The first-level large language model is a large language model used to extract structured features from the prompt text. Its core capability is to understand semantics and generate a hierarchical feature framework. Feature outline: This is the framework content formed after sorting out the features of the target scene described by the prompt text. It includes multiple feature categories and enumerated feature values under each feature category. The target scene is the specific situation, scene, or theme described by the prompt text, which is the target of text data generation. Feature category is the classification of features of the target scene, which is a summary of the target scene from different dimensions. Enumerated feature values: These are the specific, enumerable feature manifestations under each feature category, which are the specific manifestations of the feature category, such as "technical parameters," "application scenarios," and enumerated feature values under each category, such as "battery capacity," "driving range," "urban commuting," and "long-distance travel," used to define the core elements of text data generation.
[0057] The first-level large language model performs semantic parsing on the prompt text, transforming unstructured textual requirements into a structured feature system. Specifically, the model analyzes keywords, syntactic structures, and implicit requirements in the prompt text through an attention mechanism to identify thematic keywords in the prompt text. Then, based on pre-trained knowledge and task understanding, it generates feature categories related to the theme and generates possible feature values for each category. The structure of the feature outline can be presented in JSON, XML, or hierarchical text format.
[0058] It should be noted that after generating the feature outline, invalid features under each feature category can be filtered based on the keyword whitelist of the corpus. The outline after filtering invalid features is determined as the feature outline. For example, when the first-level large language model generates feature values under the feature category of "landscape painting", it may incorrectly include irrelevant values such as "industrial gears". By filtering, the core features of the scene can be locked, which can improve the efficiency of subsequent text data generation.
[0059] Compared to single LLM generation, which relies on the model's inherent and potentially one-sided pattern association, resulting in insufficient feature coverage and limited diversity, this embodiment uses a first-level large language model specifically responsible for feature extraction. This can cover multi-dimensional features related to the prompt text, avoiding the omission of key elements during the generation process and preventing the problem of one-sided feature coverage when generating text data. Furthermore, this embodiment provides an interpretable feature framework through a feature outline, making the logic of the generation process traceable, facilitating users to adjust feature requirements, and improving generation flexibility.
[0060] Compared to the limitations of rule-based template filling, which suffers from poor flexibility and generalization due to fixed templates, this embodiment utilizes a language model to automatically generate a hierarchical feature topology structure of "category → feature value." This overcomes the limitations of static frameworks pre-set by manual templates and solves the fundamental problem of incomplete feature dimension coverage caused by fixed templates in traditional methods. Specifically, the first-level large language model performs deep analysis of the prompt text. Its purpose is not merely to identify keywords, but to systematically deconstruct the scene, automatically identifying a wide range of feature categories and their detailed enumeration values. This ensures that the generated feature outline is highly comprehensive and hierarchical, enabling multi-faceted thinking around the input topic. This provides a solid and rich foundation for generating highly diverse data subsequently, eliminating reliance on predefined templates and the designer's domain knowledge, and fundamentally overcoming the design subjectivity and knowledge bottlenecks inherent in rule-based template filling.
[0061] Step S20: Input the feature outline into the second-level large language model to obtain multiple candidate texts and feature value combinations of each candidate text, wherein the feature value combination of the candidate text includes the feature values of the candidate text under each feature category and there is no logical conflict among the feature values in the feature value combination.
[0062] The second-level large language model is used to generate specific text based on feature outlines. Unlike the first-level large language model, its focus is on transforming structured features into natural language text. Candidate texts are multiple possible text results generated by the second-level large language model, such as generating multiple product introductions with different expressions for the same feature outline. Feature value combinations are combinations formed by selecting a feature value from each category of the feature outline. These combinations can be formed by randomly selecting feature values from each category, or by setting a selection ratio for specific feature values within a category to increase the number of feature value combinations including that specific feature value, depending on actual needs. It should be noted that feature value combinations automatically deconstruct the scene to form a multi-dimensional feature space, providing a rich foundation for text generation. In the candidate text generation stage, by randomly selecting values from each feature category and performing logical conflict detection, it is ensured that each generation produces text variations with distinct content but consistent with common sense. This allows the generated text to cover various sub-situations within the target scene and fundamentally avoids the homogenization and patterning of generated content, achieving maximum diversity under the premise of logical rigor.
[0063] Using the feature outline as input, the second-level large language model first selects one feature value from each feature category to form several combination methods of feature values. Then, it generates corresponding candidate text based on each set of feature values. During the generation process, the second-level large language model ensures that there are no logical conflicts in the feature value combinations through internal logic verification or external rule constraints. Logical conflict refers to the situation where different feature values in the feature value combination are contradictory and cannot be true at the same time. For example, if the feature categories are "material" and "waterproof rating", the feature value combination is "paper shell" and "IP68 waterproof", which would be a logical conflict.
[0064] Specifically, the second-level large language model randomly or by weight selects feature values from each category of the feature outline to generate multiple possible combinations of feature values. Conflict detection is performed on each combination of feature values. For example, the common sense reasoning ability of the pre-trained model determines that "solar charging" and "indoor use scenario" are incompatible, and conflicting combinations are eliminated. For each valid combination of feature values, the model, based on its language generation ability, converts the feature values into coherent natural language text and outputs the generated text along with the corresponding combination of feature values for subsequent evaluation and model selection. It should be noted that, compared to the single LLM direct generation method, which suffers from poor controllability and feature conflict issues due to the lack of explicit constraints, the second-level large language model proposed in this embodiment does not directly generate text after randomly combining feature values according to the feature outline. Instead, it introduces a key conflict detection and correction mechanism to intercept and correct unreasonable feature combinations. For example, the attribute conflict between the technique of thin watercolor painting and the material of thick burlap is addressed through the control logic of random combination → rule engine verification → conflict reselection. This ensures that the feature value combination used to generate text is logically reasonable and compliant, improves the logical consistency of the generated data, effectively avoids outputs that violate common sense or domain rules, thereby improving the reliability and quality of the final data and achieving the goal of driving data diversity while ensuring data quality.
[0065] In this embodiment, text is dynamically generated based on the feature outline to adapt to new feature categories. This enables the generation of multi-feature data without the need for a preset fixed template, solving the problem of weak generalization ability of the rule template filling method. Furthermore, the built-in logical verification mechanism of the model avoids generating contradictory text and improves the credibility of the text.
[0066] Step S30: Input the candidate text and the feature value combination corresponding to the candidate text into a preset evaluation model to obtain a text matching score, and determine the output text from each candidate text based on the text matching score, wherein the text matching score is used to characterize the matching degree between the feature value combination and multiple feature categories corresponding to the target scene.
[0067] The evaluation model is pre-configured to assess candidate texts and their feature value combinations, providing a text matching score. It measures the degree of match between feature value combinations and target scene feature categories. The text matching score, output by the evaluation model, quantifies the degree of match between the candidate text's feature value combinations and multiple feature categories corresponding to the target scene; a higher score indicates a better match. The output text is the text that best matches the target scene's feature requirements, selected from multiple candidate texts based on the text matching score.
[0068] In this embodiment, candidate texts generated by the second-level large language model and their corresponding feature value combinations are input into a preset evaluation model. The evaluation model analyzes the degree of matching between the feature value combinations and multiple feature categories of the target scene, and gives a text matching score for each candidate text. Based on these scores, the text with the highest matching degree is selected as the output text. It is understandable that objectively and quantitatively evaluating the candidate texts through the evaluation model to ensure that the final output text best meets the feature requirements of the target scene is a key step in guaranteeing the quality of the output text and determines the final result of the entire process.
[0069] For example, in one feasible implementation, the received prompt text is: "Generate a product introduction for an energy-saving air conditioner with AI (Artificial Intelligence) temperature control function". The first-level large language model processing extracts feature categories as: "core functions", "energy-saving indicators", "intelligent technology", and "applicable scenarios". The feature values for each feature category are enumerated as follows: core functions: AI temperature control, self-cleaning, dehumidification; energy-saving indicators: first-level energy efficiency, inverter technology; intelligent technology: voice control, remote control; applicable scenarios: bedroom, living room, office. A feature outline is constructed based on the feature categories and feature values. The feature outline is input into the second-level large language model processing to generate candidate feature value combinations and text. For example, combination 1 is core function - AI temperature control, energy-saving indicator - first-level energy efficiency, intelligent technology - remote control, and applicable scenario - bedroom. The generated candidate text is: "This air conditioner is equipped with an AI temperature control system, which can automatically adjust the power according to the indoor temperature. Combined with first-level energy efficiency inverter technology, the energy-saving effect is significant. It supports remote control via a mobile APP, allowing you to set a comfortable temperature in advance in the bedroom." The candidate text and feature value combination are input into the evaluation model. The evaluation model calculates the matching degree between each candidate text and feature value combination. For example, the text of combination 1 fully covers feature values such as "AI temperature control" and "Level 1 energy efficiency" and the matching degree is greater than the preset threshold, so it is selected as the output text.
[0070] Step S40: Combine the output text and the feature value corresponding to the output text as text data output.
[0071] In this embodiment, the output text and the corresponding feature value combination are used as the text data output. Further, in a feasible implementation, a dataset can be constructed based on multiple sets of output text data. This dataset can be used as training samples to train a large language model, or the text in the dataset can be used as the output data of the large language model. The specific configuration can be determined according to actual needs and is not limited here.
[0072] In this embodiment, the output text data is a text-feature label (i.e., feature value combination) pair. That is, in this embodiment, through the collaboration of a three-level chain process (i.e., feature structure and outline generation in step S10 - conflict-controlled text synthesis based on outline in step S20 - multi-dimensional quality verification to determine the output text and feature value combination in step S30), the feature annotation is automated. While generating data, it automatically generates a structured feature label that corresponds precisely to it, eliminating the expensive cost of manual annotation and ensuring the systematicity and consistency of the label. The final output dataset is no longer a messy collection of text, but standard machine learning data with high-quality, structured annotations, which can be used immediately for model training, evaluation and analysis, and text output, improving the immediate usability of the data, thereby improving the controllability and automation level of data generation.
[0073] It should be noted that the text data obtained in this embodiment can be used as training data to train a large language model. Specifically, the target domain for training the large language model is first determined. For example, the prompt text can be "medical cases describing the diagnostic process, symptoms, and treatment plans of various common diseases". The prompt text is then input into the first-level large language model, which extracts feature categories such as "disease type", "symptom features", "diagnostic methods", and "treatment drugs". The feature values under each feature category are enumerated. "Disease type" may include "cold", "hypertension", etc. "Symptom features" for "cold" may include "cough", "fever", "runny nose", etc. The feature outline of the above "medical diagnostic cases" is then input into the second-level large language model. The model generates multiple candidate texts for medical diagnosis cases, each with a corresponding combination of feature values. For example, a candidate text describing a diagnosis of a cold might have the following feature value combination: "Disease type" as "cold," "symptom features" as "cough, fever," "diagnosis method" as "blood routine examination," and "treatment drug" as "cold medicine." These feature values must be logically consistent; for instance, there won't be a situation where "disease type" is "cold" but "treatment drug" is "anti-cancer drug." The generated candidate texts and their feature value combinations are input into a pre-defined evaluation model. The model assigns a text matching score based on the matching degree between the feature value combination and the feature category of the target scenario of the "medical diagnosis case," such as the accuracy of the disease type and the correlation between symptoms and the disease. Multiple candidate texts that meet the scoring criteria are selected as output texts. The output texts and their corresponding feature value combinations are used as training samples for training the large language model. It should be noted that each output text corresponds to a set of machine-readable feature labels, so that the generated dataset is no longer a messy collection of texts, but becomes high-quality labeled data that can be directly used for supervised learning. This not only enables fine-grained screening and analysis of the generated results, but also empowers downstream AI tasks such as model training, targeted evaluation, and deep data mining.
[0074] In another embodiment, the output text obtained in this embodiment is a product review generated based on the user prompt text. In this scenario, the purpose of the claims is to generate authentic and targeted product reviews to provide consumers with reference or assist merchants in product analysis. The user prompt text may be "Generate a product review about a certain brand of smartphone, covering aspects such as appearance design, performance configuration, battery life, and price." After the first-level large language model processes this prompt text, the extracted feature categories include "evaluation dimension," "evaluation tendency," "price range," and "usage scenario." Among the enumerated feature values, "evaluation dimension" includes "appearance design," "performance configuration," and "battery life"; "evaluation tendency" includes "positive," "negative," and "neutral"; "price range" may be "2000-3000 yuan," "3000-5000 yuan," etc.; and "usage scenario" includes "daily communication," "gaming and entertainment," and "photography." The feature outline clarifies the key content that the product review needs to cover. The feature outline is input into the second-level large language model to generate multiple candidate product reviews and their corresponding feature value combinations. For example, a candidate review might read: "This phone has a stylish appearance, powerful performance, runs large games smoothly, has a battery life that lasts a day, and is priced around 3000 yuan, making it very suitable for young people's daily use and gaming entertainment." Its feature value combination includes "evaluation dimensions" covering appearance, performance, battery life, and price; "evaluation tendency" being positive; "price range" of 3000-5000 yuan; and "usage scenarios" of daily communication and gaming entertainment. Furthermore, there are no logical conflicts among the feature values. The evaluation model assesses the matching degree between the feature value combinations of the candidate product reviews and the feature categories of the target scenario of "smartphone product reviews," such as whether the evaluation dimensions are comprehensive and whether the evaluation tendency is consistent with the description. It then provides a text matching score and selects reviews that meet the score criteria as output text for the user.
[0075] In this embodiment, a first-level large language model is used to generate a feature outline and extract multi-dimensional features, solving the problem of feature limitations in single LLM generation. This is especially beneficial in zero-shot scenarios, where feature categories can be automatically expanded based on the prompt text. The second-level large language model ensures conflict-free feature value combinations and evaluates the model to select highly matching text, avoiding feature value contradictions or text deviations from features in traditional methods, thus improving the credibility of the generated text. This embodiment achieves dynamic generation of feature outlines and corresponding text based on prompt text without the need for a fixed template, adapting to the feature requirements of new domains and complex scenarios, and overcoming the weak generalization ability of rule-based template filling methods.
[0076] In one feasible implementation, before step S10, which involves inputting the prompt text into the first-level large language model to obtain the feature outline, the text data generation method further includes:
[0077] Step S01: Receive input text and detect whether there is semantic missingness in the input text.
[0078] The input text is the initial text entered by the user to be processed, which may be incomplete. Semantic omission occurs when the input text is semantically incomplete due to insufficient information, making it impossible to clearly define the generation requirement. For example, "Generate product introduction" without specifying the product type is semantic omission.
[0079] This implementation uses natural language understanding technology to analyze the semantic completeness of the input text, determining whether it contains sufficient key information to guide text data generation. Semantic missing information can be detected based on keyword coverage, syntactic structure analysis, or contextual coherence assessment; no specific limitations are imposed here. For example, the input text "Write an introduction" lacks topic keywords, constituting semantic missing information; while "Write an introduction about new energy vehicle battery technology" is semantically complete. This embodiment avoids the generation of invalid content by the subsequent model due to insufficient input text information, thus improving processing efficiency.
[0080] Specifically, the input text is processed using word segmentation tools and syntactic analyzers to extract keywords, such as nouns and verb phrases, and syntactic components, such as subjects and objects. If the input text lacks core keywords, it is judged as semantically missing. The semantic completeness score of the input text is calculated by a pre-trained language model, and if it is lower than the threshold, it is judged as missing.
[0081] Step S02: If there is no semantic missing in the input text, then the input text is determined as the prompt text.
[0082] If the input text is determined to meet the semantic integrity condition, it is directly marked as prompt text and the process proceeds to the first-level large language model processing step.
[0083] Step S03: If there is semantic missing in the input text, determine the high-frequency entity words in the historical query, calculate the semantic correlation between the input text and the high-frequency entity words, and fill the input text with the entity word with the highest semantic correlation among the high-frequency entity words to obtain the prompt text.
[0084] Historical queries are collections of past user input text stored on the device, used to extract high-frequency entity words. High-frequency entity words are entity words that appear frequently in historical queries, reflecting common user-generated topics. Semantic relevance is the semantic similarity between input text and high-frequency entity words, which can be calculated using methods such as word vector cosine similarity and semantic matching models.
[0085] When the input text lacks semantic meaning, high-frequency entity words are extracted from historical queries. The semantic relevance of each entity word to the input text is calculated, and the entity word with the highest relevance is selected to fill in the input text to make it semantically complete. For example, if the input text is "Generate instructions for use", historical high-frequency entity words include "smartphone" and "air purifier". Calculation shows that "smartphone" has a higher relevance to the input text, so it is filled in as "Generate instructions for use of smartphone". The specific process may be as follows: perform word segmentation and named entity recognition on the historical query text, and count the top N entity words by frequency; convert the input text and each high-frequency entity word into semantic vectors; calculate the cosine similarity between the vectors to obtain the relevance score; select the entity word with the highest relevance and insert it into the correct position according to the syntactic structure of the input text to form a complete prompt text.
[0086] For example, the input text is "generate promotional copy". Since the input text does not have a specific target audience, it is determined to be semantically missing. High-frequency entity words in the historical queries include "cosmetics", "fitness equipment", and "smart home". The similarity between the input text "generate promotional copy" and "cosmetics" is calculated to be 0.65, the similarity between the input text "generate promotional copy" and "fitness equipment" is 0.58, and the similarity between the input text "generate promotional copy" and "smart home" is 0.61. The most relevant "cosmetics" is selected and filled with "generate promotional copy for environmentally friendly products" as the prompt text.
[0087] Furthermore, in one feasible implementation, if the input text is an interrogative sentence, it needs to be converted into a clear prompt text before the first-level large language model processing, in order to avoid the problem that the non-standard text will limit the accuracy of subsequent large language model processing. The specific process can be: using a sequence-to-sequence model to extract the core entities and requirements of the interrogative sentence, reconstructing it into a declarative sentence based on the core entities and requirements to obtain the prompt text, and inputting the prompt text into the first-level large language model for processing.
[0088] In this embodiment, incomplete user input is automatically improved through semantic missing detection and high-frequency entity word filling, reducing manual intervention. This is especially suitable for situations where users have difficulty accurately describing their needs in zero-sample scenarios, ensuring the semantic integrity of the prompt text and avoiding deviations in feature outline generation due to ambiguous input, thereby improving the quality of subsequent multi-feature text data generation from the source.
[0089] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 Step S10, the step of inputting the prompt text into the first-level large language model to obtain the feature outline, includes:
[0090] Step S101: Extract feature categories from the target scene based on the prompt text, and enumerate the feature values under the feature categories to obtain enumerated feature values.
[0091] The target scenario is the specific application scenario pointed to by the prompt text, such as "smartwatch product introduction" or "new energy vehicle technology popularization," which determines the domain scope of the feature category. The feature category is an abstract classification of the core elements in the target scenario, used to structure and organize feature values.
[0092] Through semantic parsing and data retrieval, core feature categories related to the target scene are extracted from the prompt text, and a specific set of feature values is generated for each category. The extraction process can combine the semantic understanding capabilities of pre-trained language models and the knowledge support of external corpora, without any restrictions.
[0093] In one feasible implementation, the process of enumerating feature values under the feature category to obtain enumerated feature values can be as follows: Retrieve text containing keywords of the current feature category in the corpus; perform fuzzy matching using a full-text search engine to extract frequently occurring feature values; if the feature values in the corpus are insufficient, expand the feature values by combining a thesaurus; filter out cross-domain feature values based on the domain tags of the target scenario. Furthermore, the corpus can be dynamically updated by acquiring industry reports and product launch information at regular intervals to update the feature values in the corpus and improve its timeliness.
[0094] Step S102: Output a feature outline containing the feature category and the enumerated feature values of the feature category in a preset language format.
[0095] The preset language format is a standardized format used for structured storage of feature outlines. For example, it can be JSON, XML, YAML, or a custom hierarchical text format, which facilitates subsequent model parsing.
[0096] The extracted feature categories and enumerated feature values are organized into machine-readable structured data according to a preset format, such as JSON, to ensure that the second-level large language model and evaluation model can accurately read the feature information and avoid parsing errors caused by format confusion. The specific process may include: obtaining the structure of a pre-defined feature outline; filling the extracted feature categories and enumerated feature values into the above format, ensuring that each category corresponds to a set of feature values without duplication or logical conflicts; and verifying the output format against the preset specifications using scripts or tools to ensure that subsequent processes can parse it correctly.
[0097] In this embodiment, the feature outline is made a traceable and editable intermediate product by using a preset language format, thereby improving the controllability of the generation process.
[0098] In one feasible implementation, step S101, which involves extracting feature categories from the target scene based on the prompt text and enumerating feature values under the feature categories to obtain enumerated feature values, includes:
[0099] Step S1011: Input the prompt text into the embedding layer of the pre-trained language model to generate a high-dimensional semantic vector.
[0100] Pre-trained language models are language models pre-trained on large-scale corpora, possessing powerful semantic representation capabilities that can transform text into semantic representations in a vector space. The embedding layer is the initial layer of the model, responsible for converting the words / characters of the input text into low-dimensional dense vectors, and generating high-dimensional vectors containing semantic and syntactic information through context encoding. The high-dimensional semantic vector is a numerical representation of the overall semantics of the prompt text, with each dimension corresponding to a latent semantic feature of the text.
[0101] By leveraging the underlying semantic encoding capabilities of pre-trained language models, natural language text is converted into machine-processable numerical vectors, providing a data foundation for subsequent dimensionality matching and clustering analysis. The specific process may involve: segmenting and punctuating the prompt text to convert it into an input format acceptable to the model; passing the input text through an embedding layer, where each word / character is mapped to a word embedding vector; and adding word order information through positional encoding to generate a high-dimensional semantic vector containing contextual relationships.
[0102] Step S1012: Determine the scene entity association dimension that matches the semantic vector from the dimensions stored in the entity-dimension mapping matrix of the pre-trained language model.
[0103] An entity-dimensional mapping matrix is a predefined knowledge base that stores the relationships between entities and feature dimensions, typically in key-value pairs. Scene entities are the core entities referenced in the prompt text. Associated dimensions are feature dimensions related to scene entities; for example, the dimensions associated with "smartwatch" include "hardware configuration," "software functions," and "user groups."
[0104] By retrieving the entity-dimension mapping matrix, scene entities in the prompt text are mapped to predefined feature dimensions, narrowing the scope of feature category extraction. For example, if the scene entity is "smartphone," the mapped dimensions might include "processor model" and "screen size," avoiding the generation of irrelevant dimensions. The specific process might involve: identifying core entities from the semantic vector of the prompt text; searching for all associated dimensions corresponding to the scene entity in the entity-dimension mapping matrix; calculating the matching degree between the semantic vector and each associated dimension using cosine similarity, filtering out dimensions with low matching degrees, and ensuring dimensional relevance. In essence, based on the predefined entity-dimension mapping, dimensional bias caused by model free association is avoided, ensuring a strong correlation between feature dimensions and the target scene.
[0105] Step S1013: Perform semantic clustering analysis on the scene entity association dimension to obtain multiple dimension clusters, and assign category labels to each dimension cluster to obtain feature categories.
[0106] Since the entity-dimensional mapping matrix may return a large number of fine-grained dimensions, cluster analysis is needed to group these dimensions according to semantic relevance, forming dimension clusters. For example, "battery capacity" and "battery life" can be clustered into the category of "battery life capability," and "charging interface type" and "fast charging technology" can be clustered into the category of "charging performance." In other words, a dimension cluster is a set of dimensions with similar semantics. The specific process can be as follows: Dimension vectorization: Convert each associated dimension into a semantic vector; Use algorithms such as K-means and hierarchical clustering to cluster based on the cosine similarity of the dimension vectors to generate multiple dimension clusters; Perform semantic summarization on each dimension cluster and extract common features as category labels.
[0107] It is understandable that clustering abstracts fine-grained dimensions into high-level categories, avoiding overly fragmented feature outlines and improving the readability and generation efficiency of the feature system.
[0108] For example, in one feasible implementation, the prompt text is "Generate technical documentation for a high-end laptop cooling system"; the prompt text is input into the BERT embedding layer to generate a high-dimensional vector containing the semantics of "high-end laptop", "cooling system", and "technical documentation"; the association dimensions are determined: the scene entity is identified as "laptop", and the association dimensions are obtained from the mapping matrix: "heat dissipation material", "fan speed", "number of heat pipes", "temperature control algorithm", and "heat dissipation hole layout"; "heat dissipation material", "number of heat pipes", and "heat dissipation hole layout" are clustered into the "hardware structure" cluster and labeled "heat dissipation hardware configuration"; "fan speed" and "temperature control algorithm" are clustered into the "software control" cluster and labeled "heat dissipation control strategy"; the final feature categories are "heat dissipation hardware configuration" and "heat dissipation control strategy", and specific feature values are enumerated under each category.
[0109] In this embodiment, semantic clustering organizes the lower-level dimensions into higher-level feature categories, making the feature outline more consistent with human cognitive logic. Combined with the entity-dimension mapping matrix and the pre-trained model, it ensures that the feature categories are strongly correlated with the target scene, which is especially suitable for feature extraction in professional fields and avoids generating irrelevant categories by general models.
[0110] Based on the first and / or second embodiments of this application, in the third embodiment of this application, the content that is the same as or similar to the first and / or second embodiments described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 Step S20, the step of inputting the feature outline into the second-level large language model to obtain candidate texts and the feature value combination corresponding to the candidate texts, includes:
[0111] Step S201: Traverse each of the feature categories, determine any enumerated feature value from the enumerated feature values of the feature category, and construct a candidate feature combination.
[0112] By traversing all feature categories in the feature outline, a feature value is randomly or systematically selected from each category to form an initial candidate feature combination. The selection method can be random sampling, frequency-based selection, or user-specified weights; there are no restrictions on this, ensuring the combination covers the possibility of different feature values. Specifically, the process can be as follows: process each category sequentially according to the feature outline; randomly select a feature value from the enumerated feature values under the currently traversed feature category; combine the selected feature values from each category in category order to form a candidate feature combination. It is understandable that automatically extracting feature values from the feature outline to construct candidate combinations can improve the model's efficiency in generating text data.
[0113] Step S202: Perform feature value logic verification on the candidate feature combination through a preset rule engine.
[0114] A pre-defined rule engine is a system that stores domain-specific logical rules to detect contradictions between feature values. The rule engine contains two types of rules: general logical rules, i.e., rules based on common sense; and domain-specific rules, i.e., rules tailored to specific scenarios. The rule engine verifies whether combinations of feature values conform to real-world logic or domain rules by matching conditions in the rule base, determining whether candidate combinations conflict. The specific process may include: loading the corresponding rule set based on the target scenario; converting the feature values in candidate combinations into parameters recognizable by the rule engine; and executing each rule to check for conflict conditions.
[0115] Understandably, automated detection of logical conflicts can avoid the tedious process of manually defining conflicts, ensure that the generated feature combinations conform to real-world logic, and improve the credibility of subsequent text.
[0116] Step S203: If a logical conflict of feature values is detected in the candidate feature combination, the conflicting feature value is determined from the features of the candidate feature combination, and the conflicting feature value is replaced by any enumerated feature value under the feature category corresponding to the conflicting feature value to update the candidate feature combination, and then the step of performing logical verification of the feature value of the candidate feature combination through the preset rule engine is returned to be executed.
[0117] When the rule engine detects a conflict, it locates the feature value that caused the conflict, selects a replacement value from the enumerated values of its corresponding feature category, generates a new candidate combination, and re-performs logical verification until there is no conflict. This constitutes the real-time feature conflict detection mechanism. Specifically, the rule engine returns the feature value involved in the conflict and its corresponding rule, selects an unused enumerated value from the category of the conflicting feature value, replaces it, and re-enters it into the rule engine for verification. This process is repeated until the combination is valid or the maximum number of replacements is reached.
[0118] Step S204: If no logical conflict of feature values is detected in the candidate feature combination, then the candidate feature combination is determined as a feature value combination.
[0119] When a candidate combination passes the rule engine's verification and it is confirmed that there are no logical contradictions among all feature values, the combination is marked as a valid feature value combination and used for subsequent generation of candidate text by the second-level large language model.
[0120] In a specific implementation, diverse combinations of effective feature values can be generated, providing multiple different feature constraints for the second-level large language model, thereby producing diverse candidate texts. Specifically, following a set number N, one candidate combination is generated in each iteration. The process of generating candidate combinations is not detailed here. After verification, they are stored in a list until N effective combinations are reached or all possible combinations are exhausted.
[0121] In this embodiment, the rule engine and automatic replacement mechanism ensure that the feature value combination is consistent, which solves the logical errors that may occur when generating a single model in the background technology. It eliminates the need for manual intervention in the selection and correction of feature combinations, improves the adaptability of text data generation in zero-sample / few-sample scenarios, and is especially suitable for complex scenarios.
[0122] Based on the first, second, and / or third embodiments of this application, in the fourth embodiment of this application, the content that is the same as or similar to the first, second, and / or third embodiments described above can be referred to the above description and will not be repeated hereafter. In this embodiment, the evaluation model includes multiple evaluation sub-models. Based on this, please refer to... Figure 4 Step S30, the step of inputting the candidate text and the feature value corresponding to the candidate text into a preset evaluation model to obtain a text matching score, includes:
[0123] Step S301: Input the candidate text and the feature value combination corresponding to the candidate text into each of the evaluation sub-models to obtain multiple feature matching scores. The evaluation sub-model is used to score the target feature category that matches the evaluation sub-model in each feature category. The feature matching score is used to characterize the matching degree between the target feature category and the target feature value. The target feature value is the feature value corresponding to the target feature category among the feature values included in the feature value combination of the candidate text.
[0124] In this embodiment, the evaluation model is not a single, unified model, but rather a combination of multiple independent yet complementary evaluation sub-models. Each sub-model has a specific evaluation object, namely, the target feature category that matches that sub-model, enabling precise evaluation of that target feature category. By splitting the evaluation model into multiple sub-models, a specialized division of labor for the evaluation task is achieved, allowing each sub-model to focus on a specific feature category, thus improving the accuracy and refinement of the evaluation. In this embodiment, multiple sub-models are pre-set. Based on the multiple feature categories contained in the feature outline, the number of sub-models corresponding to the candidate text that are designated as evaluation sub-models and the target feature category corresponding to each evaluation sub-model are determined. For example, in the "campus sports meet" scenario, if the feature categories include "participants," "sports events," and "venue environment," then the sub-models corresponding to these three feature categories are selected from the multiple sub-models as evaluation sub-models.
[0125] The feature matching score, output by the evaluation sub-model, quantifies the degree of matching between the target feature category and its corresponding target feature value. A higher score indicates a better match. The target feature category is matched to a specific evaluation sub-model, which is specifically responsible for evaluating the feature category. The target feature value is the feature value in the candidate text's feature value combination that belongs to the target feature category.
[0126] In this embodiment, candidate texts and their corresponding feature value combinations are obtained, and the feature categories corresponding to each feature value in the feature value combination are identified. The candidate texts and feature value combinations are input into each evaluation sub-model. After receiving the input, each evaluation sub-model identifies the target feature category that matches itself and extracts the target feature value of the target feature category from the feature value combination. The evaluation sub-model analyzes and evaluates the matching degree between the target feature category and the target feature value. Each evaluation sub-model outputs the corresponding feature matching degree score based on the evaluation result. It can be understood that the sub-model structure enables the separate evaluation of each feature category, which can accurately reflect the matching situation between each target feature category and the corresponding target feature value, providing a detailed basis for subsequent comprehensive evaluation. Moreover, the parallel processing of each evaluation sub-model improves the efficiency of the evaluation and can complete the evaluation of multiple feature categories in a short time.
[0127] Step S302: Determine the text matching score of the candidate text based on each of the feature matching scores.
[0128] The text matching score is a numerical value obtained by combining the matching scores of various features. It is used to characterize the overall matching degree between the combination of feature values of the candidate text and the multiple feature categories corresponding to the target scene.
[0129] In this embodiment, all feature matching scores for the same candidate text output by each evaluation sub-model are obtained. These feature matching scores are processed according to preset calculation rules. In a specific implementation, different weights can be assigned according to the importance of different feature categories, and then each feature matching score is multiplied by its corresponding weight and summed to obtain the text matching score; alternatively, all feature matching scores can be directly added together and the average value is taken as the text matching score, without any limitation. It is understood that by combining multiple feature matching scores, the obtained text matching score can comprehensively reflect the overall matching degree between the candidate text and the target scene, avoiding the one-sidedness of judging based on only a single feature matching score.
[0130] It should be noted that this embodiment introduces a dual-index quantitative evaluation mechanism of feature existence and weight strength. The evaluation model first checks the feature existence, that is, whether the text content explicitly mentions or contains each feature value specified in the feature label; then it evaluates the weight conformity, that is, whether the core feature is sufficiently and significantly reflected in the text. For example, the core feature must meet the minimum semantic coverage. This dual-index scoring threshold determination method of feature existence + weight conformity constitutes a strict quality filtering standard. Only samples that reach or exceed the preset threshold will be output, thereby realizing the automated generation of structured labeled data with quality scores and ensuring the high accuracy and usability of the final output data.
[0131] In one feasible implementation, step S30: the step of determining the output text from each of the candidate texts based on the text matching score, includes:
[0132] Step S303: Determine the candidate texts that meet the preset conditions from among the candidate texts as the output texts, wherein the preset conditions are that the text matching score of the candidate text is greater than the first scoring threshold and the matching score of each feature of the candidate text is greater than the second scoring threshold.
[0133] The preset conditions are pre-defined criteria used to filter candidate texts. They determine whether a candidate text can become the output text and include requirements for both text matching score and feature matching score. The first scoring threshold is a critical value used within the preset conditions to measure whether the text matching score meets the standard. A text matching score exceeding this value indicates that the candidate text has a high overall matching degree with the target scene. The second scoring threshold is a critical value used within the preset conditions to measure whether each feature matching score meets the standard. Each feature matching score exceeding this value indicates that the candidate text has a high matching degree with the corresponding feature value in each specific feature category. The output text is selected from the candidate texts and simultaneously satisfies both a text matching score greater than the first scoring threshold and all feature matching scores greater than the second scoring threshold. This is the text ultimately used for the specific scene.
[0134] In this embodiment, candidate texts are subjected to dual verification under preset conditions. The overall text matching score of the candidate text must exceed a first scoring threshold to ensure that the text is highly consistent with the target scene as a whole. At the same time, the matching score of each feature must exceed a second scoring threshold to ensure that the text meets the requirements in each specific feature category. This avoids the situation where the overall text meets the standard but there are local defects. By adopting the preset conditions of dual thresholds, the overall matching degree of the output text with the target scene is guaranteed, and the matching quality of the text in each feature category is also guaranteed. This avoids the screening bias caused by single-dimensional evaluation and improves the comprehensiveness and reliability of the output text.
[0135] For example, to help understand the implementation flow of the text data generation method obtained by combining this embodiment with the above embodiment one, please refer to... Figure 5 , Figure 5 A schematic diagram of the modular architecture of a text data generation system is provided, specifically including a first-level large language model, a second-level large language model, and an evaluation model. Based on this system, please refer to... Figure 6 , Figure 6 A simplified flowchart of a text data generation method is provided, specifically:
[0136] Step 1: Structuring and Deconstructing Scene Features and Generating an Outline (i.e., inputting the prompt text into the first-level large language model to obtain a feature outline, where the feature outline includes multiple feature categories and enumerated feature values for each feature category). Keywords or short text describing the target scene, such as "describe an abstract landscape painting" or "company internal project progress notification email," are input into the first-level large language model. The core task of this LLM is to deeply analyze the input content, identify and extract the key feature categories that constitute the scene, and enumerate possible refined feature values for each category. For example, for "describe an abstract landscape painting," the model might identify feature categories including "dominant color," "expression technique," "canvas material," and "composition style"; and under the "dominant color" category, it might enumerate specific values such as "warm color contrast," "dominant cool color blocks," and "multi-color mixing," and under the "canvas material" category, it might enumerate values such as "cotton canvas," "linen," and "mixed materials." The model is strictly required to output this parsing result in a structured data format, such as JSON or YAML, forming a detailed "data generation outline." The key innovation of this step lies in leveraging the generalization and understanding capabilities of LLM to automatically and systematically deconstruct the scenario, think divergently from multiple angles around the input topic, and generate a feature framework that is comprehensive and hierarchical, completely eliminating the reliance on predefined manual templates.
[0137] Step 2: Conflict-Controllable Text Synthesis Based on the Outline (i.e., inputting the feature outline into the second-level large language model to obtain candidate texts and corresponding feature value combinations, wherein the feature value combination includes any enumerated feature value of each feature category and there is no logical conflict among the feature values within the feature value combination). The structured feature outline generated in the previous step is input into the second-level LLM. The model's task is to generate specific text data based on the outline. Its workflow is as follows: First, a feature value is randomly selected from each feature category of the outline. For example, "warm color contrast" is selected as the dominant color, "splashing" as the expression technique, and "mixed materials" as the canvas material. Then, the model performs crucial built-in conflict detection, using preset logical rules or common sense knowledge bases to determine whether there are contradictions or irrationalities in the selected feature value combination. For example, it checks whether the "watercolor thin wash" technique conflicts with the "heavy burlap" material. If a conflict is detected, the model reselects conflicting feature values until a logically consistent feature value combination is obtained. Finally, based on this validated and legal feature combination, the model generates natural language text that conforms to these feature descriptions. For example, it generates the sentence: "This abstract landscape painting was created on a mixed-media substrate using a splashing and splattering technique, presenting a strong contrast of warm tones." Simultaneously, this step outputs the generated text and its corresponding precise feature label combination.
[0138] Step 3: Multi-dimensional quality verification of generated data and labels (i.e., inputting the candidate text and its corresponding feature value combination into the evaluation model to obtain the output text, where the output text is the text with the highest text matching degree among the candidate texts, and the text matching degree is the matching degree between the candidate text and the corresponding feature value combination). The text output from Step 2 and its corresponding structured feature labels are combined and input into an evaluation model. This evaluation model can be an LLM or an evaluation group composed of multiple models working together. The core function of the evaluation model is to use a scoring mechanism to strictly check whether the generated text comprehensively and accurately meets the requirements of all feature dimensions specified in its corresponding label. The verification process is as follows: for each feature-value pair in the label, such as "expression technique: splashing and dripping," the module analyzes the text content to determine whether the text clearly reflects the feature. For example, does the text contain words or semantics describing actions or effects such as splashing, dripping, or splattering? The module assigns a matching score to each feature dimension and calculates the overall matching score. It sets a quality threshold, for example, requiring all features to have a matching score greater than 0.8 and the overall average matching score to be greater than 0.9. Only text-label pairs that meet or exceed this threshold are ultimately output as qualified, high-quality labeled data. Samples that do not meet the threshold are discarded or returned to the second step for regeneration. This step ensures the high quality and reliability of the final dataset and automatically generates accurate structured annotation information.
[0139] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the text data generation method of this application. Any simple transformations based on this technical concept are all within the protection scope of this application.
[0140] This application also provides a text data generation apparatus. The text data generation apparatus provided by this application, employing the text data generation method described in the above embodiments, can solve the technical problem that the quality of generated multi-feature text data is affected in zero-sample or few-sample scenarios. Compared with the prior art, the beneficial effects of the text data generation apparatus provided by this application are the same as those of the text data generation method provided in the above embodiments, and other technical features in the text data generation apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0141] This application provides a text data generation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the text data generation method in Embodiment 1 above.
[0142] The following is for reference. Figure 7This document illustrates a structural diagram of a text data generation device suitable for implementing embodiments of this application. The text data generation device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The text data generation device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0143] like Figure 7 As shown, the text data generation device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in the read-only memory 1002 or a program loaded from the storage device 1003 into the random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the text data generation device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. The communication device 1009 allows the text data generating device to communicate wirelessly or wiredly with other devices to exchange data. Although text data generating devices with various systems are shown in the figures, it should be understood that it is not required to implement or possess all of the systems shown. More or fewer systems may be implemented alternatively.
[0144] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0145] The text data generation device provided in this application, employing the text data generation method in the above embodiments, can solve the technical problem that the quality of generated multi-feature text data is affected in zero-sample or few-sample scenarios. Compared with the prior art, the beneficial effects of the text data generation device provided in this application are the same as those of the text data generation method provided in the above embodiments, and other technical features in this text data generation device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0146] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0147] 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.
[0148] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the text data generation method in the above embodiments.
[0149] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0150] The aforementioned computer-readable storage medium may be included in the text data generating device; or it may exist independently and not assembled into the text data generating device.
[0151] The aforementioned computer-readable storage medium carries one or more programs that, when executed by a text data generation device, cause the text data generation device to: input prompt text into a first-level large language model to obtain a feature outline, wherein the feature outline includes multiple feature categories and enumerated feature values for each feature category; input the feature outline into a second-level large language model to obtain candidate text and a combination of feature values corresponding to the candidate text, wherein the combination of feature values includes any enumerated feature value for each feature category and there is no logical conflict among the feature values in the combination of feature values; input the candidate text and the combination of feature values corresponding to the candidate text into an evaluation model to obtain output text, wherein the output text is the text with the highest text matching degree among the candidate texts, and the text matching degree is the matching degree between the candidate text and the corresponding combination of feature values.
[0152] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0153] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0154] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0155] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described text data generation method. This solves the technical problem that the quality of generated multi-feature text data is affected in zero-sample or few-sample scenarios. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the text data generation method provided in the above embodiments, and will not be repeated here.
[0156] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the text data generation method described above.
[0157] The computer program product provided in this application can solve the technical problem that the quality of generated multi-feature text data is affected in zero-sample or few-sample scenarios. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the text data generation method provided in the above embodiments, and will not be repeated here.
[0158] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A method for generating text data, characterized in that, The text data generation method includes: The prompt text is input into the first-level large language model to obtain a feature outline, wherein the feature outline includes multiple feature categories corresponding to the target scene described by the prompt text and enumerated feature values of each feature category; The feature outline is input into the second-level large language model to obtain multiple candidate texts and feature value combinations of each candidate text. The feature value combinations of the candidate texts include feature values of the candidate texts under each feature category and there is no logical conflict among the feature values in the feature value combinations. The candidate text and the feature value combination corresponding to the candidate text are input into a preset evaluation model to obtain a text matching score. Based on the text matching score, the output text is determined from each of the candidate texts. The text matching score is used to characterize the matching degree between the feature value combination and multiple feature categories corresponding to the target scene. The output text and its corresponding feature values are combined to output text data.
2. The text data generation method as described in claim 1, characterized in that, The step of inputting the prompt text into the first-level large language model to obtain the feature outline includes: Based on the prompt text, feature categories in the target scene are extracted, and feature values under the feature categories are enumerated to obtain enumerated feature values; Output a feature outline containing the feature category and the enumerated feature values of the feature category in a preset language format.
3. The text data generation method as described in claim 2, characterized in that, The step of extracting feature categories based on the prompt text includes: The prompt text is input into the embedding layer of a pre-trained language model to generate a semantic vector; From the dimensions stored in the entity-dimension mapping matrix of the pre-trained language model, determine the scene entity association dimension that matches the semantic vector; Semantic clustering analysis is performed on the entity association dimension of the scene to obtain multiple dimension clusters, and category labels are assigned to each dimension cluster to obtain feature categories.
4. The text data generation method as described in claim 1, characterized in that, The step of inputting the feature outline into the second-level large language model to obtain candidate texts and the feature value combination corresponding to the candidate texts includes: Traverse each of the aforementioned feature categories, determine any enumerated feature value from the enumerated feature values of the feature category, and construct candidate feature combinations; The candidate feature combinations are logically validated using a preset rule engine. If a logical conflict of feature values is detected in the candidate feature combination, the conflicting feature value is determined from the candidate feature combination features, and the conflicting feature value is replaced by any enumerated feature value under the feature category corresponding to the conflicting feature value to update the candidate feature combination, and then the step of performing logical verification of the candidate feature combination through the preset rule engine is returned to be executed. If no logical conflict in the feature values is detected in the candidate feature combination, then the candidate feature combination is determined as a feature value combination.
5. The text data generation method as described in claim 1, characterized in that, The evaluation model includes multiple evaluation sub-models; The step of combining the candidate text and its corresponding feature values and inputting them into a preset evaluation model to obtain a text matching score includes: The candidate text and the corresponding feature value combination are input into each of the evaluation sub-models to obtain multiple feature matching scores. The evaluation sub-model is used to score the target feature category that matches the evaluation sub-model in each feature category. The feature matching score is used to characterize the matching degree between the target feature category and the target feature value. The target feature value is the feature value corresponding to the target feature category among the feature values included in the feature value combination of the candidate text. The text matching score of the candidate text is determined based on the matching score of each feature.
6. The text data generation method as described in claim 5, characterized in that, The step of determining the output text from each of the candidate texts based on the text matching score includes: The candidate texts that meet the preset conditions are determined as the output texts, wherein the preset conditions are that the text matching score of the candidate text is greater than a first scoring threshold and the matching score of each feature of the candidate text is greater than a second scoring threshold.
7. The method according to any one of claims 1 to 6, characterized in that, Before the step of inputting the prompt text into the first-level large language model to obtain the feature outline, the text data generation method further includes: Receive input text and detect whether there are semantic gaps in the input text; If there are no semantic gaps in the input text, then the input text will be determined as the prompt text; If there is semantic missingness in the input text, high-frequency entity words in the historical query are identified, the semantic correlation between the input text and the high-frequency entity words is calculated, and the entity word with the highest semantic correlation among the high-frequency entity words is filled into the input text to obtain the prompt text.
8. A text data generation device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the text data generation method as described in any one of claims 1 to 7.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the text data generation method as described in any one of claims 1 to 7.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the text data generation method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Model training method and device, service execution method and device, storage medium and equipment
CN117743824A
Text abstract generation method based on large language model
CN120508650A