A method for generating a dialogue, a related device, equipment and a storage medium

CN118535687BActive Publication Date: 2026-10-16TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310201137.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2026-10-16
Estimated Expiration
2043-02-22

AI Technical Summary

Technical Problem

[0004]发明人发现目前的方案中至少存在如下问题,目前,将各个状态表述语句作为生成模型的输入,通过生成模型预测得到的话术质量参差不齐,导致话术质量的可控性较差

Benefits of technology

[0088] This application provides a method for generating dialogue. First, a set of state expression statements is obtained. Then, based on statement mapping relationships, T sets of natural language description statements corresponding to the state expression statement set are generated. Next, based on the T sets of natural language description statements, T candidate dialogues are obtained using a text compression model. Then, based on the state expression statement set and the T candidate dialogues, a quality score is obtained for each candidate dialogue using a text ranking model. Finally, the top K candidate dialogues with the highest quality scores are determined from the T candidate dialogues, and these K candidate dialogues are used as the dialogue set corresponding to the target strategy point. Through the above method, dialogue generation is decomposed into two stages. The first stage reorganizes and transforms the state expression statement set based on statement mapping relationships to obtain a set of natural language description statements, thereby enriching the information. The second stage connects and compresses the combined set of natural language description statements and selects dialogues with higher quality scores. This allows for the acquisition of higher-quality dialogues, thus improving the controllability of dialogue generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535687B_ABST
    Figure CN118535687B_ABST
Patent Text Reader

Abstract

The application discloses a method for dialogue generation, related devices, equipment and storage media, and relates to the field of artificial intelligence. The method comprises the following steps: obtaining a state expression sentence set; generating a T-group natural language description sentence set corresponding to the state expression sentence set based on a sentence mapping relationship, wherein the sentence mapping relationship is used to describe the corresponding relationship between the state expression sentence and the natural language description sentence; obtaining T candidate dialogues through a text compression model based on the T-group natural language description sentence set; obtaining a quality score corresponding to each candidate dialogue through a text ranking model based on the state expression sentence set and the T candidate dialogues; determining the first K candidate dialogues with the maximum quality score from the T candidate dialogues, and taking the K candidate dialogues as a dialogue set corresponding to a target strategy point. The application can obtain a dialogue with high quality, thereby improving the controllability of dialogue generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular to a method, related apparatus, device, and storage medium for generating speech. Background Technology

[0002] In recent years, with the development of artificial intelligence (AI), dialogue between humans and smart devices has become an important interaction method in the intelligent era and a future trend in human-computer interaction. Taking a companion robot within a game application as an example, during gameplay, it needs to fully understand the player's state and use this understanding to generate dialogue and interact with the player.

[0003] To better engage in dialogue and interaction with players, a generative model can be invoked to obtain dialogue content. Currently, in related technologies, the training data for generative models includes state description statements and dialogue. The state description statements are abstractions of the player's state into atomic-level descriptions.

[0004] The inventors have discovered at least the following problems with current solutions: Currently, using various state statements as input to the generative model results in inconsistent speech quality predictions, leading to poor controllability of speech quality. No effective solution has yet been proposed to address these issues. Summary of the Invention

[0005] This application provides a method, related apparatus, device, and storage medium for generating scripts, which can obtain high-quality scripts and thus improve the controllability of script generation.

[0006] In view of this, this application provides a method for generating dialogue scripts, including:

[0007] Obtain a set of state statement statements, where the set of state statement statements corresponds to the target policy point, and the set of state statement statements includes N state statement statements, where N is an integer greater than or equal to 1.

[0008] Based on the statement mapping relationship, T sets of natural language description statements are generated corresponding to the set of state expression statements. Each set of natural language description statements includes one natural language description statement corresponding to each state expression statement. The statement mapping relationship is used to describe the correspondence between state expression statements and natural language description statements. T is an integer greater than or equal to 1.

[0009] Based on a set of T natural language description statements, T candidate statements are obtained through a text compression model, where there is a one-to-one correspondence between the candidate statements and the set of natural language description statements.

[0010] Based on the set of state description statements and T candidate statements, the quality score corresponding to each candidate statement is obtained through a text ranking model.

[0011] From T candidate statements, determine the top K candidate statements with the highest quality scores, and use the K candidate statements as the statement set corresponding to the target strategy point, where K is an integer greater than or equal to 1 and less than T.

[0012] This application also provides a script generation apparatus, comprising:

[0013] The acquisition module is used to acquire a set of state statement statements, where the set of state statement statements corresponds to the target policy point and includes N state statement statements, where N is an integer greater than or equal to 1.

[0014] The generation module is used to generate T sets of natural language description statements corresponding to the set of state expression statements based on the statement mapping relationship. Each set of natural language description statements includes one natural language description statement corresponding to each state expression statement. The statement mapping relationship is used to describe the correspondence between state expression statements and natural language description statements. T is an integer greater than or equal to 1.

[0015] The acquisition module is also used to acquire T candidate statements based on T sets of natural language description statements through a text compression model, wherein the candidate statements have a one-to-one correspondence with the natural language description statement sets;

[0016] The acquisition module is also used to obtain the quality score corresponding to each candidate dialogue based on the set of state expression statements and T candidate dialogues through a text ranking model;

[0017] The generation module is also used to determine the top K candidate dialogues with the highest quality scores from T candidate dialogues, and to use the K candidate dialogues as the dialogue set corresponding to the target strategy point, where K is an integer greater than or equal to 1 and less than T.

[0018] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0019] The generation module is specifically used to transform each state representation statement in the state representation statement set based on the statement mapping relationship, so as to obtain at least one natural language description statement corresponding to each state representation statement.

[0020] Each state statement is combined with at least one natural language description statement to obtain a set of T natural language description statements.

[0021] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0022] The generation module is specifically used to split the set of state description statements into N state description statements;

[0023] Take at least one state statement from the N state statement statements as the first statement set to obtain M first statement sets, where M is an integer greater than or equal to 1;

[0024] Based on M sets of first statements, generate at least one set of second statements, wherein each set of second statements includes at least one set of first statements;

[0025] Based on the statement mapping relationship, each of the at least one second statement set is transformed to obtain at least one natural language description statement corresponding to each state expression statement in each second statement set;

[0026] Combine at least one natural language description statement corresponding to each state statement in each second statement set to obtain T sets of natural language description statements.

[0027] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0028] The generation module is specifically used to take at least one of the M first statement sets as the second statement set, and obtain P second statement sets, where P is an integer greater than or equal to 1.

[0029] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0030] The generation module is specifically used to take at least one of the M first statement sets as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1;

[0031] Randomly select at least one set of second statements from P sets of second statements.

[0032] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0033] The generation module is specifically used to take at least one of the M first statement sets as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1;

[0034] Get the statement coverage rate of each of the P second statement sets, where the statement coverage rate represents the proportion of non-repeated state statement statements in the state statement set.

[0035] From P sets of second statements, select a set of second statements whose statement coverage is greater than or equal to the coverage threshold to obtain at least one set of second statements.

[0036] In one possible design, in another implementation of another aspect of the embodiments of this application, the script generation device further includes a matching module;

[0037] The acquisition module is also used to acquire the strategy point to be labeled and the corresponding utterance to be labeled, wherein the strategy point to be labeled includes at least one state expression statement and the utterance to be labeled includes at least one natural language description statement.

[0038] The matching module is used to match each natural language description statement in the utterance to be labeled with the state expression statement in the policy point to be labeled, so as to obtain the statement mapping relationship.

[0039] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0040] The acquisition module is also used to acquire status description statements;

[0041] The acquisition module is also used to acquire natural language description statements based on state expression statements through the first text generation model;

[0042] The matching module is also used to match state statements with natural language description statements to obtain statement mapping relationships.

[0043] In one possible design, in another implementation of another aspect of the embodiments of this application, the script generation device further includes a training module;

[0044] The acquisition module is also used to acquire samples of state description statements and natural language description statements;

[0045] The acquisition module is also used to obtain the target expression statement based on the state expression statement sample through the first text generation model;

[0046] The training module is used to update the model parameters of the first text generation model based on the target statement and natural language description statement samples.

[0047] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0048] The acquisition module is specifically used to acquire existing state description statements;

[0049] The existing state description statements are filled into the preset slots of the discrete text template to obtain the target input information, wherein the discrete text template includes text units;

[0050] Based on the target input information, the state description statement is obtained through the second text generation model.

[0051] or,

[0052] The acquisition module is specifically used to acquire existing state description statements;

[0053] The existing state description statements are embedded to obtain text embedding vectors.

[0054] The text embedding vector is filled into the preset slots of the connected text template to obtain the target input information, wherein the connected text template includes learnable parameters;

[0055] Based on the target input information, the state description statement is obtained through the second text generation model.

[0056] or,

[0057] The acquisition module is specifically used to acquire existing state description statements;

[0058] The existing state description statements are embedded to obtain text embedding vectors.

[0059] The text embedding vector is filled into the preset slots of the connected text template to obtain the target input information. The connected text template includes text units and learnable parameters.

[0060] Based on the target input information, the state description statement is obtained through the second text generation model.

[0061] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0062] The acquisition module is also used to acquire a set of natural language description statements to be trained, wherein the set of natural language description statements to be trained includes at least one natural language description statement;

[0063] The acquisition module is also used to acquire the speech samples corresponding to the set of natural language description statements to be trained;

[0064] The acquisition module is also used to acquire predicted speech based on the set of natural language description statements to be trained through a text compression model;

[0065] The training module is also used to update the model parameters of the text compression model based on the predicted speech and speech samples.

[0066] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0067] The acquisition module is specifically used to acquire the set of raw natural language description statements;

[0068] If the original set of natural language description statements includes at least two natural language description statements, then the order of appearance of each natural language description statement in the original set of natural language description statements is adjusted to obtain the set of natural language description statements to be trained.

[0069] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0070] The acquisition module is specifically used to acquire a set of original natural language description statements, wherein the set of original natural language description statements includes at least one natural language description statement;

[0071] If the natural language description statements in the original set of natural language description statements contain conjunctions, then remove the conjunctions from the natural language description statements to obtain the set of natural language description statements to be trained.

[0072] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0073] The acquisition module is specifically used to acquire a set of original natural language description statements, wherein the set of original natural language description statements includes at least one natural language description statement;

