Game dialogue generation method and apparatus, electronic device, and storage medium
Patent Information
- Application Number
- PCT/CN2025/076547
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-06
- Filing Date
- 2025-02-08
- Publication Date
- 2025-10-02
AI Technical Summary
Traditional game dialogue systems are difficult to meet personalized needs and have high maintenance costs. In addition, the dialogue generation method based on large language models has high computational costs and the generated content lacks authenticity and fun.
A large language model is used to generate multi-option same-path dialogues. By obtaining the target dialogue text, required prompt words and format prompt words, the dialogue framework is generated offline and modified to form a game dialogue with options.
It improves the efficiency and quality of dialogue generation, reduces computing costs and resource consumption, and ensures the logic and fluency of dialogue content.
Smart Images

Figure CN2025076547_02102025_PF_FP_ABST
Abstract
Description
Game dialogue generation method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application number 202410257801.X, filed on March 6, 2024, entitled “Method, device, electronic device and storage medium for generating game dialogues”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The present disclosure relates to the technical field of natural language processing design, and in particular to a method, device, electronic device and storage medium for generating game dialogues. Background Art
[0004] Dialogue systems are a crucial application in game development. Traditional game dialogue systems typically rely on pre-designed dialogue libraries or dialogue trees based on finite state machines. This approach is limited in that it struggles to meet the personalized needs of gamers and is also expensive to maintain. Summary of the Invention
[0005] According to one aspect of the present disclosure, a method for generating game dialogue is provided, the method comprising: obtaining a target dialogue text; inputting the target dialogue text, requirement prompt words, and format prompt words into a pre-trained large language model to obtain a multi-option same-path dialogue; wherein the requirement prompt words are used to indicate the generated dialogue requirements, and the dialogue requirements include generating a game dialogue with options; the format prompt words are used to indicate the dialogue format output by the model, and the dialogue format includes a dialogue framework format for generating a normalized summary of options; the multi-option same-path dialogue includes multiple dialogue segments, each dialogue segment contains a game dialogue with options, and the dialogue framework format composed of the multiple dialogue segments is the same as the dialogue format indicated by the format prompt words; the multi-option same-path dialogue is corrected to obtain a processed multi-option same-path dialogue; wherein the processed multi-option same-path dialogue is used to provide a game dialogue with options according to player operations during game operation.
[0006] According to one aspect of the present disclosure, a device for generating game dialogues is provided, the device comprising: a text acquisition module configured to execute acquisition of target dialogue text; a dialogue generation module configured to execute input of the target dialogue text, requirement prompt words, and format prompt words into a pre-trained large language model to obtain a multi-option same-path dialogue; wherein the requirement prompt words are used to indicate the generated dialogue requirements, and the dialogue requirements include generating game dialogues for options to be selected; the format prompt words are used to indicate the dialogue format output by the model, and the dialogue format includes a dialogue framework format for generating a normalized summary of options; the multi-option same-path dialogue includes multiple dialogue segments, each of which contains a game dialogue with options, and the dialogue framework format composed of the multiple dialogue segments is the same as the dialogue format indicated by the format prompt words; and a dialogue processing module configured to execute correction processing on the multi-option same-path dialogue to obtain a processed multi-option same-path dialogue; wherein the processed multi-option same-path dialogue is used to provide a game dialogue with options according to player operations during game operation.
[0007] According to one aspect of the present disclosure, an electronic device is provided, which includes a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned method for generating game dialogue.
[0008] According to one aspect of the present disclosure, a computer-readable storage medium is provided, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned method for generating game dialogues.
[0009] The embodiments of the present disclosure bring the following beneficial effects:
[0010] The present disclosure provides a method, device, electronic device, and storage medium for generating game dialogues. The method first obtains target dialogue text and inputs the target dialogue text, requirement prompts, and format prompts into a pre-trained large language model to generate a multi-option, same-path dialogue. The requirement prompts indicate the generated dialogue requirements, which include generating game dialogue with options. The format prompts indicate the dialogue format output by the model, which includes a dialogue framework format that normalizes and summarizes the generated options. The multi-option, same-path dialogue includes multiple dialogue segments, each containing game dialogue with options. The dialogue framework format composed of the multiple dialogue segments is the same as the dialogue format indicated by the format prompts. The multi-option, same-path dialogue is then modified to generate a processed multi-option, same-path dialogue. The processed multi-option, same-path dialogue is used to provide game dialogue with options based on player actions during game play. This method utilizes techniques such as step-by-step task decomposition, gradual offline invocation of the large language model, and streamlined automatic post-processing to generate the multi-option, same-path dialogue offline, improving the efficiency and quality of dialogue generation while reducing costs and resource consumption.
[0011] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by practicing the above-mentioned technology of the present disclosure.
[0012] In order to make the above-mentioned objects, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically listed below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] FIG1 is a flowchart of a method for generating a game dialogue according to an embodiment of the present disclosure;
[0014] FIG2 is a structural diagram of a multi-option same-path dialogue provided by an embodiment of the present disclosure;
[0015] FIG3 is a diagram of a dialog framework in one of the related technologies provided by an embodiment of the present disclosure;
[0016] FIG4 is a schematic diagram of a process for generating a game dialogue according to an embodiment of the present disclosure;
[0017] FIG5 is a schematic diagram of the structure of a device for generating a game dialogue according to an embodiment of the present disclosure;
[0018] FIG6 is a schematic structural diagram of one of the electronic devices provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are only some of the embodiments of the present disclosure, but not all of them. Generally, the components of the embodiments of the present disclosure described and shown in the drawings herein can be arranged and designed in various different configurations.
[0020] Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the present disclosure as claimed, but merely represents selected embodiments of the present disclosure. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present disclosure without creative effort shall fall within the scope of protection of the present disclosure.
[0021] With the rapid development of artificial intelligence (AI), large language models, as a key technology, are becoming a research hotspot in the field. Using natural language processing techniques, large language models can simulate the human language comprehension process, enabling tasks such as natural language generation, comprehension, and translation.
[0022] Dialogue systems are a key application in game development. Traditional game dialogue systems typically rely on pre-designed dialogue libraries or dialogue trees based on finite state machines. This approach is limited in that it struggles to meet the personalized needs of gamers and is also expensive to maintain. However, game dialogue systems based on large language models can generate natural language, enabling genuine interaction with players and enhancing the gaming experience.
[0023] Several dialogue generation methods based on large language models have been proposed, such as GPT-3 and LLama. These methods learn the grammatical rules, vocabulary, and semantic relationships of natural language by training on large amounts of text data. In game dialogue generation, game scenarios and task information can be input into a trained large language model to generate dialogue content that matches the current scenario and task, and provide multiple options for players to choose from. However, current methods for generating game dialogue based on large language models have several issues. First, due to the large number of parameters in large language models, the computational cost of model training and inference is very high, making them difficult to apply in actual game development. Second, real-time inference models cannot guarantee that the generated dialogue content is sufficiently realistic and interesting. Finally, even offline dialogue generation requires an exponential number of calls, resulting in dialogue options and a tree-like structure of dialogue groups.
[0024] Based on the above problems, the embodiments of the present disclosure provide a method, device, electronic device and storage medium for generating game dialogues. This technology can be applied to game interaction scenarios, especially game interaction scenarios with option dialogues.
[0025] To facilitate understanding of the embodiments of the present disclosure, a method for generating a game dialogue provided by the embodiments of the present disclosure is first introduced in detail. As shown in FIG1 , the method includes the following steps:
[0026] Step S102: Obtain target conversation text.
[0027] In a specific implementation, the target dialogue text may be a script with dialogue content, or a dialogue copy, etc. The target dialogue text may be input by the user in real time, or may be obtained by the system from a file.
[0028] In step S104, the target dialogue text, requirement prompt words, and format prompt words are input into a pre-trained large language model to obtain a multi-option same-path dialogue; wherein the requirement prompt words are used to indicate the generated dialogue requirements, which include generating a game dialogue with options; the format prompt words are used to indicate the dialogue format output by the model, which includes generating a dialogue framework format that normalizes and summarizes the options; the multi-option same-path dialogue includes multiple dialogue segments, each of which includes a game dialogue with options, and the dialogue framework format composed of the multiple dialogue segments is the same as the dialogue format indicated by the format prompt words.
[0029] In a specific implementation, the above-mentioned large language model refers to a natural language processing model obtained by training using a large amount of data, which can understand natural language and generate human-readable text. The large speech model used in the embodiment of the present disclosure is pre-trained. The large language model can automatically generate text with a certain logical structure and semantics by learning and analyzing a large amount of data. Specifically, when using a large language model, how to design the input prompt words is very important, because the output of the large language model (i.e., the generated text) will be generated based on the input prompt words. Good prompt words can guide the large language model to generate useful and accurate text, while poor prompt words may cause the output of the large language model to deviate from expectations, or produce ambiguous and semantically unclear results.
[0030] The above-mentioned requirement prompts and format prompts are pre-set according to R&D needs, and users can set the requirement prompts and format prompts according to their needs. Specifically, the requirement prompts are used to indicate the generated dialogue requirements, which include generating a game dialogue with options. The game dialogue corresponds to a dialogue subject, and the dialogue requirements also define the connection method of the game dialogue between the dialogue subjects, so that the dialogue connection is more natural. For example, the above-mentioned dialogue subjects can be game characters and players, or non-player characters, etc.; the above-mentioned dialogue connection method can include the dialogue response method between the dialogue subjects, as well as the connection method of the dialogue options. The above-mentioned format prompts are used to indicate the dialogue format output by the model. The dialogue format is used to control the model to normalize and aggregate options without fissioning options, so that the model outputs a link to form a dialogue framework.
[0031] Figure 2 shows a structural diagram of a multi-option, same-path conversation provided by an embodiment of the present disclosure. The conversation framework shown in Figure 2 is generated offline using a large language model. Player options a and b in this conversation framework represent the game conversations corresponding to these two options. Each player option corresponds to a different game character response, but these different responses are aggregated into a single game character option. This allows the conversation framework to avoid option fission and instead normalize and aggregate options, resulting in a multi-option, same-path conversation within a main conversation framework consisting of a single link.
[0032] Figure 3 is a diagram of a dialogue framework in related art. In offline dialogue solutions in related art, it is first necessary to generate an offline script, then generate options for each line of dialogue (i.e., the options that are generated after the game character after the different player options in Figure 2), and complete the dialogue link from the corresponding option to the leaf node. However, this method requires the generation of a complete set of dialogues for each additional option, resulting in high generation costs. There is an unnatural problem of option bifurcation when performing option fission, and a certain degree of manual participation is required to formulate option rules. Furthermore, when performing option fission, there will be serious duplication or logical conflicts between multiple dialogue paths. Although the dialogue framework in Figure 3 was generated offline with the help of a large language model, the computational complexity of Figure 3 is higher, at an exponential level, and the cost of generating dialogue is higher.
[0033] In a specific implementation, the target dialogue text, the required prompt words, and the format prompt words are input into the large language model. The large language model will output a multi-option same-path dialogue that conforms to the dialogue format indicated by the format prompt words based on the required prompt words. The multi-option same-path dialogue includes multiple dialogue segments, each of which contains game dialogue with at least two options. The dialogue format of each dialogue segment and the dialogue format composed of the multiple dialogue segments contained in the multi-option same-path dialogue are all the same as the dialogue format indicated by the format prompt words. Among them, the multi-option same-path dialogue contains at least two game dialogues corresponding to the options. The game dialogues corresponding to these options are aggregated into a dialogue body (equivalent to the game character in Figure 2). This dialogue body will in turn correspond to at least two game dialogues corresponding to the options. The game dialogues corresponding to these options are further aggregated into a dialogue body. Since these options are normalized and aggregated without fission, the paths corresponding to these options can be considered to be the same, but the game dialogues corresponding to different options are usually different.
[0034] Specifically, each dialogue segment in a multi-option, same-path dialogue contains at least two game dialogue options corresponding to the dialogue subject. The number of options corresponding to each dialogue segment can be determined based on R&D requirements and is not specifically limited. For example, if the game character's game dialogue is xxx, then the player's game dialogue may be dialogue yy corresponding to option a, and dialogue zz corresponding to option b. If the game character's game dialogue is xxx, then the player's game dialogue may be dialogue yy corresponding to option a, dialogue zz corresponding to option b, dialogue aa corresponding to option c, and dialogue cc corresponding to option d, and so on.
[0035] For example, in a multi-choice, same-path dialogue, each dialogue segment contains two options. For example, a dialogue segment might include: For the character's game dialogue xxx, dialogue yy corresponding to option a, and dialogue yy corresponding to option b; dialogue dd corresponding to option a; and dialogue ee corresponding to option b. The responses to dialogue dd and dialogue cc are then aggregated into the character's game dialogue xxx in the next dialogue segment, which contains the same dialogue format as the previous segment.
[0036] Step S106, performing correction processing on the multi-option same-path dialogue to obtain a processed multi-option same-path dialogue; wherein the processed multi-option same-path dialogue is used to provide a game dialogue with options according to the player's operation when the game is running.
[0037] The aforementioned correction processing of the multi-option, same-path dialogue can be determined based on R&D needs. For example, the correction processing may include at least one of the following: replacing certain dialogue content in the multi-option, same-path dialogue, correcting punctuation in the multi-option, same-path dialogue, adding emoticons to the multi-option, same-path dialogue, and automatically reviewing the topic sensitivity of the multi-option, same-path dialogue. In specific implementation, after the multi-option, same-path dialogue is corrected, a processed multi-option, same-path dialogue can be generated. The processed multi-option, same-path dialogue is generated offline. During game operation, the processed multi-option, same-path dialogue can be directly used as needed. That is, the processed multi-option, same-path dialogue will be read in rounds during the game, thereby generating game dialogues with dialogue options in the game interface.
[0038] The disclosed embodiments provide a method for generating game dialogues. This method employs techniques such as step-by-step task decomposition, gradual offline invocation of a large language model, and streamlined automatic post-processing. This method can reduce computational costs and development difficulty while ensuring the quality of dialogue generation, and has good practicality and scalability.
[0039] The following embodiments are used to describe a method for obtaining a target conversation text.
[0040] Specifically, an initial conversation text is obtained, and the initial conversation text and the reported prompt words are input into a large language model, so that the large language model converts the person in the target conversation text into a specified person based on the reported prompt words, thereby obtaining the initial conversation text after the person is converted; wherein the large language model is used to generate the desired text through the guidance of the input prompt words, and the reported prompt words are used to indicate the specified person to be converted into the person in the initial conversation text; and the initial conversation text after the person is converted is determined as the target conversation text.
[0041] In practice, the aforementioned paraphrase prompt is pre-set and serves to indicate the specific person to which the target conversation text's pronouns are to be converted. This specific person can be determined based on R&D needs, for example, third-person or first-person. In practice, the target text is appended with the paraphrase prompt to generate a concatenated content. This concatenated content is then fed into the large language model, which then outputs the target conversation text with the converted pronouns. This approach can enhance the accuracy of subsequent conversational content generation. Otherwise, directly converting the target conversation text through the large language model involves a complex conversion process, potentially resulting in ineffective results.
[0042] In a specific embodiment, the designated person may be the third person, and the paraphrase prompt may be "Based on the above text, write a corresponding third-person perspective to describe the story." The target text and the paraphrase prompt are then used as input, and the output of the large language model is used as the target text converted into the third person.
[0043] It should be noted that if the person in the initial dialogue text is to be designated as the person, the initial dialogue text can be directly determined as the target dialogue text.
[0044] The following embodiment is used to describe the method of generating a multi-option same-path dialogue.
[0045] Specifically, the specific process of inputting the target dialogue text, required prompt words, and format prompt words into the pre-trained large language model to obtain a multi-option same-path dialogue can be achieved through the following steps 10-12:
[0046] Step 10: splice the target dialogue text, the requirement prompt words and the format prompt words to obtain a splicing result.
[0047] In a specific implementation, the target dialogue text is spliced with the requirement prompt word, and the format prompt word is spliced with the requirement prompt word to obtain a splicing result.
[0048] Step 11: input the splicing result into the large language model, so that the large language model processes the splicing result based on the requirement prompt words and the format prompt words to obtain the output result of the large language model.
[0049] Step 12: Use the large language model to determine whether the dialogue format of the output result conforms to the dialogue format indicated by the format prompt word. If not, continue inputting the splicing result into the large language model until the output result is a multi-option same-path dialogue that meets the dialogue requirements indicated by the required prompt word and conforms to the dialogue format indicated by the format prompt word.
[0050] In specific implementations, the aforementioned multi-choice, same-path dialogue generates a dialogue backbone framework, serving as a benchmark for subsequent dialogue optimization. The concatenation results are input into a large language model, which processes the concatenation results based on the required prompts and format prompts, generating an output from the large language model. A determination is then made as to whether the dialogue format of the output conforms to the dialogue format indicated by the format prompts. If not, the concatenation results are continuously input into the large language model until the large language model outputs a multi-choice, same-path dialogue that meets the dialogue requirements indicated by the required prompts and conforms to the dialogue format indicated by the format prompts. If so, the output is determined as a multi-choice, same-path dialogue.
[0051] In a specific embodiment, the requirement prompt may be "You are a game copywriter, and you are responsible for designing the dialogue, which is divided into two dialogue subjects: the game character and the player. The game character's response a is naturally connected with the player's option a, and the response b is naturally connected with the player's option b. Responses a and b are in the same sentence. The game character's dialogue content is naturally connected with the player's response a and b." The formatted prompt may be "I. Game player: xxx;
[0052] II. Player: Option a.xxx; Option b.xxx;
[0053] III. Game character: respond to a.xxx; respond to b.xxx;
[0054] IV. Game character: xxx;
[0055] …(The structure of II to IV is repeated later)”.
[0056] Specifically, the formatting prompts I to IV above will cause the dialogue logic to form the dialogue structure shown in FIG2 .
[0057] The above method is a low-cost method for generating dialogues with options for game characters based on a large language model, which can improve the efficiency and quality of dialogue generation while reducing costs and resource consumption.
[0058] The following embodiments are used to describe the manner in which the dialogue modification process is performed.
[0059] Specifically, the above-mentioned process of correcting the multi-option same-path dialogue to obtain the processed multi-option same-path dialogue may include: correcting the specified dialogue content in the multi-option same-path dialogue based on the large language model to obtain the processed dialogue content, and replacing the specified dialogue content in the multi-option same-path dialogue with the processed dialogue content; wherein the specified dialogue content includes multiple dialogue segments of the same-path dialogue based on the same candidate option in the multi-option same-path dialogue.
[0060] In practice, the formatting requirements for multi-choice, same-path conversations are complex, slightly exceeding the capabilities of most large language models. Therefore, after generating a multi-choice, same-path conversation, it's necessary to polish the conversation to improve its logic and fluency. Specifically, the designated conversation content is often prone to errors during the generation process of multi-choice, same-path conversations. This disclosure requires replacing the designated conversation content with processed content to improve conversation quality.
[0061] In an optional embodiment, the structural framework corresponding to the multiple dialogue segments based on the same path dialogue for the same candidate item in the aforementioned multi-option, same-path dialogue is identical, wherein each dialogue segment contains multiple lines of dialogue content, and the multiple lines of dialogue content only include the same-path game dialogue for the same candidate item. Based on this, the specific process of correcting the specified dialogue content may include: for each dialogue segment in the multi-option, same-path dialogue, performing the following operations: inputting the current dialogue segment and the replacement rule prompt into the large language model, so that the large language model replaces the dialogue content corresponding to a specified number of lines in the current dialogue segment with new dialogue content based on the replacement rule prompt, thereby obtaining a corrected dialogue segment; wherein the replacement rule prompt includes the specified number of lines in the dialogue segment that need to be rewritten and the new requirements.
[0062] In practice, each conversation segment in a multi-choice, same-path conversation needs to be treated as a current conversation segment, and a specified number of lines of conversation within the current segment need to be replaced with new content. The specific content of the replacement rule prompt can be determined based on R&D requirements. The replacement rule prompt is primarily used to indicate which line in the conversation segment needs to be rewritten and the rewriting requirements for that line of conversation.
[0063] In one specific embodiment, assuming that the number of repetitions of structures II-IV in the formatting prompt is n, the total number of dialogue lines is 3n+1. In the multi-option, same-path dialogue obtained using the large language model, the dialogue with output errors typically occurs on line 3i+3 (where i = 0, ..., n-1). This disclosure extracts the path for option a from lines 3i+1 to 3i+4 as the current dialogue segment:
[0064] “I. Game player: xxx;
[0065] II. Player: xxx (option a content);
[0066] III. Game character: xxx (respond to content a);
[0067] IV. Game character: xxx;”.
[0068] The above dialogue fragment is then concatenated with the replacement rule prompt, "The above is the original dialogue content. To make line 3 flow more smoothly with the rest, please rewrite line 3 while retaining all other lines." This is then fed into the large language model to obtain the new line 3, which replaces the original content. A similar operation is repeated for option b until all dialogue fragments are optimized.
[0069] In an optional embodiment, the above-mentioned correction of the specified conversation content includes: correcting the specified conversation content to obtain the corrected conversation content, and post-processing the corrected conversation content; the post-processing method includes at least one of the following: punctuation correction processing, emoticon addition processing and topic sensitivity review of the corrected conversation content.
[0070] In a specific implementation, the above-mentioned revised dialogue content is obtained by revising the specified dialogue content in the multi-option same-path dialogue to obtain a revised multi-option same-path dialogue.
[0071] Specifically, the corrected conversation content includes corrected punctuation generated based on the large language model; the specific process of performing punctuation correction processing on the corrected conversation content may include: inputting the corrected conversation content after the corrected punctuation is removed and the punctuation prompt words into the large language model, so that the large language model adds punctuation to the corrected conversation content based on the punctuation prompt words, thereby obtaining the conversation content after punctuation is added; wherein the punctuation prompt words include the requirement to re-add punctuation.
[0072] In a specific implementation, when correcting a specific conversation, the specific conversation needs to be input into the large language model so that the large language model outputs the corrected conversation. The punctuation included in the corrected conversation is also the corrected punctuation. When correcting the punctuation in the corrected conversation, it is necessary to automatically detect any punctuation errors in the corrected conversation and automatically correct the punctuation. In one specific embodiment, for player option a and the game character's response branch a, the large language model outputs a high probability of ending with a comma. However, because the game character's response branch a contains overwritten content, the punctuation in player option a needs to be corrected. The specific method is to remove the comma from the content of player option a (here, the content of player option a is equivalent to the target conversation content), then concatenate it with the punctuation prompt "What is the correct punctuation mark at the end of this sentence?" and input it into the large language model to obtain the punctuation output by the model.
[0073] When adding emoticons to the revised dialogue content, it is necessary to select at least one dialogue sentence from the revised dialogue content, and input the at least one dialogue sentence and the emotion determination prompt word into the large language model, so that the large language model can determine the character emotion corresponding to the dialogue sentence based on the emotion range indicated by the emotion determination prompt word, and add the emoticon corresponding to the character emotion to the specified position of the dialogue sentence.
[0074] In a specific implementation, a random sentence or a preset number of lines of dialogue can be selected from the revised dialogue content. The selected sentence and the emotion-determining prompt word are then input into the large language model to obtain the character emotion corresponding to the sentence. The corresponding emoticon is then added to a specified position in the sentence. The emotion-determining prompt word indicates the range of emotion categories within which the character emotion is determined. The specified position can be the middle, beginning, or end of the sentence.
[0075] In one specific embodiment, a range of emoticon categories is predefined, such as the word set {happy, sad, surprised}. These words are then associated with corresponding emoticons within the program. Then, a random probability is used to select several sentences from the corrected conversation content. These sentences are then combined with the phrase "determine the character's emotion in the above sentence, where the emotion range is limited to {happy, sad, surprised}" and fed into the large language model. The model outputs the character's emotion, and the emoticon corresponding to the emotion is then added to the beginning or end of the corresponding sentence.
[0076] When conducting a topic sensitivity review on the revised conversation content, it is necessary to determine whether the revised conversation content contains sensitive topics through a preset sensitive word library; or, to determine whether the revised conversation content contains sensitive topics through a pre-trained sensitivity judgment model; if it is determined that the revised conversation content contains sensitive topics, continue to input the target conversation text, required prompt words and format prompt words into the pre-trained large language model to obtain a multi-option same-path conversation, and correct the multi-option same-path conversation until it is determined that the revised conversation content does not contain sensitive topics.
[0077] In practice, sensitivity review typically involves two methods: sensitive word library matching and sensitivity determination model inference. The sensitive word library is a list of sensitive terms related to race, gender, religion, politics, violence, and other areas. During topic sensitivity review, the corrected conversation content is matched against the sensitive word library. If a word in the sensitive word library matches, it indicates that the corrected conversation content may contain sensitivity issues and requires further processing. In addition to sensitive word library matching, sensitivity determination model inference can also be used. This model typically uses sensitive phrases as training samples. By learning from these samples, it is subsequently used to determine whether the corrected conversation content contains sensitivity issues. If the model infers that the corrected conversation content contains sensitivity issues, further processing is required. In short, if there is a match between the sensitive word library and the sensitivity determination model, the conversation is determined to contain topic sensitivity issues. Because topic sensitivity is a serious problem, regenerating the multi-choice, same-path conversation is necessary in this case.
[0078] FIG4 is a flow chart of a game dialogue generation process according to an embodiment of the present disclosure, which includes the following four main steps:
[0079] Step 1: Input the original text (equivalent to the target dialogue text mentioned above) and the paraphrase prompt into the large language model to obtain the third-person story narrative (equivalent to the target dialogue text after the above person conversion), thereby enhancing the accuracy of the content generated in the subsequent dialogue.
[0080] Step 2: Generate a multi-option same-path dialogue that meets the basic requirements in a specified format. That is, input the third-person story narration, requirement prompt words, and format prompt words into the large language model to obtain a multi-option same-path dialogue.
[0081] Step three, dialogue path optimization, involves extracting dialogue content from multi-option, same-path dialogues and inputting it into a large language model. The extracted dialogue content is then rewritten to obtain optimized dialogue segments and reassemble them into a dialogue.
[0082] Step 4: Post-processing of the conversation, including punctuation correction, emoticon addition, and automatic review of topic sensitivity, to obtain the processed multi-option same-path conversation, that is, to obtain the AI conversation tree.
[0083] The above method is a low-cost method for generating dialogue options for game characters based on a large language model. This offline solution can be manually reviewed before going online to ensure that the dialogue does not involve sensitive issues. At the same time, the cost of generating dialogue is extremely low and the efficiency is extremely high.
[0084] Corresponding to the above method embodiment, the embodiment of the present disclosure further provides a device for generating game dialogues. As shown in FIG5 , the device includes: a text acquisition module 50 , a dialogue generation module 51 and a dialogue processing module 52 .
[0085] Among them, the text acquisition module 50 is configured to execute the acquisition of the target dialogue text; the dialogue generation module 51 is configured to execute the input of the target dialogue text, the requirement prompt words and the format prompt words into the pre-trained large language model to obtain a multi-option same-path dialogue; wherein the requirement prompt words are used to indicate the generated dialogue requirements, and the dialogue requirements include generating a game dialogue with options; the format prompt words are used to indicate the dialogue format output by the model, and the dialogue format includes a dialogue framework format for generating a unified summary of options; the multi-option same-path dialogue includes multiple dialogue segments, each of which contains a game dialogue with options, and the dialogue framework format composed of multiple dialogue segments is the same as the dialogue format indicated by the format prompt words; the dialogue processing module 52 is configured to execute the correction processing of the multi-option same-path dialogue to obtain a processed multi-option same-path dialogue; wherein the processed multi-option same-path dialogue is used to provide a game dialogue with options according to the player's operation when the game is running.
[0086] The above-mentioned game dialogue generation device uses technologies such as step-by-step task decomposition, gradual offline calling of large language models, and process-based automatic post-processing to generate multi-option same-path dialogues offline, thereby improving the efficiency and quality of dialogue generation while reducing costs and resource consumption.
[0087] Optionally, the above-mentioned dialogue generation module 51 is specifically configured to execute: splicing the target dialogue text, the requirement prompt words, and the format prompt words to obtain a splicing result; inputting the splicing result into the large language model, so that the large language model processes the splicing result based on the requirement prompt words and the format prompt words to obtain an output result of the large language model; judging by the large language model whether the dialogue format of the output result conforms to the dialogue format indicated by the format prompt words, and if not, continuing to input the splicing result into the large language model until the output result is a multi-option same-path dialogue that meets the dialogue requirements indicated by the requirement prompt words and conforms to the dialogue format indicated by the format prompt words.
[0088] Based on the above-mentioned dialogue generation module, a low-cost generation method for game character dialogue with options based on a large language model can improve the efficiency and quality of dialogue generation while reducing costs and resource consumption.
[0089] Optionally, the above-mentioned dialogue processing module 52 is configured to execute: for the specified dialogue content in the multi-option same-path dialogue, based on the large language model, modify the specified dialogue content to obtain processed dialogue content, and replace the specified dialogue content in the multi-option same-path dialogue with the processed dialogue content; wherein the specified dialogue content includes multiple dialogue segments of the same-path dialogue based on the same candidate option in the multi-option same-path dialogue.
[0090] Based on the above-mentioned dialogue processing module, we can effectively overcome the problem that the formatting requirements of multi-option same-path dialogues are relatively complex, which may slightly exceed the capabilities of most large language models. Therefore, through the above-mentioned method, on the basis of obtaining multi-option same-path dialogues, we can polish the dialogue effects, enhance the dialogue logic and fluency, and thus improve the dialogue quality.
[0091] Optionally, the structural frameworks corresponding to the multiple dialogue segments based on the same-path dialogue for the same candidate item in the above-mentioned multi-option same-path dialogue are the same, wherein each dialogue segment contains multiple lines of dialogue content, and the multiple lines of dialogue content only contain the same-path game dialogue for the same candidate item; based on this, the above-mentioned dialogue processing module 52 is also configured to execute: for each dialogue segment in the multi-option same-path dialogue, perform the following operations: input the current dialogue segment and the replacement rule prompt word into the large language model, so that the large language model replaces the dialogue content corresponding to the specified number of lines in the current dialogue segment with new dialogue content based on the replacement rule prompt word, and obtains a revised dialogue segment; wherein the replacement rule prompt word includes the specified number of lines that need to be rewritten in the dialogue segment and the rewriting requirements.
[0092] Optionally, the above-mentioned correction of the specified conversation content includes: correcting the specified conversation content to obtain the corrected conversation content, and post-processing the corrected conversation content; the post-processing method includes at least one of the following: punctuation correction processing, emoticon addition processing and topic sensitivity review of the corrected conversation content.
[0093] Further optionally, the revised conversation content includes revised punctuation generated based on the large language model; the conversation processing module 52 is further configured to execute: inputting the revised conversation content after the revised punctuation is removed and the punctuation prompt words into the large language model, so that the large language model adds punctuation to the revised conversation content based on the punctuation prompt words, thereby obtaining the conversation content after the punctuation is added; wherein the punctuation prompt words include a requirement to re-add punctuation.
[0094] Further optionally, the above-mentioned dialogue processing module 52 is also configured to execute: selecting at least one dialogue sentence from the corrected dialogue content, and inputting at least one dialogue sentence and emotion determination prompt words into the large language model, so that the large language model determines the character emotion corresponding to the dialogue sentence based on the emotion range indicated by the emotion determination prompt word, and adds the emoticon corresponding to the character emotion to the designated position of the dialogue sentence.
[0095] Further optionally, the above-mentioned dialogue processing module 52 is also configured to execute: determining whether the revised dialogue content contains sensitive topics through a preset sensitive word library; or determining whether the revised dialogue content contains sensitive topics through a pre-trained sensitivity judgment model; if it is determined that the revised dialogue content contains sensitive topics, continuing to input the target dialogue text, required prompt words and format prompt words into the pre-trained large language model to obtain a multi-option same-path dialogue, and correcting the multi-option same-path dialogue until it is determined that the revised dialogue content does not contain sensitive topics.
[0096] The dialogue processing module in the above-mentioned device is a low-cost method for generating dialogue options for game characters based on a large language model. This offline solution can be manually reviewed before going online to ensure that the dialogue does not involve sensitive issues. At the same time, the cost of dialogue generation is extremely low and the efficiency is extremely high.
[0097] The above-mentioned device further optionally includes a person conversion module, which is configured to execute: before obtaining the target dialogue text, obtaining the initial dialogue text, and inputting the initial dialogue text and the reported prompt words into the large language model, so that the large language model converts the person in the initial dialogue text into the specified person based on the reported prompt words, thereby obtaining the initial dialogue text after the person conversion; wherein the large language model is used to generate the desired text through the guidance of the input prompt words, and the reported prompt words are used to indicate the specified person to be converted into the person in the initial dialogue text; and the initial dialogue text after the person conversion is determined as the target dialogue text.
[0098] The above-mentioned person conversion module implements the splicing content obtained by adding a report prompt word after the target text. The spliced content is input into the large language model, and the target dialogue text after person conversion is output. This method can enhance the accuracy of the content generated in subsequent dialogues. Otherwise, the target dialogue text is directly converted and processed by the large language model. The intermediate conversion process is relatively large and may result in poor results, thereby improving the quality of dialogue generation.
[0099] The game dialogue generation device provided in the embodiment of the present disclosure has the same implementation principle and technical effects as those in the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding content in the aforementioned method embodiment.
[0100] An embodiment of the present disclosure also provides an electronic device, as shown in FIG6 , which includes a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned method for generating game dialogues.
[0101] Specifically, the above-mentioned method for generating game dialogue includes: obtaining target dialogue text; inputting the target dialogue text, requirement prompt words and format prompt words into a pre-trained large language model to obtain a multi-option same-path dialogue; wherein the requirement prompt words are used to indicate the dialogue requirements, and the dialogue requirements include generating a game dialogue with options; the format prompt words are used to indicate the dialogue format output by the model, and the dialogue format includes generating a dialogue framework format that normalizes and summarizes the options; the multi-option same-path dialogue includes multiple dialogue segments, each of which contains a game dialogue with options, and the dialogue framework format composed of the multiple dialogue segments is the same as the dialogue format indicated by the format prompt words; the multi-option same-path dialogue is corrected to obtain a processed multi-option same-path dialogue; wherein the processed multi-option same-path dialogue is used to provide a game dialogue with options according to the player's operation when the game is running.
[0102] The above-mentioned method for generating game dialogues uses technologies such as step-by-step task decomposition, gradual offline calling of large language models, and process-based automatic post-processing to generate multi-option same-path dialogues offline, thereby improving the efficiency and quality of dialogue generation while reducing costs and resource consumption.
[0103] In an optional embodiment, the aforementioned inputting of the target dialogue text, requirement prompts, and format prompts into a pre-trained large language model to generate a multi-option, same-path dialogue includes: concatenating the target dialogue text, requirement prompts, and format prompts to obtain a concatenated result; inputting the concatenated result into the large language model, causing the large language model to process the concatenated result based on the requirement prompts and format prompts to obtain an output from the large language model; and determining, by the large language model, whether the dialogue format of the output conforms to the dialogue format indicated by the format prompts. If not, the concatenated result is continuously input into the large language model until the output is a multi-option, same-path dialogue that meets the dialogue requirements indicated by the requirement prompts and conforms to the dialogue format indicated by the format prompts. This embodiment provides a low-cost method for generating game character dialogue with options based on a large language model, which can improve the efficiency and quality of dialogue generation while reducing costs and resource consumption.
[0104] In an optional embodiment, the above-mentioned correction processing of the multi-option same-path dialogue to obtain the processed multi-option same-path dialogue includes: for specified dialogue content in the multi-option same-path dialogue, based on the large language model, correcting the specified dialogue content to obtain processed dialogue content, and replacing the specified dialogue content in the multi-option same-path dialogue with the processed dialogue content; wherein the specified dialogue content includes multiple dialogue segments of the same-path dialogue based on the same candidate option in the multi-option same-path dialogue.
[0105] Based on this embodiment, the problem that the formatting requirements of multi-option same-path dialogues are relatively complex and slightly exceed the capabilities of most large language models can be better overcome. Therefore, through the above method, on the basis of obtaining multi-option same-path dialogues, the dialogue effect is polished, the logic and fluency of the dialogue are enhanced, and then the quality of the dialogue is improved.
[0106] In an optional embodiment, the structural frameworks corresponding to the multiple dialogue segments based on the same-path dialogue for the same candidate item in the above-mentioned multi-option same-path dialogue are the same, wherein each dialogue segment contains multiple lines of dialogue content, and the multiple lines of dialogue content only contain the same-path game dialogue for the same candidate item; correcting the specified dialogue content includes: for each dialogue segment in the multi-option same-path dialogue, performing the following operations: inputting the current dialogue segment and the replacement rule prompt word into the large language model, so that the large language model replaces the dialogue content corresponding to the specified number of lines in the current dialogue segment with new dialogue content based on the replacement rule prompt word, to obtain a corrected dialogue segment; wherein the replacement rule prompt word includes the specified number of lines that need to be rewritten in the dialogue segment and the rewriting requirements.
[0107] In an optional embodiment, the above-mentioned correction of the specified conversation content includes: correcting the specified conversation content to obtain the corrected conversation content, and post-processing the corrected conversation content; the post-processing method includes at least one of the following: punctuation correction processing, emoticon addition processing and topic sensitivity review of the corrected conversation content.
[0108] In an optional embodiment, the revised conversation content includes revised punctuation generated based on a large language model; and performing punctuation correction processing on the revised conversation content includes: inputting the revised conversation content after the revised punctuation is removed and a punctuation prompt word into the large language model, so that the large language model adds punctuation to the revised conversation content based on the punctuation prompt word, thereby obtaining the conversation content after punctuation is added; wherein the punctuation prompt word includes a requirement to re-add punctuation.
[0109] In an optional embodiment, the above-mentioned revised dialogue content is processed by adding emoticons, including: selecting at least one dialogue sentence from the revised dialogue content, and inputting the at least one dialogue sentence and emotion determination prompt words into the large language model, so that the large language model determines the character emotion corresponding to the dialogue sentence based on the emotion range indicated by the emotion determination prompt word, and adds the emoticon corresponding to the character emotion to the specified position of the dialogue sentence.
[0110] In an optional embodiment, the above-mentioned revised conversation content is subject to a topic sensitivity review, including: determining whether the revised conversation content contains sensitive topics through a preset sensitive word library; or determining whether the revised conversation content contains sensitive topics through a pre-trained sensitivity judgment model; if it is determined that the revised conversation content contains sensitive topics, continuing to input the target conversation text, required prompt words and format prompt words into a pre-trained large language model to obtain a multi-option same-path conversation, and correcting the multi-option same-path conversation until it is determined that the revised conversation content does not contain sensitive topics.
[0111] The above embodiment provides a low-cost method for generating dialogue options for game characters based on a large language model. This offline solution can be manually reviewed before going online to ensure that the dialogue does not involve sensitive issues. At the same time, the dialogue generation cost is extremely low and the efficiency is extremely high.
[0112] In an optional embodiment, before obtaining the target dialogue text, the method further includes: obtaining an initial dialogue text, and inputting the initial dialogue text and a reported prompt word into a large language model, so that the large language model converts the person in the initial dialogue text into a specified person based on the reported prompt word, thereby obtaining the initial dialogue text after the person is converted; wherein the large language model is used to generate the desired text by being guided by the input prompt word, and the reported prompt word is used to indicate the specified person to which the person in the initial dialogue text is to be converted; and the initial dialogue text after the person is converted is determined as the target dialogue text.
[0113] Based on this embodiment, a target text is followed by a paraphrase prompt word to obtain a concatenated content, which is then input into a large language model to output a target dialogue text after person conversion. This method can enhance the accuracy of content generated in subsequent dialogues. Otherwise, the target dialogue text is directly converted and processed by the large language model. The intermediate conversion process is relatively large and may result in poor results, thereby improving the quality of dialogue generation.
[0114] Furthermore, the electronic device shown in FIG6 further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .
[0115] Memory 100 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between the system network element and at least one other network element is achieved through at least one communication interface 103 (which may be wired or wireless), and may utilize the Internet, a wide area network, a local area network, a metropolitan area network, etc. Bus 102 may be an ISA bus, a PCI bus, or an EISA bus. Buses can be classified as address buses, data buses, control buses, etc. For ease of illustration, FIG6 shows only one bidirectional arrow, but this does not mean that there is only one bus or only one type of bus.
[0116] The processor 101 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 101 or by instructions in the form of software. The above-mentioned processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 100, and processor 101 reads information in memory 100 and, in conjunction with its hardware, implements the method of the aforementioned embodiment.
[0117] The embodiment of the present disclosure also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned method for generating game dialogues.
[0118] Specifically, the above-mentioned method for generating game dialogue includes: obtaining target dialogue text; inputting the target dialogue text, requirement prompt words and format prompt words into a pre-trained large language model to obtain a multi-option same-path dialogue; wherein the requirement prompt words are used to indicate the dialogue requirements, and the dialogue requirements include generating a game dialogue with options; the format prompt words are used to indicate the dialogue format output by the model, and the dialogue format includes generating a dialogue framework format that normalizes and summarizes the options; the multi-option same-path dialogue includes multiple dialogue segments, each of which contains a game dialogue with options, and the dialogue framework format composed of the multiple dialogue segments is the same as the dialogue format indicated by the format prompt words; the multi-option same-path dialogue is corrected to obtain a processed multi-option same-path dialogue; wherein the processed multi-option same-path dialogue is used to provide a game dialogue with options according to the player's operation when the game is running.
[0119] The above-mentioned method for generating game dialogues uses technologies such as step-by-step task decomposition, gradual offline calling of large language models, and process-based automatic post-processing to generate multi-option same-path dialogues offline, thereby improving the efficiency and quality of dialogue generation while reducing costs and resource consumption.
[0120] In an optional embodiment, the aforementioned inputting of the target dialogue text, requirement prompts, and format prompts into a pre-trained large language model to generate a multi-option, same-path dialogue includes: concatenating the target dialogue text, requirement prompts, and format prompts to obtain a concatenated result; inputting the concatenated result into the large language model, causing the large language model to process the concatenated result based on the requirement prompts and format prompts to obtain an output from the large language model; and determining, by the large language model, whether the dialogue format of the output conforms to the dialogue format indicated by the format prompts. If not, the concatenated result is continuously input into the large language model until the output is a multi-option, same-path dialogue that meets the dialogue requirements indicated by the requirement prompts and conforms to the dialogue format indicated by the format prompts. This embodiment provides a low-cost method for generating game character dialogue with options based on a large language model, which can improve the efficiency and quality of dialogue generation while reducing costs and resource consumption.
[0121] In an optional embodiment, the aforementioned correction processing of a multi-option, same-path conversation to obtain a processed multi-option, same-path conversation includes: modifying specified conversation content within the multi-option, same-path conversation based on a large language model to obtain processed conversation content, and replacing the specified conversation content within the multi-option, same-path conversation with the processed conversation content; wherein the specified conversation content includes multiple conversation segments within the multi-option, same-path conversation based on the same candidate option. Based on this embodiment, the complex formatting requirements of multi-option, same-path conversations can be effectively overcome, which can slightly exceed the capabilities of most large language models. Thus, based on the obtained multi-option, same-path conversation, the aforementioned method can polish the conversation, enhance its logic and fluency, and thereby improve its quality.
[0122] In an optional embodiment, the structural frameworks corresponding to the multiple dialogue segments based on the same-path dialogue for the same candidate item in the above-mentioned multi-option same-path dialogue are the same, wherein each dialogue segment contains multiple lines of dialogue content, and the multiple lines of dialogue content only contain the same-path game dialogue for the same candidate item; correcting the specified dialogue content includes: for each dialogue segment in the multi-option same-path dialogue, performing the following operations: inputting the current dialogue segment and the replacement rule prompt word into the large language model, so that the large language model replaces the dialogue content corresponding to the specified number of lines in the current dialogue segment with new dialogue content based on the replacement rule prompt word, to obtain a corrected dialogue segment; wherein the replacement rule prompt word includes the specified number of lines that need to be rewritten in the dialogue segment and the rewriting requirements.
[0123] In an optional embodiment, the above-mentioned correction of the specified conversation content includes: correcting the specified conversation content to obtain the corrected conversation content, and post-processing the corrected conversation content; the post-processing method includes at least one of the following: punctuation correction processing, emoticon addition processing and topic sensitivity review of the corrected conversation content.
[0124] In an optional embodiment, the revised conversation content includes revised punctuation generated based on a large language model; and performing punctuation correction processing on the revised conversation content includes: inputting the revised conversation content after the revised punctuation is removed and a punctuation prompt word into the large language model, so that the large language model adds punctuation to the revised conversation content based on the punctuation prompt word, thereby obtaining the conversation content after punctuation is added; wherein the punctuation prompt word includes a requirement to re-add punctuation.
[0125] In an optional embodiment, the above-mentioned revised dialogue content is processed by adding emoticons, including: selecting at least one dialogue sentence from the revised dialogue content, and inputting the at least one dialogue sentence and emotion determination prompt words into the large language model, so that the large language model determines the character emotion corresponding to the dialogue sentence based on the emotion range indicated by the emotion determination prompt word, and adds the emoticon corresponding to the character emotion to the specified position of the dialogue sentence.
[0126] In an optional embodiment, the above-mentioned revised conversation content is subject to a topic sensitivity review, including: determining whether the revised conversation content contains sensitive topics through a preset sensitive word library; or determining whether the revised conversation content contains sensitive topics through a pre-trained sensitivity judgment model; if it is determined that the revised conversation content contains sensitive topics, continuing to input the target conversation text, required prompt words and format prompt words into a pre-trained large language model to obtain a multi-option same-path conversation, and correcting the multi-option same-path conversation until it is determined that the revised conversation content does not contain sensitive topics.
[0127] The above embodiment provides a low-cost method for generating dialogue options for game characters based on a large language model. This offline solution can be manually reviewed before going online to ensure that the dialogue does not involve sensitive issues. At the same time, the dialogue generation cost is extremely low and the efficiency is extremely high.
[0128] In an optional embodiment, before obtaining the target conversation text, the method further includes: obtaining initial conversation text, and inputting the initial conversation text and a paraphrase prompt into a large language model, so that the large language model converts the person in the initial conversation text to a specified person based on the paraphrase prompt, thereby obtaining the initial conversation text after the person-conversion. The large language model is configured to generate the desired text guided by the input prompt, and the paraphrase prompt indicates the specified person to which the person in the initial conversation text is to be converted; and the initial conversation text after the person-conversion is determined as the target conversation text. Based on this embodiment, the target text is followed by the paraphrase prompt to obtain a concatenated content, which is then input into the large language model to output the target conversation text after the person-conversion. This approach can enhance the accuracy of content generated in subsequent conversations. Otherwise, direct conversion of the target conversation text by the large language model would involve a relatively complex conversion process, potentially resulting in poor results, thereby improving the quality of conversation generation.
[0129] If the function is implemented in the form of 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 the present disclosure, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, terminal device, or network device, etc.) to execute all or part of the steps of the various embodiments of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0130] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate the description of this disclosure and simplify the description. They do not indicate or imply that the devices or components referred to must have a specific orientation, be constructed, or operate in a specific orientation. Therefore, they should not be construed as limitations on this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0131] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed in the present disclosure, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims.
Claims
1. A method for generating a game dialogue, the method comprising: Get the target conversation text; The target dialogue text, requirement prompt words, and format prompt words are input into a pre-trained large language model to obtain a multi-option same-path dialogue; wherein the requirement prompt words are used to indicate the generated dialogue requirements, which include generating a game dialogue with options; the format prompt words are used to indicate the dialogue format output by the model, which includes generating a dialogue framework format that normalizes and summarizes the options; the multi-option same-path dialogue includes multiple dialogue segments, each of which contains a game dialogue with options, and the dialogue framework format composed of the multiple dialogue segments is the same as the dialogue format indicated by the format prompt words; The multi-option same-path dialogue is modified to obtain a processed multi-option same-path dialogue; wherein the processed multi-option same-path dialogue is used to provide a game dialogue with options according to player operations when the game is running.
2. The method according to claim 1, wherein The target dialogue text, required prompt words and format prompt words are input into a pre-trained large language model to obtain a multi-option same-path dialogue, including: splicing the target dialogue text, the requirement prompt word, and the format prompt word to obtain a splicing result; Inputting the splicing result into the large language model, so that the large language model processes the splicing result based on the requirement prompt word and the format prompt word to obtain an output result of the large language model; The large language model is used to determine whether the dialogue format of the output result conforms to the dialogue format indicated by the format prompt word. If not, the splicing result is continuously input into the large language model until the output result is a multi-option same-path dialogue that meets the dialogue requirements indicated by the requirement prompt word and conforms to the dialogue format indicated by the format prompt word.
3. The method according to claim 1, wherein The modifying process of the multi-option same-path dialogue to obtain a processed multi-option same-path dialogue includes: For the specified dialogue content in the multi-option same-path dialogue, based on the large language model, the specified dialogue content is modified to obtain processed dialogue content, and the specified dialogue content in the multi-option same-path dialogue is replaced with the processed dialogue content; wherein the specified dialogue content includes multiple dialogue segments based on the same-path dialogue of the same candidate option in the multi-option same-path dialogue.
4. The method according to claim 3, wherein: The structural framework corresponding to the multiple dialogue segments based on the same path dialogue for the same candidate item in the multi-option same path dialogue is the same, wherein each dialogue segment contains multiple lines of dialogue content, and the multiple lines of dialogue content only contain the same path game dialogue for the same candidate item; The modifying of the specified conversation content includes: For each dialogue segment in the multi-option same-path dialogue, perform the following operations: The current dialogue segment and the replacement rule prompt are input into the large language model, so that the large language model replaces the dialogue content corresponding to a specified number of lines in the current dialogue segment with new dialogue content based on the replacement rule prompt to obtain a revised dialogue segment; wherein the replacement rule prompt includes the specified number of lines in the dialogue segment that need to be rewritten and the rewriting requirements.
5. The method according to claim 3, wherein The modification of the specified conversation content includes: modifying the specified conversation content to obtain modified conversation content, and post-processing the modified conversation content; the post-processing method includes at least one of the following: punctuation correction processing, emoticon addition processing and topic sensitivity review of the modified conversation content.
6. The method according to claim 5, wherein: The corrected conversation content includes corrected punctuation generated based on the large language model; Performing punctuation correction processing on the corrected conversation content includes: The corrected conversation content after the corrected punctuation is removed and the punctuation prompt word are input into the large language model, so that the large language model adds punctuation to the corrected conversation content based on the punctuation prompt word to obtain the conversation content after punctuation is added; wherein the punctuation prompt word includes a requirement to re-add punctuation.
7. The method according to claim 5, wherein: Adding emoticons to the corrected conversation content includes: At least one dialogue sentence is selected from the corrected dialogue content, and the at least one dialogue sentence and an emotion determination prompt word are input into the large language model, so that the large language model determines the character emotion corresponding to the dialogue sentence based on the emotion range indicated by the emotion determination prompt word, and adds the emoticon corresponding to the character emotion to the specified position of the dialogue sentence.
8. The method according to claim 6, wherein: Conduct a sensitivity review of the revised conversation content, including: Determine whether the corrected conversation content contains any sensitive topics using a preset sensitive word library; Alternatively, a pre-trained sensitivity determination model is used to determine whether the corrected conversation content contains sensitive topics; If it is determined that the revised conversation content contains sensitive topics, continue to input the target conversation text, required prompt words and format prompt words into the pre-trained large language model to obtain a multi-option same-path conversation, and correct the multi-option same-path conversation until it is determined that the revised conversation content does not contain sensitive topics.
9. The method according to claim 1, wherein Before obtaining the target dialogue text, the method further includes: Obtaining an initial conversation text, and inputting the initial conversation text and a paraphrase prompt word into the large language model, so that the large language model converts the person pronouns in the initial conversation text into a specified person pronoun based on the paraphrase prompt word, thereby obtaining the initial conversation text after person pronoun conversion; wherein the large language model is configured to generate a desired text under the guidance of the input prompt word, and the paraphrase prompt word is configured to indicate the specified person pronoun to be converted into the person pronoun in the initial conversation text; The initial dialogue text after the person conversion is determined as the target dialogue text.
10. A device for generating a game dialogue, the device comprising: A text acquisition module is configured to execute acquisition of target conversation text; The dialogue generation module is configured to input the target dialogue text, requirement prompts, and format prompts into a pre-trained large language model to generate a multi-option same-path dialogue; wherein the requirement prompts are used to indicate the generated dialogue requirements, and the dialogue requirements include generating game dialogues for options; the format prompts are used to indicate the dialogue format output by the model, and the dialogue format includes a dialogue framework format for generating a unified dialogue framework of the options; the multi-option same-path dialogue includes multiple dialogue segments, each of which includes a game dialogue with options, and the dialogue framework format composed of the multiple dialogue segments is the same as the dialogue format indicated by the format prompts; The dialogue processing module is configured to perform correction processing on the multi-option same-path dialogue to obtain a processed multi-option same-path dialogue; wherein the processed multi-option same-path dialogue is used to provide a game dialogue with options according to the player's operation when the game is running.
11. An electronic device comprising a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the method for generating a game dialogue according to any one of claims 1 to 9.
12. A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for generating a game dialogue according to any one of claims 1 to 9.