Method and device for generating test text, equipment, medium and program product
By determining the natural language attribute labels and optimization prompt word strategies of the original test text, the target test text that conforms to human language characteristics is generated, and the homogeneity of text test sets in the existing technology is solved, improving the test effect and user experience.
Patent Information
- Application Number
- CN202480005702.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-08-15
AI Technical Summary
The text test set generated by the existing text test set generation method is highly homogeneous, and the language style lacks the fluency and depth of human natural language, making it difficult to find potential problems in the business, and reduces the user experience.
By determining the value of the natural language attribute label of the original test text, optimizing the prompt word strategy, and using natural language processing technology to generate target test text that conforms to human language characteristics.
The generated test text is in line with human language changes, improves the test effect and user experience, and meets the testers' authenticity needs for the text test set.
Smart Images

Figure CN120500689A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates generally to the field of computers, and more particularly, to methods, apparatuses, devices, media, and program products for generating test texts. Background Art
[0002] A text test set is a dataset used to evaluate model performance in fields such as machine learning and natural language processing (NLP). It typically contains a series of text samples that the model has not seen during training, and is used to test the model's generalization ability on unseen data.
[0003] Currently, there are various methods to obtain text test sets, including allocating part of the data from the existing text dataset as a text test set, using specialized text test sets already released by the industry, manually constructing text test sets, and using data augmentation technology to generate test sets. The specific method used to obtain the text test set depends on the needs of the business project and the availability of data. Summary of the Invention
[0004] Embodiments of the present disclosure provide a method, apparatus, device, medium, and program product for generating a test text.
[0005] According to a first disclosed aspect, a method for generating a test text is provided. The method includes determining a value for a label for an original test text, wherein the label indicates a natural language attribute. The method also includes determining a prompt word strategy for the original test text based on the value. Furthermore, the method also includes generating a target test text based on the original test text and the prompt word strategy.
[0006] In a second aspect of the disclosure, a device for generating a test text is provided. The device includes a value determination module configured to determine a value of a label for an original test text, wherein the label indicates an attribute of a natural language. The device also includes a prompt word strategy determination module configured to determine a prompt word strategy for the original test text based on the value. Furthermore, the device also includes a target test text generation module configured to generate a target test text based on the original test text and the prompt word strategy.
[0007] In a third aspect of the present disclosure, an electronic device is provided, comprising a processor and a memory coupled to the processor, wherein the memory has instructions stored therein, and when the instructions are executed by the processor, the electronic device executes the method according to the first aspect.
[0008] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are executed by a processor to implement the method according to the first aspect.
[0009] In a fifth aspect of the present disclosure, there is provided a computer program product tangibly stored on a non-transitory computer-readable medium and comprising computer-executable instructions which, when executed, cause a computer to perform the method according to the first aspect.
[0010] This summary is intended to introduce a selection of concepts in a simplified form that are further described below in the detailed description. It is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0012] Figure 1 A schematic diagram illustrating an example environment in which various embodiments of the present disclosure may be implemented;
[0013] Figure 2 A flowchart of a method for generating a test text according to some embodiments of the present disclosure is shown;
[0014] Figure 3 A schematic diagram illustrating a framework for generating test text according to some embodiments of the present disclosure is shown;
[0015] Figure 4A A block diagram illustrating a process for generating a test text according to some embodiments of the present disclosure is shown;
[0016] Figure 4B A schematic diagram showing labels, values and their proportions according to certain embodiments of the present disclosure is shown;
[0017] Figure 5 A schematic diagram of an interactive page for generating a test text according to some embodiments of the present disclosure is shown;
[0018] Figure 6 A schematic diagram illustrating an effect display for generating a test text according to certain embodiments of the present disclosure is shown;
[0019] Figure 7 A block diagram illustrating an apparatus for generating a test text according to certain embodiments of the present disclosure; and
[0020] Figure 8 A block diagram of an electronic device according to certain embodiments of the present disclosure is shown.
[0021] Throughout the drawings, the same or similar reference numbers denote the same or similar elements. DETAILED DESCRIPTION
[0022] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.
[0023] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0024] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. can refer to different or the same objects, unless explicitly stated otherwise. Other explicit and implicit definitions may also be included below.
[0025] As mentioned above, text test sets play an important role in testing business models, and there are currently various methods for obtaining text test sets. With the development of technology, data augmentation technology has also been widely used to generate text test sets. However, in this or similar technologies for generating text test sets, although the generated text test sets are closely aligned with the business scenarios, these text test sets are often highly homogeneous, and their language style lacks the fluency and depth of human natural language, deviating from the contextual richness and naturalness unique to human speech. As a result, when testers use such text test sets to test business models, it is difficult to discover potential problems in the business, which in turn reduces the user experience.
[0026] To this end, embodiments of the present disclosure provide a method for generating a text test set with human natural language attributes. First, the values of the natural language attributes (i.e., labels) of the original test text are determined to lay the foundation for the subsequent generation of the test text. The values of these labels are then used to optimize and determine a prompt word strategy for the original text. Subsequently, the original test text and the prompt word strategy are used to generate a target test text that conforms to human language characteristics and is naturally fluent.
[0027] In summary, this method of generating test text using natural language attributes can generate test text that conforms to human language changes, meeting the testers' requirements for the authenticity of the text test set, thereby improving the test effect and user experience.
[0028] Figure 1 1 shows a schematic diagram of an example environment 100 in which various embodiments of the present disclosure may be implemented. Figure 1 As shown, in order to obtain a test text set that has rich context and is more fluent and natural like human language, the original test text 110 can be input into the test text generation system 120, so that the target test text 130 that conforms to the distribution of human natural language characteristics can be obtained, thereby facilitating testers to objectively evaluate the business model.
[0029] In some embodiments, these original test texts 110 can be written by the user himself or generated by the user through a language model. For example, the user can input a scene description to the language model, so that the language model generates some original test texts that match the scene.
[0030] In some embodiments, the test text generation system 120 may integrate natural language processing technology, language models, and the like to understand and parse the complex characteristics and distribution patterns of human natural language. In some embodiments, to ensure that the generated target test text possesses the depth expected of human natural language, after the original test text 110 is fed into the test text generation system 120, tags may be determined for the original test text 110. These tags represent the characteristic distribution of human natural language, such as length, sentence structure, rhetoric, language style, communication platform, hot topics, and domain.
[0031] In some embodiments, the values of the tags are further refined classifications of these tags. For example, for rhetorical techniques, the values can be metaphors, personification, parallelism, etc. For example, for language tags, the values can be pure Chinese, Chinese-English mixed (mainly Chinese, with English words interspersed), pure English, etc. In some embodiments, the value of each tag is weighted, and its proportion is the weight. For example, among the three values of the rhetorical tag, the proportion of metaphor can be 40%, the proportion of contrast can be 40%, and the proportion of exaggeration can be 20%. In some embodiments, the distribution of the values and proportions of these tags can be preset, or they can be dynamically set after analyzing the user's generated needs.
[0032] In some embodiments, in order to make the generated target test text 130 more consistent with the application scenario of the original test text 110, the proportion of the values of its labels can be adjusted. For example, in a scenario where primary school students actively answer questions asked by the teacher, the proportion of the values of "excitement", "joy", "pride", etc. under the "emotion" label is higher than that of "fear".
[0033] In some embodiments, in order to enable the test text generation system 120 using natural language technology to generate a target test text 130 that meets the requirements, a prompt word strategy for the target test text can be generated first. For example, a plurality of tags can be combined to obtain a prompt word strategy. If there are only two tags, then one of the prompt word strategies 1 can be [tag 1 value 1 (proportion), tag 2 value 2 (proportion)], prompt word strategy 2 can be [tag 1 value 2 (proportion), tag 2 value 2 (proportion)]. By analogy, prompt word strategy 3 can be [tag 1 value 3 (proportion), tag 2 value 2 (proportion)], etc.
[0034] In some embodiments, in order to subsequently generate target test texts in conjunction with the prompt word strategy, the original test text 110 may be repeatedly expanded to the number of target test texts the user needs to generate. For example, if the original test text 110 is [original sentence 1; original sentence 2; original sentence 3], and the user needs to generate nine target test texts, the original test text 110 may be repeatedly expanded to the target number of nine, i.e., [original sentence 1; original sentence 1; original sentence 1; original sentence 2; original sentence 2; original sentence 2; original sentence 3; original sentence 3; original sentence 3].
[0035] In some embodiments, to ensure that the number of target test texts generated matches the target number determined by the user, a prompt word strategy for the target number of target test texts may be selected from multiple prompt word strategies based on the target number of target test texts determined by the user. For example, if the user determines that the number of target test texts to be generated is 9, then 9 prompt word strategies may be selected from multiple prompt word strategies as the prompt word strategy for the target test texts.
[0036] In some embodiments, the repeatedly expanded original test text and the obtained prompt word strategy corresponding to the target number can be fed into the language model to obtain a generated target test text 130. In some embodiments, the generated target test text 130 can be a target test text that is very close to, completely different from, or somewhere in between the semantics of the original test text 110.
[0037] In some embodiments, in order to make the language model have better generalization ability, the expected value of the original test text 110 and the generated target test text 130 can be used to train the language model.
[0038] It is understood that the test text generation system 120 may also be pre-installed with a prompt word strategy table. These prompt word strategy tables contain combinations of natural language labels, values, and their value ratios. Upon receiving the original test text 110, the system can select the most relevant prompt word strategy from the pre-installed prompt word strategy table based on the application scenario of the original test text 110 and the number of target test texts to be generated, thereby generating the target test text using the language model.
[0039] By using this method of natural language properties to generate test text, we can generate test text that conforms to human language changes, which meets the testers' requirements for the authenticity of the text test set, thereby improving the test results and user experience.
[0040] The following will be combined Figures 2 to 8 The method according to the embodiment of the present disclosure is described in detail. For ease of understanding, the specific data mentioned in the following description are exemplary and are not intended to limit the scope of protection of the present disclosure. It is understood that the embodiments described below may also include additional actions not shown and / or may omit the actions shown, and the scope of the present disclosure is not limited in this respect.
[0041] Figure 2 A flowchart of a method 200 for generating a test text according to some embodiments of the present disclosure is shown. The method 200 can be executed by a device for generating a test text, which can be, for example, a system configured on a cloud server, or an independent device or system. The device can be implemented in software and / or hardware. The method 200 is schematically described below using a device for generating a test text as an example. Figure 2 , method 200 may include block 202 , block 204 , and block 206 .
[0042] In block 202, the value of a label for the original test text is determined, where the label indicates an attribute of a natural language. Figure 1In order to make the generated target test text more consistent with the expression of human natural language, the test text generation system 120 can determine the labels for the original test text 110. These labels represent the characteristic distribution of human natural language, such as length, sentence structure, rhetorical techniques, language style, communication platform, hot topics, language, etc. In some embodiments, the values of these labels are further refined classifications of these labels. For example, for rhetorical techniques, the values can be metaphors, personification, parallelism, etc. For example, for language labels, the values can be pure Chinese, Chinese and English (mainly Chinese, with English words interspersed), pure English, etc. In some embodiments, the value of each label is weighted, and its proportion is the weight. For example, among the three values of the rhetorical label, the proportion of metaphor can be 40%, the proportion of contrast can be 40%, and the proportion of exaggeration can be 20%.
[0043] In block 204, based on the values, a prompt word strategy for the original test text is determined. Figure 1 In some embodiments, in order to enable the test text generation system 120 to generate a target test text 130 that meets the requirements, a prompt word strategy for the target test text can be generated. For example, a plurality of labels can be combined to obtain a prompt word strategy. If there are only two labels, then one of the prompt word strategies 1 can be [label 1 value 1 (percentage), label 2 value 2 (percentage)]. Similarly, prompt word strategy 2 can be [label 1 value 2 (percentage), label 2 value 2 (percentage)]. In some embodiments, if the value of label 1 is [value 1, value 2, value 3, value 4, value 5], the value of label 2 is [value 1, value 2, value 3, value 4, value 5, value 6, value 7, value 8, value 9], and the value of label 3 is [value 1, value 2], then 90 different combinations of labels, i.e., prompt word strategies, can be obtained.
[0044] In block 206, a target test text is generated based on the original test text and the prompt word strategy. Figure 1 In some embodiments, the test text generation system 120 can adopt natural language technology, which can be configured with a language model. In some embodiments, in order to subsequently combine with the prompt word strategy one by one to generate the target test text, the original test text 110 can be repeatedly increased to the quantity of the target test texts that the user needs to generate. The target quantity here is exactly the quantity of the target test texts that the user needs to generate. In some embodiments, in order to make the quantity of the target test texts generated consistent with the target quantity determined by the user, the prompt word strategy of the target quantity can be selected from a plurality of prompt word strategies. In some embodiments, the original test text after repeated expansion and the prompt word strategy corresponding to the target quantity obtained can be sent to the language model one by one, so that the target test text 130 generated can be obtained.
[0045] In the disclosed embodiments, the values of the labels for the original test text are first determined. Labels, the attributes of natural language, lay the foundation for the subsequent generation of the test text. These label values are then used to optimize and determine the prompt word strategy for the original text. Subsequently, the original test text and the prompt word strategy are used to generate a target test text that conforms to the characteristics of human language and flows naturally.
[0046] By using this method of natural language attributes to generate test text, we can generate test text that conforms to human language changes, meet the testers' practical needs for text test sets, improve test results, and thus enhance user experience.
[0047] Figure 3 FIG2 shows a schematic diagram of a framework 300 for generating test text according to some embodiments of the present disclosure. Figure 3 , at 310, the original test text is expanded to the target number. In some embodiments, the target number is the number of target test texts that need to be generated as defined by the user. Figure 4A To describe in detail, Figure 4A FIG2 shows a schematic diagram of a process 400A for generating a test text according to some embodiments of the present disclosure. Figure 4A There are 3 original test texts in the original test text set 410A, and the target number of the target test text set 420A defined by the user is 9. Therefore, in order to subsequently combine with the prompt word strategy one by one to generate the target test text, the 3 original test texts in the original test text set 410A can be repeatedly expanded to a set of 9 original test texts as shown in area 430A.
[0048] return Figure 3 , at 320, the application scenario of the original test text is determined. It can be understood that the application scenario here refers to the scenario or environment of the specific business field in which these test texts are designed, used or applied, such as a medical scenario or a legal scenario. In some embodiments, the application scenario can be determined based on the original test text input by the user. For example, if the original test text is "Isn't this one of unjust enrichment and gratuitous management?", it can be determined as a legal scenario. In some embodiments, the application scenario can also be determined based on the user's description of the target test text. For example, the user can give a description of the target test text generation, namely "Generate a set of relevant evaluations on questions asked by teachers in elementary school mathematics classes", which can be determined as a teaching scenario.
[0049] Continue to refer Figure 3At 330, labels corresponding to the original test text are determined. In some embodiments, the labels are human language feature distributions, such as sentence length, sentence structure, rhetoric, and superimposed errors, or sentence content attributes such as topic, field, language, and tone.
[0050] Continue to refer Figure 3 At 340, the value and distribution corresponding to the label are determined. Figure 4B To explain what the label value and its distribution are. Figure 4B Schematic diagram 400B showing labels, values and their proportions according to certain embodiments of the present disclosure. Figure 4B , these labels can be label 1 "emotion" and "rhetoric". The values of label 1 can be "anger" (accounting for 20%), "excitement" (accounting for 20%), "sadness" (accounting for 20%), "fear" (accounting for 40%), and the values of label 2 can be "metaphor" (accounting for 40%), "contrast" (accounting for 40%) and "exaggeration" (accounting for 20%). It is understandable that the types and number of labels are not limited, and the types of their values are also not limited. In some embodiments, these labels, values and proportions can be dynamically adjusted according to the application scenario. In some embodiments, each label is permuted and combined.
[0051] Combine Figure 4A In area 440A, the labels that match the application scenario are [label 1, label 2], and each label has its own value. For example, the value of label 1 is [value 1, value 2, value 3, value 4, value 5]. For example, the value of label 2 is [value 1, value 2, value 3, value 4, value 5, value 6, value 7, value 8, value 9]. By combining label 1 and label 2, 45 different prompt word strategies can be obtained. It can be understood that the prompt word strategy also includes the distribution ratio of each value. It can be understood that the values here all have their own distribution ratio. For example, the sum of the ratios of the various values of label 1 is 1, and the weight of each value can be dynamically determined according to the application scenario.
[0052] return Figure 3 , determine the prompt word strategy at 350. It is understandable that in some embodiments, the target test text is generated by a language model, so in order to generate a target test text that meets the requirements, a prompt word strategy for the target test text can be generated first. Figure 4A As can be seen in region 450A, the number of target test texts in the first column is 9, so it is necessary to select 9 appropriate label combinations from region 440A as the prompt word strategy.
[0053] Continue to refer Figure 3, at 360, generate target test text. Figure 4A , target test text 480A can be generated using language model 470A. As shown in area 460A, in some embodiments, the nine original test texts after repeated expansion and the nine prompt word strategies corresponding to the target number can be fed one by one into language model 470A, thereby obtaining target test text 480A with human natural language attributes.
[0054] By using this method of natural language properties to generate test text, we can generate test text that conforms to human language changes, which meets the testers' requirements for the authenticity of the text test set, thereby improving the user experience.
[0055] In some embodiments, the language model 370A can be trained using the expected value of the original test text and the generated target test text 480A. This can enhance the generalization capability of the language model in the test text generation system. It is understood that the language model 470A here can be the same as or different from the language model used to generate the original test text.
[0056] Figure 5 FIG2 shows a schematic diagram of an interactive page 500 for generating a test text according to some embodiments of the present disclosure. Figure 5 , the display interface 510 is a schematic diagram of the interface used by the user to generate the target test text set. In the display interface 510, the user can enter the original test text through the input box in area 520. In some embodiments, you can also click on area 522 to download the evaluation set template, and the user can modify the input on the downloaded evaluation set template, that is, enter the original test text. It is understandable that the original test text here must exist. In some embodiments, when the user fills in the relevant information of the evaluation set template, you can upload the file to the test text generation system by clicking the attachment option 524.
[0057] The following will be combined Figure 6 To illustrate, Figure 6 FIG2 shows a schematic diagram of an effect display 600 for generating a test text according to some embodiments of the present disclosure. Figure 6 The original test text 610, i.e., "Barbecue in City A is very popular recently. I'm looking for authentic restaurants in City B," can be input into the input box in area 520. Alternatively, it can be entered into the evaluation set template and then uploaded to the test text generation system 620 by clicking the nearby option 524.
[0058] Continue to refer Figure 5 In area 530, the user can enter the target number of target test texts that he or she wants to generate. Figure 6, the number of targets is 6. In area 540, the user can select the type of target test text generation task for this time through the drop-down option menu, such as debug mode. It is understood that in debug mode, the generated target test text is invalid, and only a few samples of the generated target test text are displayed.
[0059] Continue to refer Figure 5 In area 550, the user can click area 552 to download the evaluation set distribution ratio template. The user can fill in the distribution ratio of the label values in the downloaded evaluation set distribution ratio template. It is understandable that the evaluation set distribution ratio template here has already been pre-filled with some labels, values and their ratios. In some embodiments, after the user fills in the relevant information of the evaluation set distribution ratio template, the file can be uploaded to the test text generation system 620 by clicking area 554. It is understandable that the test text generation system 620 uses natural language processing technology and can perform text recognition, text processing and other operations on the uploaded file.
[0060] Combine Figure 6 For the original test text "Barbecue in City A is very popular recently. I'm searching for authentic restaurants in City B." Optional tags could be language style, emotional tone, hot topics, language, and rich text, as shown in Table 1 below:
[0061]
[0062]
[0063]
[0064] It is understood that if the percentage is left blank, it means that the label is not selected. In some embodiments, the evaluation set distribution template percentage can be predefined in the test text generation system. In some embodiments, the label distribution percentage does not have to be filled in by the user, and can also be determined by the test text generation system based on the original evaluation set entered by the user in area 520. It is understood that the labels and their values here are attribute features related to human natural language, such as tone, rhetoric, language, and other attributes.
[0065] Continue to refer Figure 5In area 560, the user can also make advanced configurations for the target test text to be generated. For example, you can click on area 562 to select how close the semantics of the generated target test text is to the original test text in the original evaluation set. "Medium" is the default configuration, which means that under the premise of satisfying the prompt word strategy, the semantics of the original sentence should be changed as little as possible. "Close" means that under the premise of not changing the semantics of the original sentence, as many rules as possible are satisfied, that is, the prompt word strategy composed of multiple labels is satisfied. "Far" means that under the premise of satisfying the rules composed of multiple labels, the divergent function of the language model in the test text generation system is brought into play, thereby generating more divergent target test texts. After the user has filled in the required information on the display interface 510, he can click the OK button to generate the target test text, combined with Figure 6 , what is displayed in area 630 are the 6 newly generated target test texts.
[0066] This method of using natural language properties to generate test text with one click is not only simple to operate, but also can generate test text that conforms to human language changes. It meets the practical needs of testers for text test sets, improves test results, and thus enhances user experience.
[0067] Figure 7 FIG. 7 is a block diagram of an apparatus 700 for generating a test text according to some embodiments of the present disclosure. Figure 7 As shown, apparatus 700 may include a value determination module 702 configured to determine a value for a label for an original test text, where the label indicates an attribute of a natural language. Apparatus 700 may also include a prompt word strategy determination module 704 configured to determine a prompt word strategy for the original test text based on the value. Furthermore, apparatus 700 may also include a target test text generation module 706 configured to generate a target test text based on the original test text and the prompt word strategy.
[0068] In some embodiments, the device 700 also includes: a target quantity acquisition module, configured to obtain the target quantity for the target test text input by the user; and a first acquisition module, configured to obtain the repeated original test text corresponding to the target quantity by repeatedly increasing the original test text to the target quantity.
[0069] In some embodiments, the apparatus 700 further includes an application scenario determination module configured to determine an application scenario of the original test text based on at least one of the original test text and a text description of the target test text by the user.
[0070] In some embodiments, the value determination module 702 includes: a first determination module, configured to determine a label for the original test text based on the application scenario; and a second determination module, configured to determine the value corresponding to the label and the proportion of the value based on the application scenario and the label, where the proportion indicates the weight of the value.
[0071] In some embodiments, the prompt word strategy determination module 704 includes: a third determination module, configured to determine a combination consisting of a first label and a second label, wherein the combination at least includes a proportion and a value corresponding to the first label and a proportion and a value corresponding to the second label.
[0072] In some embodiments, the prompt word strategy determination module 704 further includes: a fourth determination module configured to determine multiple prompt word strategies for the original test text based on the combination; and a fifth determination module configured to determine a target number of prompt word strategies from the multiple prompt word strategies based on the target number.
[0073] In some embodiments, the target test text generation module 706 includes: a generation module configured to generate a target test text corresponding to the target quantity based on the repeated original test text corresponding to the target quantity and the prompt word strategy corresponding to the target quantity by a language model.
[0074] In some embodiments, the target test text generation module 706 also includes: an expected value acquisition module, configured to obtain the expected value of the model for the original test text; and a training module, configured to train the language model through the target test text and the expected value for the original test text.
[0075] Figure 8 FIG1 shows a block diagram of an electronic device 800 according to some embodiments of the present disclosure. The device 800 may be a device or apparatus described in an embodiment of the present disclosure. Figure 8 As shown, the device 800 includes a central processing unit (CPU) and / or a graphics processing unit (GPU) 802, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 804 or computer program instructions loaded from a storage unit 816 into a random access memory (RAM) 806. Various programs and data required for the operation of the device 800 can also be stored in the RAM 806. The CPU / GPU 802, the ROM 804, and the RAM 806 are connected to each other via a bus 808. An input / output (I / O) interface 810 is also connected to the bus 808. Although not shown in FIG. Figure 8 As shown in FIG, device 800 may further include a co-processor.
[0076] Various components in device 800 are connected to I / O interface 810, including an input unit 812, such as a keyboard, mouse, etc.; an output unit 814, such as various types of displays, speakers, etc.; a storage unit 816, such as a magnetic disk, optical disk, etc.; and a communication unit 818, such as a network card, modem, wireless communication transceiver, etc. The communication unit 818 allows device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0077] The various methods or processes described above may be performed by the CPU / GPU 802. For example, in some embodiments, the methods may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 816. In some embodiments, part or all of the computer program may be loaded and / or installed onto the device 800 via the ROM 804 and / or the communication unit 818. When the computer program is loaded into the RAM 806 and executed by the CPU / GPU 802, one or more steps or actions in the methods or processes described above may be performed.
[0078] In some embodiments, the methods and processes described above may be implemented as a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0079] Computer-readable storage medium can be a tangible device that can keep and store the instructions used by the instruction execution device.Computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device or any suitable combination thereof.More specific examples (non-exhaustive list) of computer-readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove having instructions stored thereon, and any suitable combination thereof.Computer-readable storage medium used herein is not interpreted as a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagated by waveguides or other transmission media (for example, light pulses by fiber optic cables), or electrical signals transmitted by wires.
[0080] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0081] The computer program instructions for performing the disclosed operation can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data or source code or the object code written in any combination of one or more programming languages, programming languages include object-oriented programming languages, and conventional procedural programming languages.Computer-readable program instructions can be performed completely on a user's computer, partially on a user's computer, performed as an independent software package, partly on a user's computer and partly on a remote computer, or performed completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer by any type of network-including local area network (LAN) or wide area network (WAN), or can be connected to an external computer (such as utilizing an internet service provider to connect by the internet). In certain embodiments, by utilizing the state information of computer-readable program instructions to carry out personalized customization electronic circuits, such as programmable logic circuits, field programmable gate arrays (FPGAs) or programmable logic arrays (PLA), this electronic circuit can perform computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0082] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0083] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device, so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0084] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart, can be implemented by a special hardware-based system that performs the prescribed function or action, or can be implemented by a combination of special hardware and computer instructions.
[0085] The embodiments of the present disclosure have been described above. The above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, practical applications, or technical improvements to existing technologies, or to enable other persons skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for generating a test text, comprising: Determining a value of a label for an original test text, wherein the label indicates an attribute of a natural language; Determining a prompt word strategy for the original test text based on the value; as well as A target test text is generated based on the original test text and the prompt word strategy.
2. The method according to claim 1, further comprising: Obtaining a target number for the target test text input by a user; as well as The original test text is repeated to the target number by repeated addition, so as to obtain the repeated original test text corresponding to the target number.
3. The method according to claim 2, further comprising: An application scenario of the original test text is determined based on at least one of the original test text or a text description of the target test text by a user.
4. The method according to claim 3, wherein determining the value of the label for the original test text comprises: Based on the application scenario, determining a label for the original test text; and Based on the application scenario and the label, a value corresponding to the label and a proportion of the value are determined, where the proportion indicates a weight of the value.
5. The method according to claim 4, wherein determining a prompt word strategy for the original test text based on the value comprises: A combination consisting of a first tag and a second tag is determined, where the combination at least includes a proportion and a value corresponding to the first tag and a proportion and a value corresponding to the second tag.
6. The method according to claim 5, further comprising: Based on the combination, determining a plurality of prompt word strategies for the original test text; as well as Based on the target number, a cue word strategy for the target number is determined from the plurality of cue word strategies.
7. The method according to claim 6, wherein generating a target test text based on the original test text and the prompt word strategy comprises: A target test text corresponding to the target number is generated by a language model based on the repeated original test text corresponding to the target number and the prompt word strategy corresponding to the target number.
8. The method according to claim 7, further comprising: Obtaining an expected value of the model for the original test text; as well as The language model is trained using the target test text and the expected value.
9. The method according to claim 1, further comprising: The original test text is generated by a language model based on a text input from a user.
10. A device for generating a test text, comprising: a value determination module configured to determine a value of a label for an original test text, wherein the label indicates an attribute of a natural language; a prompt word strategy determination module, configured to determine a prompt word strategy for the original test text based on the value; as well as The target test text generation module is configured to generate a target test text based on the original test text and the prompt word strategy.
11. An electronic device comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, wherein when the instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 9. 12 . A computer-readable storage medium having computer-executable instructions stored thereon, wherein the computer-executable instructions are executed by a processor to implement the method according to claim 1 .
13. A computer program product tangibly stored on a non-transitory computer-readable medium and comprising computer-executable instructions which, when executed, cause a computer to perform the steps of the method according to any one of claims 1 to 9.