[0074] If the natural language description statements in the original set of natural language description statements include preset expression statements, then the preset expression statements in the natural language description statements are changed to standard expression statements to obtain the set of natural language description statements to be trained. The semantics of the preset expression statements are used to replace the standard expression statements.

[0075] In one possible design, in another implementation of another aspect of the embodiments of this application,

[0076] The acquisition module is also used to acquire a set of state expression statements to be trained and a script to be trained, wherein the set of state expression statements includes at least one state expression statement.

[0077] The acquisition module is also used to acquire the set of statements describing the state to be trained and the labeled scores of the statements to be trained.

[0078] The acquisition module is also used to obtain the predicted quality score based on the set of state description statements to be trained and the speech to be trained through a text ranking model.

[0079] The training module is also used to update the model parameters of the text ranking model based on the predicted quality score and the labeled score.

[0080] In one possible design, in another implementation of another aspect of the embodiments of this application, the script generation device further includes a sending module;

[0081] The acquisition module is also used to acquire the set of dialogue corresponding to the target strategy point when the game state of the target object is detected to meet the target strategy point.

[0082] The acquisition module is also used to retrieve target scripts from the script collection;

[0083] The sending module is used to send the target script to the terminal so that the terminal can play the target script.

[0084] In another aspect, this application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the methods described above.

[0085] Another aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the methods described above.

[0086] Another aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the methods described above.

[0087] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0088] This application provides a method for generating dialogue. First, a set of state expression statements is obtained. Then, based on statement mapping relationships, T sets of natural language description statements corresponding to the state expression statement set are generated. Next, based on the T sets of natural language description statements, T candidate dialogues are obtained using a text compression model. Then, based on the state expression statement set and the T candidate dialogues, a quality score is obtained for each candidate dialogue using a text ranking model. Finally, the top K candidate dialogues with the highest quality scores are determined from the T candidate dialogues, and these K candidate dialogues are used as the dialogue set corresponding to the target strategy point. Through the above method, dialogue generation is decomposed into two stages. The first stage reorganizes and transforms the state expression statement set based on statement mapping relationships to obtain a set of natural language description statements, thereby enriching the information. The second stage connects and compresses the combined set of natural language description statements and selects dialogues with higher quality scores. This allows for the acquisition of higher-quality dialogues, thus improving the controllability of dialogue generation. Attached Figure Description

[0089] Figure 1 This is a schematic diagram of an implementation environment for the script generation method in this application.

[0090] Figure 2 This is a schematic diagram of another implementation environment for the script generation method in this application;

[0091] Figure 3 This is a flowchart illustrating the script generation method in an embodiment of this application;

[0092] Figure 4 This is a schematic diagram of a state description statement output based on a second text generation model in an embodiment of this application;

[0093] Figure 5 This is a schematic diagram illustrating the output of corresponding dialogue based on a text compression model in an embodiment of this application;

[0094] Figure 6 This is a schematic diagram of the scripted speech in an embodiment of this application;

[0095] Figure 7 This is a schematic diagram of the overall process of the script generation method in the embodiments of this application;

[0096] Figure 8 This is a schematic diagram of a speech generation device in an embodiment of this application;

[0097] Figure 9 This is a schematic diagram of the structure of a computer device in an embodiment of this application. Detailed Implementation

[0098] This application provides a method, related apparatus, device, and storage medium for generating scripts, which can obtain high-quality scripts and thus improve the controllability of script generation.

[0099] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “corresponding,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0100] Today, with the development of artificial intelligence (AI), dialogue between humans and smart devices is an important interaction method in the intelligent era and a future trend in human-computer interaction. To enhance the user's gaming experience, some game applications are adding interactive features. However, diverse interactions often require rich dialogue; therefore, acquiring high-quality dialogue has become a pressing issue.

[0101] This application provides a method for generating dialogue scripts, which decomposes script generation into two stages. The first stage enriches the information content, and the second stage selects a higher-quality script from a variety of scripts, thereby improving the controllability of script generation. The dialogue script generation method provided in this application can be applied in at least one of the following scenarios.

[0102] (1) Companion robots;

[0103] A companion robot can be set up within a game application. During gameplay, it understands the state of the user-controlled game character and interacts with the user by outputting appropriate dialogue. The in-game companion robot supports a broadcast function. For example, the broadcast function refers to providing game hints to the user based on their state during the game.

[0104] (2) Non-player character (NPC):

[0105] During gameplay, user-controlled game characters may encounter NPCs in specific game scenarios. Based on this, NPCs interact with the user by understanding the user's state and outputting appropriate dialogue. For example, when a user-controlled game character arrives at a certain game scene, the NPC might play a dialogue prompting the user on how to proceed.

[0106] (3) Physical robots;

[0107] Physical robots can establish communication connections with user terminals via Bluetooth, wired connections, or local area network connections. This allows them to capture the real-time status of the user-controlled game character during gameplay and output corresponding dialogue to interact with the user. Similarly, physical robots can also support broadcast functions, as described above, and will not be repeated here.

[0108] It should be noted that the above application scenarios are merely examples, and the script generation method provided in this embodiment can also be applied to other scenarios, which are not limited here. Furthermore, the user in this application can also be a device with AI capabilities.

[0109] Understandably, this application relates to AI-based natural language processing (NLP) and machine learning (ML) technologies. AI, in particular, refers to the theories, methods, technologies, and application systems that utilize digital computers or computers-controlled machines to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine capable of reacting in a manner similar to human intelligence. AI essentially studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities.

[0110] AI technology is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing (NLP), as well as machine learning / deep learning, autonomous driving, and intelligent transportation.

[0111] Natural Language Processing (NLP) is an important area within computer science and AI. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close connection with linguistic research. NLP technologies typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.

[0112] Machine Learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. ML is the core of AI and the fundamental way to endow computers with intelligence; its applications span all areas of AI. ML and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.

[0113] Based on this, this application proposes a method for generating dialogue scripts. The method provided in this application can be applied to... Figure 1 or Figure 2 The implementation environment shown Figure 1 The implementation environment shown includes a terminal 110 and a server 120, and the terminal 110 and the server 120 can communicate with each other through a communication network 130. Figure 2 The implementation environment shown includes terminal 110.

[0114] The communication network 130 involved in this application uses standard communication technologies and / or protocols, typically the Internet, but can also be any network, including but not limited to Bluetooth, local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, private network, or any combination of virtual private network. In some embodiments, customized or dedicated data communication technologies may be used to replace or supplement the aforementioned data communication technologies.

[0115] The terminal 110 involved in this application includes, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The client is deployed on the terminal 110 and can run on the terminal 110 via a browser or as a standalone app. The server 120 involved in this application can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and AI platforms. It should be noted that this application uses the configuration and deployment of the deep learning model 140 on the server 120 as an example. In some embodiments, the configuration of the deep learning model 140 can also be deployed on the terminal 110. In some embodiments, part of the configuration of the deep learning model 140 is deployed on the terminal 110, and part of the configuration is deployed on the server 120. The deep learning model 140 involved in this application includes a text compression model and a text sorting model.

[0116] In online games, combined Figure 1 In the illustrated implementation environment, terminal 110 feeds back game status information to server 120 in real time via communication network 130. Server 120 determines whether a strategy point has been hit based on the game status information. If a strategy point is hit, it obtains the set of state description statements corresponding to that strategy point and generates T sets of natural language description statements based on the statement mapping relationship. Then, it calls deep learning model 140 to process the T sets of natural language description statements to filter out a set of dialogues and select a specific dialogue from the set. Finally, server 120 feeds back the dialogue to terminal 110 via communication network 130, and terminal 110 broadcasts the dialogue.

[0117] In single-player games, combined Figure 2 In the implementation environment shown, terminal 110 acquires real-time game state information. Then, based on the game state information, it determines whether a strategy point has been hit. If a strategy point is hit, it acquires the set of state description statements corresponding to that strategy point and generates T sets of natural language description statements based on the statement mapping relationship. Then, deep learning model 140 is invoked to process the T sets of natural language description statements to filter out the dialogue set. Finally, terminal 110 selects a dialogue from the dialogue set for broadcast.

[0118] Based on the above introduction, the method for generating the script in this application will be described below. Please refer to [link / reference]. Figure 3 In this application, the method for generating dialogue scripts can be completed independently by the server, independently by the terminal, or jointly by the terminal and the server. The method of this application includes:

[0119] 210. Obtain the set of state statement statements, where the set of state statement statements corresponds to the target policy point, and the set of state statement statements includes N state statement statements, where N is an integer greater than or equal to 1.

[0120] In one or more embodiments, the state of a game character is abstracted into atomic-level descriptive statements, i.e., state representation statements (tokens) are obtained. Based on this, a set of state representation statements can be mined from real games, where the set of state representation statements can also be called "strategy points".

[0121] It should be noted that, for ease of explanation, this application uses any one strategy point (i.e., the target strategy point) as an example for description, and the target strategy point corresponds to N state description statements.

[0122] 220. Based on the statement mapping relationship, generate T sets of natural language description statements corresponding to the set of state expression statements. Each set of natural language description statements includes one natural language description statement corresponding to each state expression statement. The statement mapping relationship is used to describe the correspondence between state expression statements and natural language description statements. T is an integer greater than or equal to 1.

[0123] In one or more embodiments, a statement mapping relationship is obtained, wherein the statement mapping relationship is used to describe the correspondence between state representation statements and natural language description statements. Based on this, each state representation statement can be converted into a natural language description statement according to the statement mapping relationship, and then recombined into several sets of natural language description statements.

[0124] For example, suppose the status statement is "An airdrop is in sight," its corresponding natural language description could be "An airdrop has been found nearby." It's understandable that in practice, one status statement can correspond to multiple natural language descriptions. For instance, the status statement "An airdrop is in sight" could correspond to "An airdrop has been found nearby" and "An airdrop has appeared nearby." It's understood that the status statement refers to the standard expression of a game character's status, such as "Gunfire is heard nearby." The natural language description is an extended description of the status statement, such as "Gunfire has been heard nearby, fighting has started."

[0125] 230. Based on a set of T natural language description statements, obtain T candidate statements through a text compression model, wherein the candidate statements have a one-to-one correspondence with the set of natural language description statements;

[0126] In one or more embodiments, after obtaining T sets of natural language description statements, each set of natural language description statements is used as input to a text compression model, and the text compression model outputs the candidate dialogue corresponding to each set of natural language description statements, thereby obtaining T candidate dialogues.

[0127] It should be noted that the text compression model involved in the embodiments of this application may be a bidirectional and auto-regressive transformer (BART) model, or a unified language model (UniLM), or a generative pre-training model (GPT model), or a transfer text-to-text transformer (T5), or other types of models, which are not limited here.

[0128] 240. Based on the set of state description statements and T candidate statements, obtain the quality score corresponding to each candidate statement through a text ranking model;

[0129] In one or more embodiments, after obtaining T candidate dialogues, each candidate dialogue and a set of state expression statements are used as input to a text ranking model. The text ranking model outputs a quality score corresponding to each candidate dialogue, thus obtaining T quality scores. The quality score can range from 0 to 1, and the higher the quality score of a candidate dialogue, the better its quality.

[0130] It should be noted that the text ranking model involved in the embodiments of this application may be a bidirectional encoder representation from transformers (BERT) model, or a robustly optimized BERT pretraining approach (RoBERTa), or an efficient learning an encoder that classifies token replacements accurately (ELECTRA), or a lightweight BERT (a liteBERT, ALBERT), or other types of models, which are not limited here.

[0131] 250. From T candidate statements, determine the top K candidate statements with the highest quality scores, and use the K candidate statements as the statement set corresponding to the target strategy point, where K is an integer greater than or equal to 1 and less than T.

[0132] In one or more embodiments, after obtaining the quality score corresponding to each of the T candidate dialogues, the T candidate dialogues are sorted in descending order of quality score. Thus, the K candidate dialogues with the highest quality scores are taken as the dialogue set corresponding to the target strategy point; for example, K can be 3.

[0133] Specifically, and exemplarily, suppose the input target strategy point (i.e., the set of state statements) is "No attack equipment / Gunfire nearby / About to retreat / About to search for supplies". Using the script generation method provided in this application, a sorted script set can be output. Suppose the script set includes 3 candidate scripts; exemplarily, the 3 candidate scripts are as follows:

[0134] Candidate dialogue 1: "There's a fight going on nearby. A special forces soldier who hasn't found a gun is like a mobile delivery. He should play it safe and go to the nearby houses to search for weapons to protect himself."

[0135] Candidate dialogue 2: "We heard gunfire nearby. We didn't find any guns, so let's play it safe and search for other supplies first. We can only fight them if we have equipment."

[0136] Candidate line 3: "There's a fight going on nearby. We didn't find any guns, so let's retreat and search for resources."

[0137] As can be seen, by using the method provided in this application, a corresponding set of discourse can be obtained based on the input strategy points.

[0138] This application provides a method for generating dialogue scripts. The method decomposes dialogue script generation into two stages. The first stage reorganizes and transforms a set of state description statements based on statement mapping relationships to obtain a set of natural language description statements, thereby enriching the information. The second stage connects and compresses the combined set of natural language description statements, selecting dialogue scripts with higher quality scores. This allows for the generation of higher-quality dialogue scripts, thus improving the controllability of dialogue script generation.

[0139] Optionally, in the above Figure 3 Based on the corresponding embodiments, in another optional embodiment provided by this application, a set of T natural language description statements corresponding to the set of state description statements is generated based on the statement mapping relationship, which may specifically include:

[0140] Based on the statement mapping relationship, each state statement in the state statement set is transformed to obtain at least one natural language description statement corresponding to each state statement.

[0141] Each state statement is combined with at least one natural language description statement to obtain a set of T natural language description statements.

[0142] In one or more embodiments, a method for generating several sets of natural language description statements is described. As can be seen from the foregoing embodiments, the statement mapping relationship is used to describe the correspondence between state expression statements and at least one natural language description statement. Therefore, several sets of natural language description statements can be constructed based on the statement mapping relationship.

[0143] Specifically, for ease of understanding, please refer to Table 1, which is a schematic diagram of the statement mapping relationship.

[0144] Table 1

[0145]

[0146] It is evident that the status statement "Airdrop within sight" corresponds to two natural language description statements, while the status statement "Supplies plentiful" corresponds to one natural language description statement.

[0147] For example, suppose the set of state statements corresponding to the target strategy point includes two state statements (in this case, N=2), namely, "Airdrop / Supplies are available within the field of view", where " / " represents "and". Based on this, and combining the statement mapping relationship shown in Table 1, at least one natural language description statement corresponding to each state statement is combined, thus obtaining the following T sets of natural language description statements (all_lans):

[0148] [An airdrop has been discovered nearby; we have ample supplies.]

[0149] [Airdrops have already appeared nearby, and we have plenty of supplies.]

[0150] It should be noted that, based on Table 1, two sets of natural language description statements can be obtained. In practical applications, both sets of natural language description statements can be used as input to the text compression model, or a portion of the natural language description statements can be selected from the two sets as input to the text compression model.

[0151] Secondly, this application provides a method for generating several sets of natural language description statements. Using this method, and leveraging pre-built statement mapping relationships, state statements can be directly converted into one or more related natural language description statements. This not only enhances the richness of state statement representations but also increases the diversity of textual expression when multiple natural language description statements are associated.

[0152] Optionally, in the above Figure 3 Based on the corresponding embodiments, in another optional embodiment provided by this application, a set of T natural language description statements corresponding to the set of state description statements is generated based on the statement mapping relationship, which may specifically include:

[0153] The set of state description statements is split into N state description statements;

[0154] Take at least one state statement from the N state statement statements as the first statement set to obtain M first statement sets, where M is an integer greater than or equal to 1;

[0155] Based on M sets of first statements, generate at least one set of second statements, wherein each set of second statements includes at least one set of first statements;

[0156] Based on the statement mapping relationship, each of the at least one second statement set is transformed to obtain at least one natural language description statement corresponding to each state expression statement in each second statement set;

[0157] Combine at least one natural language description statement corresponding to each state statement in each second statement set to obtain T sets of natural language description statements.

[0158] In one or more embodiments, another method for generating several sets of natural language description statements is introduced. As can be seen from the foregoing embodiments, the statement mapping relationship is used to describe the correspondence between state expression statements and at least one natural language description statement. Therefore, several sets of natural language description statements can be constructed based on the statement mapping relationship.

[0159] Specifically, for ease of understanding, please refer to Table 2, which is a schematic diagram of the statement mapping relationship.

[0160] Table 2

[0161] There is an airdrop within sight. An airdrop was found nearby. Abundant supplies We have abundant supplies Full health The current condition is very good.

[0162] As can be seen, the status statements "airdrop within sight", "abundant supplies", and "full health" each correspond to a natural language description statement.

[0163] For example, suppose the set of state statements corresponding to the target strategy point includes three state statements (in this case, N=3), namely, "Airdrop within sight / Abundant supplies / Full health", where " / " represents "and". Therefore, the set of state statements is split into 3 state statements, and k state statements are selected from them (for example, k is an integer greater than or equal to 1 and less than or equal to 4) for combination, thus obtaining M sets of first statements (all_tokens), namely:

[0164] [An airdrop is within sight] (i.e., k=1 at this time)

[0165] [Supplies are plentiful] (i.e., k=1 at this time)

[0166] [Full health] (i.e., k=1 at this time)

[0167] [There is an airdrop / abundant supplies within the field of vision] (i.e., k=2 at this time)

[0168] [There is an airdrop / full health within the field of vision] (i.e., k=2 at this time)

[0169] [Abundant resources / Full health] (i.e., k=2 at this time)

[0170] [Airdrop within sight / Abundant supplies / Full health] (i.e., k=3 at this time)

[0171] In the example above, M equals 7, meaning 7 sets of first statements are obtained. These M sets of first statements are then combined to obtain at least one set of second statements (all_mix_tokens). Based on this, and referring to the statement mapping relationship shown in Table 2, at least one natural language description statement corresponding to each state statement in each set of second statements is combined. The combination method can be found in the aforementioned embodiment and will not be repeated here. Thus, T sets of natural language description statements (all_lans) are obtained.

[0172] Secondly, this application provides another method for generating several sets of natural language description statements. Using this method, firstly, the state expression statements are recombinated; then, using a pre-built statement mapping relationship, the combined state expression statements can be directly converted into one or more related natural language description statements. This not only enhances the richness of the state expression statements but also increases the diversity of textual expression when multiple natural language description statements are associated.

[0173] Optionally, in the above Figure 3 Based on the corresponding embodiments, in another optional embodiment provided by this application, generating at least one second statement set according to M first statement sets may specifically include:

[0174] Take at least one of the M first statement sets as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1.

[0175] In one or more embodiments, a method for generating several sets of second statements is described. As can be seen from the foregoing embodiments, after obtaining M sets of first statements (all_tokens), the M sets of first statements can be fully combined to obtain P sets of second statements (all_mix_tokens). Here, P is an integer greater than or equal to 1.

[0176] Specifically, for ease of explanation, taking the seven first statement sets involved in the aforementioned embodiment as an example, we obtain the complete second statement set (all_mix_tokens). Below are some examples of the complete second statement set (all_mix_tokens):

[0177] An airdrop is within sight.

[0178] [Airdrops are within sight, supplies are plentiful]

[0179] [Airdrop and full health are within sight]

[0180] [Airdrop within sight / Abundant supplies]

[0181] [Airdrop within sight / Full health within sight]

[0182] [Airdrop within sight, ample supplies / full health]

[0183] [Airdrop within sight / Abundant supplies / Full health]

[0184] [Airdrop within sight, ample supplies, full health]

[0185] [Airdrop within sight, abundant supplies, airdrop / abundant supplies within sight]

[0186] [Airdrop within sight, abundant supplies, airdrop within sight / full health]

[0187] [Airdrop within sight, abundant supplies, abundant supplies / full health]

[0188] [Airdrop within sight, abundant supplies, airdrop within sight / abundant supplies / full health]

[0189] [Airdrop within sight, full health, airdrop within sight / abundant supplies]

[0190] [Airdrop within sight, full health, airdrop / full health within sight]

[0191] [Airdrop within sight, full health, abundant supplies / full health]

[0192] [Airdrop within sight, full health, airdrop within sight / abundant supplies / full health]

[0193] [Airdrop within sight, Airdrop within sight / Abundant supplies, Airdrop within sight / Full health]

[0194] [Airdrop within sight, Airdrop within sight / Abundant supplies, Abundant supplies / Full health]

[0195] [Airdrop within sight, Airdrop within sight / Abundant supplies, Airdrop within sight / Abundant supplies / Full health]

[0196] [Airdrop within sight, Airdrop within sight / Full health, Abundant supplies / Full health]

[0197] [Airdrop within sight, Airdrop within sight / Full health, Airdrop within sight / Abundant supplies / Full health]

[0198] [Airdrop within sight, abundant supplies / full health, airdrop within sight / abundant supplies / full health]

[0199] [Airdrop within sight, abundant supplies, full health, airdrop / abundant supplies within sight]

[0200] [Airdrop within sight, abundant supplies, full health, airdrop within sight / full health]

[0201] [Airdrop within sight, abundant supplies, full health, abundant supplies / full health]

[0202] [Airdrop within sight, abundant supplies, full health, airdrop within sight / abundant supplies / full health]

[0203] [Airdrop within sight, abundant supplies, full health, airdrop within sight / abundant supplies, airdrop within sight / full health]

[0204] [Airdrop within sight, abundant supplies, full health, airdrop within sight / abundant supplies, abundant supplies / full health]

[0205] [Airdrop within sight, abundant supplies, full health, airdrop within sight / abundant supplies, airdrop within sight / abundant supplies / full health]

[0206] [Airdrop within sight, abundant supplies, full health, airdrop within sight / abundant supplies, airdrop within sight / full health, abundant supplies / full health]

[0207] [Airdrop within sight, abundant supplies, full health, airdrop within sight / abundant supplies, airdrop within sight / full health, airdrop within sight / abundant supplies / full health]

[0208] [Airdrop within sight, abundant supplies, full health, airdrop within sight / abundant supplies, airdrop within sight / full health, abundant supplies / full health, airdrop within sight / abundant supplies / full health]

[0209] [Abundant Supplies]

[0210] [Abundant supplies, full health]

[0211] [Abundant supplies, airdrops within sight / Abundant supplies]

[0212] [Abundant supplies, airdrops within sight / full health]

[0213] [Abundant supplies, Abundant supplies / Full health]

[0214] ...

[0215] It is understandable that, within the full set of second statements, no two sets of second statements contain the same set of first statements.

[0216] Furthermore, this application provides a method for generating several sets of second statements. Using the above method, all M sets of first statements are combined, and the results of all combinations are used as sets of second statements. This yields the most comprehensive combination results, thereby increasing the richness of information and contributing to the generation of higher-quality scripts.

[0217] Optionally, in the above Figure 3Based on the corresponding embodiments, in another optional embodiment provided by this application, generating at least one second statement set according to M first statement sets may specifically include:

[0218] Take at least one of the M first statement sets as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1;

[0219] Randomly select at least one set of second statements from P sets of second statements.

[0220] In one or more embodiments, another method for generating several sets of second statements is introduced. As can be seen from the foregoing embodiments, after obtaining M sets of first statements (all_tokens), the M sets of first statements can be fully combined to obtain P sets of second statements (all_mix_tokens). Here, P is an integer greater than or equal to 1.

[0221] Specifically, each set of second statements can be numbered, for example:

[0222] [Airdrop within sight] - Number 1;

[0223] [Airdrop available within sight, supplies plentiful] - Number 2;

[0224] [Airdrop within sight, full health] - Number 3;

[0225] ...

[0226] This process continues until P numbers are obtained. A random function can then be used to select several numbers from 1 to P, and the corresponding sets of second statements are output. This yields at least one set of second statements available for subsequent processing.

[0227] Furthermore, this application provides another method for generating several sets of second statements. Using the above method, all M sets of first statements are combined, and a subset is randomly selected from the combined results as the second statement set. This improves the richness of information while reducing data processing volume, saving data processing resources and improving the efficiency of statement generation.

[0228] Optionally, in the above Figure 3 Based on the corresponding embodiments, in another optional embodiment provided by this application, generating at least one second statement set according to M first statement sets may specifically include:

[0229] Take at least one of the M first statement sets as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1;

[0230] Get the statement coverage rate of each of the P second statement sets, where the statement coverage rate represents the proportion of non-repeated state statement statements in the state statement set.

[0231] From P sets of second statements, select a set of second statements whose statement coverage is greater than or equal to the coverage threshold to obtain at least one set of second statements.

[0232] In one or more embodiments, a method for generating several sets of second statements is described. As can be seen from the foregoing embodiments, after obtaining M sets of first statements (all_tokens), the M sets of first statements can be fully combined to obtain P sets of second statements (all_mix_tokens). Here, P is an integer greater than or equal to 1.

[0233] Specifically, for each second set of statements, its corresponding statement coverage rate can be calculated. Statement coverage rate represents the proportion of unique state statements in the second set of statements. Assume the set of state statements corresponding to the target strategy point includes three state statements (N=3): "Airdrop within sight / Abundant supplies / Full health". Based on this, the following example will illustrate how to calculate the second set of statements.

[0234] For example, taking the second statement set "[There is an airdrop within the field of view]" as an example, the second statement set only includes the status statement "There is an airdrop within the field of view", which accounts for 1 / 3 of the status statement set.

[0235] For example, taking the second set of statements, "Airdrop within sight, abundant supplies", as an example, the second set of statements includes the status statements "Airdrop within sight" and "Abundant supplies", accounting for 2 / 3 of the status statement set.

[0236] For example, taking the second statement set [Airdrop within sight, abundant supplies, full health] as an example, the second statement set includes the status statements "Airdrop within sight", "Abundant supplies" and "Full health", accounting for 1% of the status statement set.

[0237] For example, taking the second set of statements as an example, which includes the status statements "Airdrop within sight" and "Sufficient supplies within sight", the second set of statements includes the status statements "Airdrop within sight" and "Sufficient supplies", accounting for 2 / 3 of the status statement set.

[0238] Assuming the coverage threshold is 1 (i.e., 100%), then a set of second statements with a coverage rate of 1 can be selected from P sets of second statements for subsequent processing.

[0239] Furthermore, this application provides a method for generating several sets of second statements. Using the above method, M sets of first statements are fully combined, and the results with higher statement coverage are selected as the second statement set. Therefore, on the one hand, it can improve the richness of information while obtaining higher-quality candidate statements; on the other hand, it can reduce the amount of data processing, saving data processing resources and improving the efficiency of statement generation.

[0240] Optionally, in the above Figure 3 Based on the corresponding embodiments, another optional embodiment provided in this application may further include:

[0241] Obtain the strategy point to be labeled and the corresponding utterance to be labeled, wherein the strategy point to be labeled includes at least one state statement and the utterance to be labeled includes at least one natural language description statement.

[0242] Each natural language description statement in the utterance to be labeled is matched with the state expression statement in the policy point to be labeled to obtain the statement mapping relationship.

[0243] In one or more embodiments, a method for constructing statement mapping relationships is described. As can be seen from the foregoing embodiments, initial statement mapping relationships can be established through manual annotation. First, corresponding statements to be annotated are written for the identified strategy points to be annotated. Then, the statements to be annotated are broken down into fragments and marked onto specific state description statements.

[0244] Specifically, for ease of understanding, please refer to Table 3, which is a schematic diagram of the correspondence between the strategy points to be labeled and the statements to be labeled.

[0245] Table 3

[0246]

[0247] In this table, " / " represents "and", and "→" represents "the next step will be". Taking the strategy point to be labeled shown in Table 3 as an example, this strategy point includes 5 state expression statements. The utterance to be labeled includes 5 natural language description statements. Based on <strategy point to be labeled, utterance to be labeled>, the statement mapping relationship (i.e., the relationship between state expression statements and natural language description statements) can be obtained through annotation mapping.

[0248] It should be noted that a state description statement can represent a single state or multiple states (i.e., two or more states). This is because some multiple states can be condensed into a single state description statement, becoming a "condensed state description statement." For example, "going to search for supplies / in combat / parachuted and landed" is a condensed state description statement, and its corresponding natural language description could be "waiting to find an attack target before seeking out the enemy." It is evident that condensed state description statements can derive higher-level information. The state description statement in this application can refer to a single-state state description statement or a condensed state description statement for multiple states.

[0249] The statements to be labeled shown in Table 3 are broken down into segments, each segment containing at least one natural language descriptive statement. The labels are then mapped to specific state statements or condensed state statements. For clarity, please refer to Table 4, which illustrates the statement mapping relationship.

[0250] Table 4

[0251]

[0252] As can be seen, the condensed state statement "A vehicle appears within the field of view / An enemy is nearby" in Table 4 is a condensation of multiple states, namely, it includes the state statements "A vehicle appears within the field of view" and "An enemy is nearby". Because the condensed state statement contains inferred reasoning, it can bring more information to the speech generation.

[0253] Secondly, this application provides a method for constructing statement mapping relationships. This method allows for manual annotation of the state statements corresponding to policy points, thereby enriching the initial state statements and their corresponding natural language descriptions. This facilitates subsequent model training.

[0254] Optionally, in the above Figure 3 Based on the corresponding embodiments, another optional embodiment provided in this application may further include:

[0255] Get the status statement;

[0256] Based on the state representation statement, natural language description statements are obtained through the first text generation model;

[0257] The state statement is matched with the natural language description statement to obtain the statement mapping relationship.

[0258] In one or more embodiments, a method for constructing statement mapping relationships based on a model is introduced. As can be seen from the foregoing embodiments, subsequent statement mapping relationships can be established through model prediction. First, the corresponding state description statements are obtained for the mined policy points to be labeled. Then, the state description statements are used as input to a first text generation model, and the first text generation model outputs the corresponding natural language description statements.

[0259] Specifically, taking the state statement "An airdrop is within the field of view" as an example, exemplarily, "An airdrop is within the field of view" is used as input to the first text generation model, which outputs a natural language description statement, such as "An airdrop has been found nearby." This establishes a mapping relationship between the state statement "An airdrop is within the field of view" and the natural language description statement "An airdrop has been found nearby." Again, exemplarily, "An airdrop is within the field of view" is used as input to the first text generation model, which outputs a natural language description statement, such as "An airdrop has appeared nearby." This again establishes a mapping relationship between the state statement "An airdrop is within the field of view" and the natural language description statement "An airdrop has appeared nearby."

[0260] As can be seen, given the same input state description, different natural language descriptions may be output. This allows for the construction of richer statement mapping relationships.

[0261] It should be noted that the first text generation model can be a transformer model or other types of models, which are not limited here.

[0262] Secondly, this application provides a method for constructing statement mapping relationships based on a model. Using this method, a model can be used to transform the state statements corresponding to each strategy point, automatically generating the corresponding natural language description statements. Simultaneously, the same state statement can be input multiple times into the first text generation model, which may output different natural language description statements, thereby enriching the expression of the natural language description statements and improving the effectiveness of speech generation.

[0263] Optionally, in the above Figure 3 Based on the corresponding embodiments, another optional embodiment provided in this application may further include:

[0264] Obtain samples of state description statements and natural language description statements;

[0265] Based on the state expression statement samples, the target expression statement is obtained through the first text generation model;

[0266] The model parameters of the first text generation model are updated based on the target statement and natural language description statements.

[0267] In one or more embodiments, a method for training a first text generation model is described. As can be seen from the foregoing embodiments, the purpose of the first text generation model is to output state statement statements as natural language description statements. The training data for the first text generation model includes <state statement samples, natural language description statement samples>.

[0268] Specifically, suppose the state statement sample is "an airdrop is within sight" and the natural language description sample is "an airdrop has been found nearby". Based on this, the state statement sample is used as input to the first text generation model, which then outputs the target statement. Therefore, based on the target statement and the natural language description sample, a loss function is used to calculate the corresponding loss value, and this loss value is used to update the model parameters of the first text generation model.

[0269] It should be noted that during the training process, stochastic gradient descent (SGD) can be used to perform gradient backward calculation on the loss value of the previous step and obtain the updated values ​​of all model parameters, and then update the text ranking model.

[0270] Understandably, in one scenario, an exhaustion criterion can be used to determine whether the model training conditions are met. For example, an iteration threshold can be set, and when the number of iterations reaches the threshold, it indicates that the model training conditions have been met. In another scenario, an observational criterion can be used to determine whether the model training conditions are met. For example, when the loss value has converged, it indicates that the model training conditions have been met.

[0271] Furthermore, this application provides a method for training a first text generation model. Through this method, the first text generation model is trained using training data, enabling it to predict natural language descriptions. This saves the cost of manually writing natural language descriptions.

[0272] Optionally, in the above Figure 3 Based on the corresponding embodiments, in another optional embodiment provided by this application, obtaining the state description statement may specifically include:

[0273] Retrieve the existing state description statement;

[0274] The existing state description statements are filled into the preset slots of the discrete text template to obtain the target input information, wherein the discrete text template includes text units;

[0275] Based on the target input information, the state description statement is obtained through the second text generation model.

[0276] Alternatively, obtain a status statement, which may specifically include:

[0277] Retrieve the existing state description statement;

[0278] The existing state description statements are embedded to obtain text embedding vectors.

[0279] The text embedding vector is filled into the preset slots of the connected text template to obtain the target input information, wherein the connected text template includes learnable parameters;

[0280] Based on the target input information, the state description statement is obtained through the second text generation model.

[0281] Alternatively, obtain a status statement, which may specifically include:

[0282] Retrieve the existing state description statement;

[0283] The existing state description statements are embedded to obtain text embedding vectors.

[0284] The text embedding vector is filled into the preset slots of the connected text template to obtain the target input information. The connected text template includes text units and learnable parameters.

[0285] Based on the target input information, the state description statement is obtained through the second text generation model.

[0286] In one or more embodiments, a method for expanding state representation statements is introduced. As can be seen from the foregoing embodiments, the state representation statements mined from policy points are typically limited, i.e., the sample size is small. Therefore, to increase the sample size, state representation statements can be paraphrased and generated based on prompts. This addresses the issue of improving the paraphrasing and generation of state representation statements by leveraging the advantages of a large model when training data is limited.

[0287] Specifically, this application may use discrete prompts, continuous prompts, or a combination of both to restate the state statement. These will be explained in detail below.

[0288] For easier understanding, please refer to Figure 4 , Figure 4 This is a schematic diagram of the output state description statement based on the second text generation model in an embodiment of this application, such as... Figure 4As shown in Figure (A), a discrete text template can be pre-set, for example, "_, ​​in other words:", where "_" represents a preset slot and "in other words" represents a text unit. Assuming the existing state statement is "Will enter crawling state / Supplies plentiful", based on this, the existing state statement is filled into the preset slot of the discrete text template, resulting in the target input information "Will enter crawling state / Supplies plentiful, in other words:". Then, after prefix-tuning, it is input into the second text generation model. The second text generation model outputs the newly added state statement, for example, "Let's ambush with our abundant supplies #". Here, "#" represents the terminator.

[0289] like Figure 4 As shown in Figure (B), a pre-set connected text template can be used. The template words in this template are not natural language but learnable parameters. Based on this, existing state statements are embedded to obtain text embedding vectors. These vectors are then filled into preset slots in the connected text template to obtain the target input information. This input is then fed into a second text generation model after prefix-tuning. The second text generation model outputs the newly added state statements.

[0290] like Figure 4 As shown in Figure (C), the shortcomings of manually designed discrete text templates are compensated for by introducing continuous prompts. A continuous prompt text template can be pre-set, in which template words include natural language (i.e., text units) and learnable parameters. Based on this, existing state statements are embedded to obtain text embedding vectors, which are then filled into preset slots in the continuous prompt text template to obtain the target input information. This is then fed into a second text generation model after prefix-tuning. The second text generation model outputs the newly added state statement.

[0291] It should be noted that the text generation model can use the Chinese fixed-length transformer (Chinses-transformer-XL) model or other types of models, which are not limited here.

[0292] Furthermore, this application provides a method for expanding state representation statements. By using manually established statement mapping relationships as training data, and generating state representation statements from a small sample based on the prompt, the amount of training data is increased, thereby improving model performance.

[0293] Optionally, in the above Figure 3Based on the corresponding embodiments, another optional embodiment provided in this application may further include:

[0294] Obtain a set of natural language description statements to be trained, wherein the set of natural language description statements to be trained includes at least one natural language description statement;

[0295] Obtain the speech samples corresponding to the set of natural language description statements to be trained;

[0296] Based on a set of natural language description statements to be trained, predicted dialogue is obtained through a text compression model.

[0297] The model parameters of the text compression model are updated based on the predicted dialogue and dialogue samples.

[0298] In one or more embodiments, a method for training a text compression model is described. As can be seen from the foregoing embodiments, the text compression model outputs a set of natural language description statements as complete sentences (i.e., obtaining candidate statements). The text compression model has two main objectives: first, to integrate the expressions of the natural language description statements, with a greater focus on the order of the expressions; second, to rewrite the text to improve fluency, including rewriting conjunctions and modal particles.

[0299] Specifically, taking the BART model as a text compression model as an example, for easier understanding, please refer to [link to relevant documentation]. Figure 5 , Figure 5 This is a schematic diagram illustrating the output of corresponding dialogue based on a text compression model in an embodiment of this application. As shown in the figure, the text compression model includes a bidirectional encoder and an autoregressive decoder. The bidirectional encoder performs bidirectional feature representation encoding, computation, and feature extraction on the input text. The autoregressive decoder utilizes cross-attention and the hidden state results of the last layer of the encoder to perform attention aggregation computation, thereby generating text in an autoregressive manner with unidirectional feature representation.

[0300] For example, the set of natural language description statements can be represented as <An airdrop has been detected; enemies and vehicles have appeared; are we ready to fight? Are supplies plentiful?>. This set of natural language description statements includes five natural language description statements.

[0301] Based on this, during the model inference process, the set of natural language description statements is used as the input to the bidirectional encoder in the text compression model, and the hidden state results are output through the bidirectional encoder. The hidden state results are then used as the input to the autoregressive decoder, which outputs candidate statements.

[0302] It should be noted that the training data includes <segments of the dialogue (i.e., the set of natural language description statements to be trained) and dialogue samples>. For example, the set of natural language description statements to be trained can be represented as <An airdrop has been discovered, enemies and vehicles have appeared. Are we ready to fight? Are we prepared for battle? Are our supplies plentiful?>. The set of natural language description statements to be trained includes 5 natural language description statements. A dialogue sample can be represented as <An airdrop has been discovered nearby, and enemies and vehicles have appeared. We have plentiful supplies. Are we ready to fight? Special forces, are you prepared for battle?>.

[0303] Based on this, during model training, the set of natural language description sentences to be trained is used as the input to the bidirectional encoder in the text compression model, and the hidden state results are output through the bidirectional encoder. The hidden state results are then used as the input to the autoregressive decoder, which outputs the predicted utterances. Therefore, based on the predicted utterances (i.e., the predicted results) and the utterance samples (i.e., the true results), the corresponding loss value is calculated using a loss function, and the model parameters of the text compression model are updated using the loss value.

[0304] It should be noted that during training, SGD can be used to perform gradient backward calculation on the loss value from the previous step to obtain updated values ​​for all model parameters, and then update the text compression model. Understandably, either exhaustion criteria or observational criteria can be used as the basis for determining whether the model training conditions are met; no specific restrictions are imposed here.

[0305] Secondly, this application provides a method for training a text compression model. By using training data to train the text compression model, the model can integrate natural language descriptions and improve the fluency of the output speech, thereby saving the cost of manually writing the speech.

[0306] Optionally, in the above Figure 3 Based on the corresponding embodiments, in another optional embodiment provided by this application, obtaining the set of natural language description statements to be trained may specifically include:

[0307] Obtain the original set of natural language description statements;

[0308] If the original set of natural language description statements includes at least two natural language description statements, then the order of appearance of each natural language description statement in the original set of natural language description statements is adjusted to obtain the set of natural language description statements to be trained.

[0309] In one or more embodiments, a method for augmenting training data is described. As can be seen from the foregoing embodiments, the set of natural language description statements to be trained originates from the original set of natural language description statements, wherein the original set of natural language description statements includes at least one natural language description statement.

[0310] Specifically, suppose the original set of natural language description statements is "Airdrop found nearby / Let's retreat first / We can sneak over and grab the airdrop to upgrade our equipment." This original set of natural language description statements includes three natural language description statements: "Airdrop found nearby," "Let's retreat first," and "We can sneak over and grab the airdrop to upgrade our equipment."

[0311] Based on this, the natural language description statements in the original set of natural language description statements are shuffled to obtain the following sets of natural language description statements:

[0312] 1. "An airdrop has been spotted nearby / Retreat first / You can sneak over and grab the airdrop to upgrade your equipment."

[0313] 2. "An airdrop has been spotted nearby / You can sneak over and grab it to upgrade your equipment / Let's retreat first";

[0314] 3. "Retreat first / If you find an airdrop nearby / You can quietly climb over and grab the airdrop to upgrade your equipment."

[0315] 4. "Retreat first / You can sneak over and grab an airdrop to upgrade your equipment / An airdrop has been spotted nearby";

[0316] 5. "You can sneak over and grab an airdrop to upgrade your equipment / Retreat first / An airdrop has been spotted nearby";

[0317] 6. "You can sneak over and grab an airdrop to upgrade your equipment / You've spotted an airdrop nearby / Retreat first";

[0318] Based on this, any one of the above 6 sets of natural language description statements can be selected as the set of natural language description statements to be trained.

[0319] Furthermore, this application provides a method for augmenting training data. Considering the potentially small amount of training data, this method shuffles the training data, improving its sorting ability. This effectively reduces the model's dependence on the data and its quality, thus improving model performance.

[0320] Optionally, in the above Figure 3 Based on the corresponding embodiments, in another optional embodiment provided by this application, obtaining the set of natural language description statements to be trained may specifically include:

[0321] Obtain the original set of natural language description statements, wherein the original set of natural language description statements includes at least one natural language description statement;

[0322] If the natural language description statements in the original set of natural language description statements contain conjunctions, then remove the conjunctions from the natural language description statements to obtain the set of natural language description statements to be trained.

[0323] In one or more embodiments, another method for augmenting training data is described. As can be seen from the foregoing embodiments, the set of natural language description statements to be trained originates from the original set of natural language description statements, wherein the original set of natural language description statements includes at least one natural language description statement.

[0324] Specifically, suppose the original set of natural language description statements is "An airdrop has been found nearby / And there are gunshots and enemies nearby". This original set of natural language description statements includes two natural language description statements: "An airdrop has been found nearby" and "And there are gunshots and enemies nearby". Therefore, we determine whether each natural language description statement in the original set of natural language description statements contains a conjunction. It is evident that the natural language description statement "And there are gunshots and enemies nearby" contains the conjunction "and". Based on this, we remove the conjunction from this natural language description statement. Thus, the set of natural language description statements to be trained is "An airdrop has been found nearby / There are gunshots and enemies nearby".

[0325] It should be noted that conjunctions are used to indicate the connection between the preceding and following meanings, and to indicate the connection between two sentences or paragraphs. The conjunctions involved in this application include, but are not limited to, “although,” “but,” “not only,” “but also,” “because,” “therefore,” “either,” “no matter,” and “however.”

[0326] Furthermore, this application provides another method for augmenting training data. By removing conjunctions from the training data as described above, the enhancement capability is improved. This effectively reduces the model's dependence on the data and its quality, thus improving model performance.

[0327] Optionally, in the above Figure 3 Based on the corresponding embodiments, in another optional embodiment provided by this application, obtaining the set of natural language description statements to be trained may specifically include:

[0328] Obtain the original set of natural language description statements, wherein the original set of natural language description statements includes at least one natural language description statement;

[0329] If the natural language description statements in the original set of natural language description statements include preset expression statements, then the preset expression statements in the natural language description statements are changed to standard expression statements to obtain the set of natural language description statements to be trained. The semantics of the preset expression statements are used to replace the standard expression statements.

[0330] In one or more embodiments, another method for augmenting training data is described. As can be seen from the foregoing embodiments, the set of natural language description statements to be trained originates from the original set of natural language description statements, wherein the original set of natural language description statements includes at least one natural language description statement.

[0331] Specifically, suppose the original set of natural language description statements is "Airdrop found nearby / Let's retreat first / We can sneak over and grab the airdrop to upgrade our equipment." This original set of natural language description statements includes three natural language description statements: "Airdrop found nearby," "Let's retreat first," and "We can sneak over and grab the airdrop to upgrade our equipment."

[0332] For example, suppose the preset statements include, but are not limited to, "retreat first," "retreat one wave first," "retreat quickly," and "we're retreating quickly." The standard statement corresponding to the preset statements is "retreat first." Therefore, it is determined whether each natural language description statement in the original set of natural language description statements includes the preset statement. It is evident that the natural language description statement "retreat one wave first" includes the preset statement. Based on this, the preset statement in the natural language description statement is changed to the standard statement. Thus, the set of natural language description statements to be trained is "Found an airdrop nearby / Retreat first / We can quietly climb over and grab an airdrop to upgrade our equipment."

[0333] It should be noted that in practical applications, multiple sets of mapping relationships between preset expressions and standard expressions can be set. For each mapping relationship, multiple similar preset expressions can be uniformly replaced with standard expressions.

[0334] Furthermore, this application provides another method for augmenting training data. By standardizing the representation of training data using the above method, the model's dependence on the data and its quality can be effectively reduced, thereby improving model performance.

[0335] Optionally, in the above Figure 3 Based on the corresponding embodiments, another optional embodiment provided in this application may further include:

[0336] Obtain a set of state description statements to be trained and a script to be trained, wherein the set of state description statements includes at least one state description statement.

[0337] Obtain the set of statements describing the state to be trained and the labeled scores of the statements to be trained;

[0338] Based on the set of state description statements to be trained and the training scripts, the predicted quality score is obtained through a text ranking model.

[0339] The model parameters of the text ranking model are updated based on the predicted quality score and the labeled score.

[0340] In one or more embodiments, a method for training a text ranking model is described. As described in the foregoing embodiments, the purpose of the text ranking model is to select high-quality statements from candidate statements. The input to the text ranking model is <target strategy points (i.e., a set of state expression statements), candidate statements>, and the output is <quality score>. Training the text ranking model requires training data, which includes <strategy points to be trained (i.e., a set of state expression statements to be trained), and statements to be trained>. Based on this, the training data is manually labeled, with the label category being "accepted" or "not accepted". The label score corresponding to "accepted" is "1", and the label score corresponding to "not accepted" is "0".

[0341] Specifically, suppose the set of state statements to be trained is "smoke grenade in backpack / possessing primary attack weapon / no combat / going to search for supplies," which includes four state statements. Suppose the training phrase is "smoke grenade in backpack, it's quiet around, our attack weapon is well-equipped, we can search for supplies in the nearby houses." Suppose the labeled score for this training data is "1." Based on this, the set of state statements to be trained and the training phrase are used as input to a text ranking model, which outputs a predicted quality score. For example, the predicted quality score can be 0.9997653365135193. Based on this, the corresponding loss value is calculated using a loss function according to the predicted quality score and the labeled score, and the model parameters of the text ranking model are updated using the loss value.

[0342] It should be noted that during training, SGD can be used to perform gradient backward calculation on the loss value from the previous step to obtain updated values ​​for all model parameters, and then update the text compression model. Understandably, either exhaustion criteria or observational criteria can be used as the basis for determining whether the model training conditions are met; no specific restrictions are imposed here.

[0343] Secondly, this application provides a method for training a text ranking model. By using training data and its labeled scores, the text ranking model is trained, enabling it to predict the quality of candidate statements. This improves the reliability of candidate statement evaluation and saves labor costs.

[0344] Optionally, in the above Figure 3 Based on the corresponding embodiments, another optional embodiment provided in this application may further include:

[0345] If the game state of the target object is detected to meet the target strategy point, obtain the set of dialogue corresponding to the target strategy point;

[0346] Retrieve the target script from the script collection;

[0347] Send the target script to the terminal so that the terminal plays the target script.

[0348] In one or more embodiments, a method for providing target dialogue based on game character state feedback is introduced. As described in the foregoing embodiments, the user controls the target object in the game; therefore, the target object has a real-time game state. If a series of game states of the target object hit a strategy point, the dialogue can be broadcast to the user's terminal according to the set of dialogues corresponding to the strategy point. The following will describe the method using the example of the target object's game state hitting a target strategy point.

[0349] The following example illustrates how the target's game state hits the target strategy point. For easier understanding, please refer to [link to relevant documentation]. Figure 6 , Figure 6 This is a schematic diagram of the scripted speech in an embodiment of this application, as shown in the figure. Specifically:

[0350] In step S1, the real-time game state of the target object is detected, and it is detected that the target object's current series of game states satisfy the target strategy point. For example, assume that the target strategy point includes three state statements: "No combat", "Airdrop within sight", and "Will crawl".

[0351] In step S2, the set of dialogues corresponding to the target strategy point is obtained. For example, suppose the set of dialogues includes two candidate dialogues: "There is an airdrop nearby, but there will definitely be a lot of special forces coming to grab it. Moving forward while prone will reduce the possibility of being discovered by the enemy, and you can also ambush the enemies coming to pick up the airdrop," and "An airdrop has been found nearby. Although there is no battle now, you can quietly crawl over and grab a batch of airdrops to upgrade your equipment."

[0352] In step S3, the target dialogue is then obtained from the dialogue set. Let's assume the target dialogue is candidate dialogue 2, which is "An airdrop has been spotted nearby. Although there's no battle right now, you can sneak over and grab the airdrop to upgrade your equipment."

[0353] In step S4, the target script is sent to the terminal so that the terminal plays the target script.

[0354] Secondly, this application provides a method for generating target dialogue based on game character status feedback. Considering the large number of strategy points, manually writing dialogue is not only time-consuming and labor-intensive but also highly dependent on the writer's professional background. Therefore, this application utilizes AI-assisted strategy point generation to improve the controllability of the dialogue, thereby providing users with a better gaming experience.

[0355] Based on the above introduction, the following will combine... Figure 7 This section describes the overall process of generating the script. Please refer to [link / reference]. Figure 7 , Figure 7 This is a schematic diagram of the overall process of the script generation method in this application embodiment. As shown in the figure, the entire process can be divided into two stages. The first stage utilizes the script generalization ability of a large model to enrich the description of state statements and establish statement mapping relationships to achieve information enrichment and information reuse. The second stage uses a text compression model and a text sorting model to compress and connect T sets of natural language description statements, and then sorts and filters out a high-quality script set.

[0356] Furthermore, the natural language descriptions generated by the first text generation model and the diverse expressions of state statements generated by the second text generation model allow for the updating of statement mapping relationships through manual annotation. Based on this, the statement mapping relationships can be used to feed back into both the first and second text generation models, thus achieving a complete closed loop for updating statement mapping relationships. This closed loop enables the continuous generation of new content.

[0357] This application conducts an effectiveness evaluation in relevant game businesses. The evaluation method involves generating a corresponding set of dialogues for the strategy points discovered using the dialogue generation method provided in this application. The dialogue sets are then manually annotated to determine whether the annotations are adopted. The evaluation results are shown in Table 5.

[0358] Table 5 illustrates the correspondence between strategy points to be labeled and the statements to be labeled.

[0359] Table 5

[0360] Adoption rate of sales script 20% 41.9% 74.72%

[0361] It is evident that the script generation method provided in this application has a high adoption rate.

[0362] The speech generation device in this application is described in detail below. Please refer to [link / reference]. Figure 8 , Figure 8 This is a schematic diagram of one embodiment of the script generation device in this application. The script generation device 30 includes:

[0363] The acquisition module 310 is used to acquire a set of state description statements, wherein the set of state description statements corresponds to the target policy point, and the set of state description statements includes N state description statements, where N is an integer greater than or equal to 1.

[0364] The generation module 320 is used to generate T sets of natural language description statements corresponding to the set of state expression statements based on the statement mapping relationship. Each set of natural language description statements includes one natural language description statement corresponding to each state expression statement. The statement mapping relationship is used to describe the correspondence between the state expression statements and the natural language description statements. T is an integer greater than or equal to 1.

[0365] The acquisition module 310 is also used to acquire T candidate statements based on a set of T natural language description statements through a text compression model, wherein the candidate statements have a one-to-one correspondence with the set of natural language description statements;

[0366] The acquisition module 310 is also used to obtain the quality score corresponding to each candidate dialogue based on the set of state expression statements and T candidate dialogues through a text ranking model;

[0367] The generation module 320 is also used to determine the top K candidate dialogues with the highest quality scores from the T candidate dialogues, and to use the K candidate dialogues as the dialogue set corresponding to the target strategy point, where K is an integer greater than or equal to 1 and less than T.

[0368] This application provides a speech generation device. Using this device, speech generation is decomposed into two stages. The first stage reorganizes and transforms a set of state description statements based on statement mapping relationships to obtain a set of natural language description statements, thereby enriching the information. The second stage connects and compresses the combined set of natural language description statements, selecting speech with higher quality scores. This allows for the generation of higher-quality speech, thus improving the controllability of speech generation.

[0369] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0370] The generation module 320 is specifically used to transform each state representation statement in the state representation statement set based on the statement mapping relationship, so as to obtain at least one natural language description statement corresponding to each state representation statement.

[0371] Each state statement is combined with at least one natural language description statement to obtain a set of T natural language description statements.

[0372] This application provides a speech generation device. Using this device, and leveraging pre-built statement mapping relationships, state statements can be directly converted into one or more related natural language description statements. This not only enhances the richness of state statements but also increases the diversity of textual expression when multiple natural language description statements are associated.

[0373] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0374] The generation module 320 is specifically used to split the set of state description statements into N state description statements;

[0375] Take at least one state statement from the N state statement statements as the first statement set to obtain M first statement sets, where M is an integer greater than or equal to 1;

[0376] Based on M sets of first statements, generate at least one set of second statements, wherein each set of second statements includes at least one set of first statements;

[0377] Based on the statement mapping relationship, each of the at least one second statement set is transformed to obtain at least one natural language description statement corresponding to each state expression statement in each second statement set;

[0378] Combine at least one natural language description statement corresponding to each state statement in each second statement set to obtain T sets of natural language description statements.

[0379] This application provides a speech generation device. Using this device, firstly, state expression statements are recombinated; then, utilizing a pre-built statement mapping relationship, the recombinated state expression statements can be directly converted into one or more related natural language description statements. This not only enhances the richness of state expression statements but also increases the diversity of textual expression when multiple natural language description statements are associated.

[0380] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0381] The generation module 320 is specifically used to take at least one of the M first statement sets as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1.

[0382] This application provides a speech generation device. Using this device, M sets of first statements are fully combined, and the results of all combinations are used as a second set of statements. This yields the most comprehensive combination results, thereby increasing the richness of information and contributing to the generation of high-quality speech.

[0383] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0384] The generation module 320 is specifically used to take at least one of the M first statement sets as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1;

[0385] Randomly select at least one set of second statements from P sets of second statements.

[0386] This application provides a speech generation device. Using this device, M sets of first statements are fully combined, and a portion of the combined results is randomly selected as a second set of statements. This improves the richness of information while reducing data processing volume, saving data processing resources and increasing speech generation efficiency.

[0387] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0388] The generation module 320 is specifically used to take at least one of the M first statement sets as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1;

[0389] Get the statement coverage rate of each of the P second statement sets, where the statement coverage rate represents the proportion of non-repeated state statement statements in the state statement set.

[0390] From P sets of second statements, select a set of second statements whose statement coverage is greater than or equal to the coverage threshold to obtain at least one set of second statements.

[0391] This application provides a speech generation device. Using this device, M first speech sets are fully combined, and the results with higher speech coverage are selected as the second speech set. This approach improves information richness while obtaining higher-quality candidate speech, and also reduces data processing volume, saving data processing resources and improving speech generation efficiency.

[0392] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application, the script generation device 30 further includes a matching module 330;

[0393] The acquisition module 310 is also used to acquire the strategy point to be labeled and the corresponding text to be labeled, wherein the strategy point to be labeled includes at least one state expression statement and the text to be labeled includes at least one natural language description statement.

[0394] The matching module 330 is used to match each natural language description statement in the utterance to be labeled with the state expression statement in the strategy point to be labeled, so as to obtain the statement mapping relationship.

[0395] This application provides a speech generation device. Using this device, manual annotation of the state statements corresponding to policy points can be performed, thereby enriching the initial state statements and their corresponding natural language descriptions. This facilitates subsequent model training.

[0396] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0397] The acquisition module 310 is also used to acquire status description statements;

[0398] The acquisition module 310 is also used to acquire natural language description statements based on state expression statements through the first text generation model;

[0399] The matching module 330 is also used to match the state statement with the natural language description statement to obtain the statement mapping relationship.

[0400] This application provides a speech generation device. Using this device, a model can be used to transform the state statements corresponding to strategy points, thereby automatically generating natural language description statements corresponding to the state statements. Simultaneously, the same state statement can be input multiple times into a first text generation model, which may output different natural language description statements, thus enriching the expression of the natural language description statements and improving the speech generation effect.

[0401] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application, the script generation device further includes a training module 340;

[0402] The acquisition module 310 is also used to acquire state description statement samples and natural language description statement samples;

[0403] The acquisition module 310 is also used to acquire the target expression statement based on the state expression statement sample through the first text generation model;

[0404] The training module 340 is used to update the model parameters of the first text generation model based on the target statement and natural language description statement samples.

[0405] This application provides a speech generation device. Using this device, a first text generation model is trained with training data, enabling the first text generation model to predict natural language description sentences. This saves the cost of manually writing natural language description sentences.

[0406] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0407] The acquisition module 310 is specifically used to acquire existing state description statements;

[0408] The existing state description statements are filled into the preset slots of the discrete text template to obtain the target input information, wherein the discrete text template includes text units;

[0409] Based on the target input information, the state description statement is obtained through the second text generation model.

[0410] or,

[0411] The acquisition module 310 is specifically used to acquire existing state description statements;

[0412] The existing state description statements are embedded to obtain text embedding vectors.

[0413] The text embedding vector is filled into the preset slots of the connected text template to obtain the target input information, wherein the connected text template includes learnable parameters;

[0414] Based on the target input information, the state description statement is obtained through the second text generation model.

[0415] or,

[0416] The acquisition module 310 is specifically used to acquire existing state description statements;

[0417] The existing state description statements are embedded to obtain text embedding vectors.

[0418] The text embedding vector is filled into the preset slots of the connected text template to obtain the target input information. The connected text template includes text units and learnable parameters.

[0419] Based on the target input information, the state description statement is obtained through the second text generation model.

[0420] This application provides a speech generation device. Using this device, manually established statement mapping relationships are used as training data to generate paraphrased statements based on a few samples of prompts, thereby increasing the amount of training data and improving model performance.

[0421] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0422] The acquisition module 310 is also used to acquire a set of natural language description statements to be trained, wherein the set of natural language description statements to be trained includes at least one natural language description statement;

[0423] The acquisition module 310 is also used to acquire the speech samples corresponding to the set of natural language description statements to be trained;

[0424] The acquisition module 310 is also used to acquire the predicted speech based on the set of natural language description statements to be trained through a text compression model;

[0425] The training module 340 is also used to update the model parameters of the text compression model based on the predicted speech and speech samples.

[0426] This application provides a speech generation device. Using this device, a text compression model is trained with training data, enabling the model to incorporate natural language descriptions and improve the fluency of the output speech. This saves the cost of manually writing speech.

[0427] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0428] The acquisition module 310 is specifically used to acquire the set of original natural language description statements;

[0429] If the original set of natural language description statements includes at least two natural language description statements, then the order of appearance of each natural language description statement in the original set of natural language description statements is adjusted to obtain the set of natural language description statements to be trained.

[0430] This application provides a speech generation device. Using this device, considering the potentially small amount of training data, scrambling the training data improves sorting ability. This effectively reduces the model's dependence on the data and its quality, thus improving model performance.

[0431] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0432] The acquisition module 310 is specifically used to acquire a set of original natural language description statements, wherein the set of original natural language description statements includes at least one natural language description statement;

[0433] If the natural language description statements in the original set of natural language description statements contain conjunctions, then remove the conjunctions from the natural language description statements to obtain the set of natural language description statements to be trained.

[0434] This application provides a speech generation device. Using this device, transition words are removed from the training data, thereby improving the polishing ability. This effectively reduces the model's dependence on the data and its quality, thus improving model performance.

[0435] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0436] The acquisition module 310 is specifically used to acquire a set of original natural language description statements, wherein the set of original natural language description statements includes at least one natural language description statement;

[0437] If the natural language description statements in the original set of natural language description statements include preset expression statements, then the preset expression statements in the natural language description statements are changed to standard expression statements to obtain the set of natural language description statements to be trained. The semantics of the preset expression statements are used to replace the standard expression statements.

[0438] This application provides a speech generation device. Using this device to standardize the representation of training data effectively reduces the model's dependence on the data and its quality, thereby improving model performance.

[0439] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application,

[0440] The acquisition module 310 is also used to acquire a set of state expression statements to be trained and a script to be trained, wherein the set of state expression statements includes at least one state expression statement.

[0441] The acquisition module 310 is also used to acquire the set of statements describing the state to be trained and the labeled scores of the statements to be trained.

[0442] The acquisition module 310 is also used to obtain the predicted quality score based on the set of state description statements to be trained and the speech to be trained through the text ranking model.

[0443] The training module 340 is also used to update the model parameters of the text ranking model based on the predicted quality score and the labeled score.

[0444] This application provides a speech generation device. Using this device, a text ranking model is trained with training data and its labeled scores, enabling the text ranking model to predict the quality of candidate speech. This improves the reliability of candidate speech evaluation and saves labor costs.

[0445] Optionally, in the above Figure 8 Based on the corresponding embodiments, in another embodiment of the script generation device 30 provided in this application, the script generation device 30 further includes a sending module 350;

[0446] The acquisition module 310 is also used to acquire the set of dialogues corresponding to the target strategy point when the game state of the target object is detected to meet the target strategy point.

[0447] The acquisition module 310 is also used to acquire the target script from the script set;

[0448] The sending module 350 is used to send the target script to the terminal so that the terminal can play the target script.

[0449] This application provides a dialogue generation device. Considering the large number of strategy points, manually writing dialogues using this device is not only time-consuming and labor-intensive, but also highly dependent on the writer's professional background. Therefore, this application utilizes AI-assisted strategy point generation to improve the controllability of the dialogues, thereby providing users with a better gaming experience.

[0450] Figure 9 This is a schematic diagram of a computer device structure provided in an embodiment of this application. The computer device involved in this application can be a terminal or a server. The computer device 400 can vary significantly due to different configurations or performance, and may include one or more central processing units (CPUs) 422 (e.g., one or more processors) and a memory 432, and one or more storage media 430 (e.g., one or more mass storage devices) for storing application programs 442 or data 444. The memory 432 and storage media 430 can be temporary or persistent storage. The program stored in the storage media 430 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the computer device. Furthermore, the CPU 422 may be configured to communicate with the storage media 430 and execute the series of instruction operations in the storage media 430 on the computer device 400.

[0451] Computer device 400 may also include one or more power supplies 426, one or more wired or wireless network interfaces 450, one or more input / output interfaces 458, and / or one or more operating systems 441, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.

[0452] The steps performed by the computer device in the above embodiments can be based on this Figure 9 The computer device structure shown.

[0453] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the methods described in the foregoing embodiments.

[0454] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the methods described in the foregoing embodiments.

[0455] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0456] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0457] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0458] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0459] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0460] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a server or terminal device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0461] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for generating scripts, characterized in that, include: Obtain a set of state description statements, wherein the set of state description statements corresponds to the target policy point, and the set of state description statements includes N state description statements, where N is an integer greater than or equal to 1; Based on the statement mapping relationship, T sets of natural language description statements corresponding to the set of state expression statements are generated. Each set of natural language description statements includes a natural language description statement corresponding to each state expression statement. The statement mapping relationship is used to describe the correspondence between state expression statements and natural language description statements. T is an integer greater than or equal to 1. Based on the T sets of natural language description statements, T candidate statements are obtained through a text compression model, wherein the candidate statements have a one-to-one correspondence with the natural language description statement sets; Based on the set of state description statements and the T candidate statements, the quality score corresponding to each candidate statement is obtained through a text ranking model. From the T candidate dialogues, determine the top K candidate dialogues with the highest quality scores, and use the K candidate dialogues as the dialogue set corresponding to the target strategy point, where K is an integer greater than or equal to 1 and less than T.

2. The method according to claim 1, characterized in that, The step of generating a set of T natural language description statements corresponding to the set of state representation statements based on statement mapping relationships includes: Based on the statement mapping relationship, each state statement in the state statement set is transformed to obtain at least one natural language description statement corresponding to each state statement. The at least one natural language description statement corresponding to each state statement is combined to obtain the T sets of natural language description statements.

3. The method according to claim 1, characterized in that, The step of generating a set of T natural language description statements corresponding to the set of state representation statements based on statement mapping relationships includes: The set of state description statements is split into the N state description statements; Take at least one of the N state statement statements as the first statement set to obtain M first statement sets, where M is an integer greater than or equal to 1; Based on the M first statement sets, at least one second statement set is generated, wherein each second statement set includes at least one first statement set; Based on the statement mapping relationship, each of the at least one second statement set is transformed to obtain at least one natural language description statement corresponding to each state expression statement in each second statement set; The at least one natural language description statement corresponding to each state expression statement in each of the second statement sets is combined to obtain the T sets of natural language description statements.

4. The method according to claim 3, characterized in that, The step of generating at least one second statement set based on the M first statement sets includes: At least one of the M first statement sets is taken as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1.

5. The method according to claim 3, characterized in that, The step of generating at least one second statement set based on the M first statement sets includes: At least one of the M first statement sets is taken as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1; At least one set of second statements is randomly selected from the P sets of second statements.

6. The method according to claim 3, characterized in that, The step of generating at least one second statement set based on the M first statement sets includes: At least one of the M first statement sets is taken as the second statement set to obtain P second statement sets, where P is an integer greater than or equal to 1; Obtain the statement coverage rate corresponding to each of the P second statement sets, wherein the statement coverage rate represents the proportion of non-repeated state expression statements in the state expression statement set; From the P sets of second statements, select a set of second statements whose statement coverage is greater than or equal to the coverage threshold to obtain at least one set of second statements.

7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Obtain the strategy point to be labeled and the corresponding utterance to be labeled, wherein the strategy point to be labeled includes at least one state expression statement and the utterance to be labeled includes at least one natural language description statement. Each natural language description statement in the utterance to be labeled is matched with the state expression statement in the strategy point to be labeled to obtain the statement mapping relationship.

8. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Get the status statement; Based on the state statement, a natural language description statement is obtained through the first text generation model; The state statement is matched with the natural language description statement to obtain the statement mapping relationship.

9. The method according to claim 8, characterized in that, The method further includes: Obtain samples of state description statements and natural language description statements; Based on the state expression statement sample, the target expression statement is obtained through the first text generation model; The model parameters of the first text generation model are updated based on the target statement and the natural language description statement sample.

10. The method according to claim 8, characterized in that, The obtained status statement includes: Retrieve the existing state description statement; The existing state description statement is filled into the preset slot of the discrete text template to obtain the target input information, wherein the discrete text template includes text units; Based on the target input information, the state expression statement is obtained through a second text generation model; Alternatively, the obtained state representation statement includes: Retrieve the existing state description statement; The existing state representation statement is embedded to obtain a text embedding vector; The text embedding vector is filled into the preset slots of the connected text template to obtain the target input information, wherein the connected text template includes learnable parameters; Based on the target input information, the state expression statement is obtained through a second text generation model; Alternatively, the obtained state representation statement includes: Retrieve the existing state description statement; The existing state representation statement is embedded to obtain a text embedding vector; The text embedding vector is filled into the preset slots of the connected text template to obtain the target input information, wherein the connected text template includes text units and learnable parameters; Based on the target input information, the state expression statement is obtained through a second text generation model.

11. The method according to claim 1, characterized in that, The method further includes: Obtain a set of natural language description statements to be trained, wherein the set of natural language description statements to be trained includes at least one natural language description statement; Obtain the speech samples corresponding to the set of natural language description statements to be trained; Based on the set of natural language description statements to be trained, the predicted speech is obtained through a text compression model. The model parameters of the text compression model are updated based on the predicted dialogue and the dialogue sample.

12. The method according to claim 11, characterized in that, The process of obtaining the set of natural language description statements to be trained includes: Obtain the original set of natural language description statements; If the original set of natural language description statements includes at least two natural language description statements, then the order of appearance of each natural language description statement in the original set of natural language description statements is adjusted to obtain the set of natural language description statements to be trained.

13. The method according to claim 11, characterized in that, The process of obtaining the set of natural language description statements to be trained includes: Obtain a set of original natural language description statements, wherein the set of original natural language description statements includes at least one natural language description statement; If the natural language description statements in the original set of natural language description statements include conjunctions, then remove the conjunctions from the natural language description statements to obtain the set of natural language description statements to be trained.

14. The method according to claim 11, characterized in that, The process of obtaining the set of natural language description statements to be trained includes: Obtain a set of original natural language description statements, wherein the set of original natural language description statements includes at least one natural language description statement; If the natural language description statements in the original set of natural language description statements include preset expression statements, then the preset expression statements in the natural language description statements are changed to standard expression statements to obtain the set of natural language description statements to be trained, wherein the semantics of the preset expression statements are used to replace the standard expression statements.

15. The method according to claim 1, characterized in that, The method further includes: Obtain a set of state expression statements to be trained and a script to be trained, wherein the set of state expression statements includes at least one state expression statement. Obtain the set of statements describing the state to be trained and the labeled scores of the statements to be trained; Based on the set of state description statements to be trained and the script to be trained, the predicted quality score is obtained through the text ranking model. The model parameters of the text ranking model are updated based on the predicted quality score and the labeled score.

16. The method according to claim 1, characterized in that, The method further includes: If the game state of the target object is detected to satisfy the target strategy point, the set of dialogues corresponding to the target strategy point is obtained; Obtain the target script from the script set; The target script is sent to the terminal so that the terminal plays the target script.

17. A script generation device, characterized in that, include: The acquisition module is used to acquire a set of state description statements, wherein the set of state description statements corresponds to the target policy point, and the set of state description statements includes N state description statements, where N is an integer greater than or equal to 1. The generation module is used to generate T sets of natural language description statements corresponding to the set of state expression statements based on the statement mapping relationship. Each set of natural language description statements includes one natural language description statement corresponding to each state expression statement. The statement mapping relationship is used to describe the correspondence between state expression statements and natural language description statements. T is an integer greater than or equal to 1. The acquisition module is further configured to acquire T candidate statements based on the T sets of natural language description statements using a text compression model, wherein the candidate statements have a one-to-one correspondence with the natural language description statement sets; The acquisition module is further configured to obtain the quality score corresponding to each candidate dialogue based on the set of state expression statements and the T candidate dialogues through a text ranking model. The generation module is further configured to determine the top K candidate dialogues with the highest quality scores from the T candidate dialogues, and to use the K candidate dialogues as the dialogue set corresponding to the target strategy point, wherein K is an integer greater than or equal to 1 and less than T.

18. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 16.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 16.

20. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 16.

Citation Information

Patent Citations

  • Dialogue generation method and device, and dialogue prediction model training method and device

    CN114969280A

  • Intelligent customer service method and device for generating respondable term sentences

    CN115391502A