Text generation method and apparatus, electronic device, storage medium and program product

WO2026175320A1PCT designated stage Publication Date: 2026-08-27VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2026/078957
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-02-19
Filing Date
2026-02-12
Publication Date
2026-08-27

Smart Images

  • Figure CN2026078957_27082026_PF_FP_ABST
    Figure CN2026078957_27082026_PF_FP_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of artificial intelligence. Disclosed are a text generation method and apparatus, an electronic device, a storage medium and a program product. The method comprises: displaying a first interface, the first interface comprising at least one text generation control and first information; receiving a first input for a first text generation control among the at least one text generation control; and in response to the first input, generating a first text on the basis of the first information and a text generation scenario corresponding to the first text generation control, and displaying the first text on a second interface corresponding to the first text generation control.
Need to check novelty before this filing date? Find Prior Art

Description

Text generation methods, apparatuses, electronic devices, storage media, and program products

[0001] Cross-reference to related applications

[0002] This application claims priority to Chinese Patent Application No. 202510184826.6, filed in China on February 19, 2025, the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application belongs to the field of artificial intelligence technology, specifically relating to a text generation method, apparatus, electronic device, storage medium, and program product. Background Technology

[0004] Currently, the rapid development of large-scale language models has greatly promoted innovation in the field of automatic text generation, and has subverted the traditional content creation methods in electronic devices.

[0005] In the prior art, if a user needs to input a piece of text in an application interface, the user can input the required text in the interface of the text generation application, so that the electronic device can call a large language model to automatically generate text that matches the required text; finally, the user can trigger the electronic device to copy the generated text to an application interface.

[0006] However, large language models in existing technologies typically focus on providing general writing guidance, resulting in text content generated by electronic devices that is often monotonous and uninteresting, failing to meet users' actual needs. As a result, users may modify the text content generated by electronic devices, leading to poor accuracy of the generated text. Summary of the Invention

[0007] The purpose of this application is to provide a text generation method, apparatus, electronic device, storage medium, and program product that can simplify the text generation process and thereby improve the efficiency of electronic devices in generating text.

[0008] In a first aspect, embodiments of this application provide a text generation method, which includes: displaying a first interface, the first interface including at least one text generation control and first information; receiving a first input to the first text generation control of the at least one text generation control; and in response to the first input, generating first text based on the first information and a text generation scenario corresponding to the first text generation control, and displaying the first text in a second interface corresponding to the first text generation control.

[0009] Secondly, embodiments of this application provide a text generation apparatus, comprising: a display module, a receiving module, and a generation module. The display module is used to display a first interface, which includes at least one text generation control and first information. The receiving module is used to receive a first input to the first text generation control among the at least one text generation control. The generation module is used to generate first text based on the first information and a text generation scenario corresponding to the first text generation control, in response to the first input received by the receiving module. The display module is further used to display the first text in a second interface corresponding to the first text generation control.

[0010] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing programs or instructions executable on the processor, the programs or instructions, when executed by the processor, implementing the steps of the method described in the first aspect.

[0011] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0012] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0013] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0014] In this embodiment, a first interface is displayed, which includes at least one text generation control and first information. Then, a first input is received to the first text generation control. Finally, in response to the first input, first text is generated based on the first information and the text generation scenario corresponding to the first text generation control, and the first text is displayed in a second interface corresponding to the first text generation control. In this solution, since the first interface includes at least one text generation control, and each text generation control can correspond to a text generation scenario, the user inputs the first text generation identifier, allowing the electronic device to directly generate the first text based on the first information and the text generation scenario corresponding to the first text generation control, and display the first text in the second interface corresponding to the first text generation control. This eliminates the need for the user to manually input the desired text, reducing the steps involved in text generation and thus improving efficiency. Furthermore, since the first text is generated based on the first information and the text generation scenario corresponding to the first text generation control, it is more suitable for the current usage scenario, meeting the user's personalized needs and improving accuracy. Thus, while improving efficiency, the accuracy of text generation is also enhanced. Attached Figure Description

[0015] Figure 1 is a flowchart of one of the text generation methods provided in the embodiments of this application;

[0016] Figure 2 is a second flowchart of a text generation method provided in an embodiment of this application;

[0017] Figure 3A is one of the example diagrams of a browser interface provided in an embodiment of this application;

[0018] Figure 3B is a second example diagram of a browser interface provided in an embodiment of this application;

[0019] Figure 3C is a third example of a browser interface provided in an embodiment of this application;

[0020] Figure 4 is a flowchart of a text generation method provided in an embodiment of this application;

[0021] Figure 5A is one of the example diagrams of a session interface provided in an embodiment of this application;

[0022] Figure 5B is a second example diagram of a session interface provided in an embodiment of this application;

[0023] Figure 5C is a third example diagram of a session interface provided in an embodiment of this application;

[0024] Figure 6A is one of the example diagrams of a publishing interface provided in an embodiment of this application;

[0025] Figure 6B is a second example diagram of a publishing interface provided in an embodiment of this application;

[0026] Figure 7A is one example diagram of an editing interface provided in an embodiment of this application;

[0027] Figure 7B is a second example diagram of an editing interface provided in an embodiment of this application;

[0028] Figure 7C is a third example of an editing interface provided in an embodiment of this application;

[0029] Figure 8A is one of the example diagrams of an order evaluation interface provided in an embodiment of this application;

[0030] Figure 8B is a second example of an order evaluation interface provided in an embodiment of this application;

[0031] Figure 8C is a third example of an order evaluation interface provided in an embodiment of this application;

[0032] Figure 9 is a flowchart of a text generation method provided in an embodiment of this application;

[0033] Figure 10A is a fourth example diagram of a session interface provided in an embodiment of this application;

[0034] Figure 10B is a third example of a publishing interface provided in an embodiment of this application;

[0035] Figure 10C is a fourth example diagram of an editing interface provided in an embodiment of this application;

[0036] Figure 10D is a fourth example of an order evaluation interface provided in an embodiment of this application;

[0037] Figure 11 is one of the structural diagrams of a text generation model provided in an embodiment of this application;

[0038] Figure 12 is a second structural diagram of a text generation model provided in an embodiment of this application;

[0039] Figure 13 is a third structural diagram of a text generation model provided in an embodiment of this application;

[0040] Figure 14 is a fifth flowchart of a text generation method provided in an embodiment of this application;

[0041] Figure 15 is a schematic diagram of the structure of a text generation device provided in an embodiment of this application;

[0042] Figure 16 is one of the hardware structure diagrams of an electronic device provided in an embodiment of this application;

[0043] Figure 17 is a second schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0044] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0045] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0046] The terms "at least one," "at least one of," etc., used in the specification and claims of this application refer to any one, any two, or a combination of two or more of the included items. For example, at least one of a, b, and c can mean: "a," "b," "c," "a and b," "a and c," "b and c," and "a, b, and c," where a, b, and c can be single or multiple. Similarly, "at least two" refers to two or more items, and its meaning is similar to that of "at least one."

[0047] The text generation method, apparatus, electronic device, storage medium, and program product provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0048] The text generation method, apparatus, electronic device, storage medium, and program products provided in this application can be applied to scenarios involving text generation based on large language models. Examples include dialogue response scenarios, text editing scenarios, and order evaluation scenarios.

[0049] Scenario 1: When a conversation interface is displayed, if the contact corresponding to that conversation interface sends a conversation message to the user's electronic device, "Want to have dinner together tomorrow night?", the user can click the conversation reply control in the conversation interface. This allows the electronic device to call the large language model to obtain the user's schedule for the day. The conversation message, schedule, and conversation reply scenario are then input into the large language model. Based on the writing style and habits corresponding to the conversation reply scenario, as well as the conversation message and schedule, the large language model generates a reply statement, "Okay, I'm quite busy during the day, but I'm free in the evening," and displays this reply statement in the conversation interface.

[0050] Scenario 2: When the text publishing interface is displayed, the user can enter the summary text "concert" and at least one image in the text publishing interface. This allows the electronic device to display the summary text in the text editing area and at least one image in the image editing area of ​​the text publishing interface. Then, the user can click the edit text generation control in the text publishing interface. This allows the electronic device to call the large language model, inputting the summary text, at least one image, and the text editing scenario into the large language model. Based on the writing style and writing habits corresponding to the text editing scenario, as well as the summary text and at least one image, the large language model generates the edit text "B's concert was so exciting, it was definitely worth the trip"; and displays this edit text in the text publishing interface.

[0051] Scenario 3: When the order review interface is displayed, the user can enter the summary text "Not tasty" in the interface, which will then be displayed in the review display area on the electronic device. Next, the user can enter the order review identifiers, allowing the electronic device to display three identifiers in the identifier selection area: negative, neutral, and positive. The user can then click on the negative identifier, enabling the electronic device to access a large language model. This model will input the summary text and the corresponding evaluation information from the negative identifier into the large language model, which will then generate the order review message "Not tasty at all, my family has to give it a try" based on the writing style and habits appropriate for this scenario. This message will then be displayed in the order review interface.

[0052] It should be noted that scenarios 1 to 3 above are merely exemplary examples of some scenarios that may be applied to the embodiments of this application. In actual implementation, the embodiments of this application can also be applied to any possible scenarios such as reservation, procurement, and subscription. The embodiments of this application are not limited here.

[0053] In the text generation method, apparatus, electronic device, storage medium, and program product provided in the embodiments of this application, since the first interface includes at least one text generation control, and each text generation control can correspond to a text generation scenario, the user inputs the first text generation identifier, so that the electronic device can directly generate the first text based on the first information and the text generation scenario corresponding to the first text generation control, and display the first text in the second interface corresponding to the first text generation control. This eliminates the need for the user to manually input the required text, reducing the steps involved in text generation and thus improving the efficiency of text generation. Furthermore, since the first text is generated based on the first information and the text generation scenario corresponding to the first text generation control, the first text can better suit the current usage scenario to meet the user's personalized needs, thereby improving the accuracy of text generation. Thus, while improving the efficiency of text generation, the accuracy of text generation is also improved.

[0054] The text generation method provided in this application can be executed by a text generation device, which can be an electronic device or a functional module within an electronic device. The following description uses an electronic device as an example to illustrate the technical solution provided in this application.

[0055] This application provides a text generation method. Figure 1 shows a flowchart of a text generation method provided by this application. As shown in Figure 1, the text generation method provided by this application may include the following steps 201 to 203.

[0056] Step 201: The electronic device displays the first interface.

[0057] In this embodiment of the application, the first interface includes at least one text generation control and first information.

[0058] Optionally, in this embodiment of the application, the first interface can be any interface in any application in an electronic device.

[0059] For example, the first interface described above can be any of the following: a chat interface, a text posting interface, or an order evaluation interface, etc. The specific interface can be determined according to actual usage requirements, and this application embodiment does not impose any limitations.

[0060] It is understood that the aforementioned first information can be information contained in the first interface.

[0061] For example, the aforementioned first information may include at least one of the following: conversation messages, edited text, images, and evaluation information, etc. The specific details can be determined according to actual usage requirements, and this application embodiment does not impose any limitations.

[0062] Optionally, in this embodiment, the text generation control may include at least one of the following: a personalized reply control, a WeChat Moments text generation control, a text generation space for posting, or an order review text generation control, etc. The specific control can be determined according to actual usage requirements, and this embodiment does not impose any limitations.

[0063] Optionally, in the embodiments of this application, each of the at least one text generation control described above can correspond to a text generation scenario.

[0064] For example, the above text generation scenario can be any of the following: a conversation reply scenario, an evaluation information generation scenario, or a text editing scenario, etc. The specific scenario can be determined according to actual usage requirements, and this application embodiment does not impose any limitations.

[0065] Optionally, in the embodiments of this application, each of the at least one text generation control described above can correspond to an application interface.

[0066] For example, the application interface described above can be any of the following: a chat interface, a Moments editing interface, a text posting interface, and an order review interface, etc. The specific interface can be determined according to actual usage needs, and this application embodiment does not impose any limitations.

[0067] Optionally, in this embodiment of the application, the electronic device may display at least one of the above-mentioned text generation controls in a blank area of ​​the first interface; or, the electronic device may display at least one of the above-mentioned text generation controls in the first interface through a pop-up window.

[0068] Optionally, in this embodiment of the application, referring to FIG1 and FIG2, after the above step 201, the text generation method provided in this embodiment of the application further includes the following steps 301 and 302.

[0069] Step 301: The electronic device receives the sixth input to the first interface.

[0070] In this embodiment, the sixth input is used by the user to select an input method control on the first interface.

[0071] Optionally, in this embodiment, the sixth input includes, but is not limited to: the user clicking on the input method control with a finger or stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment does not limit it.

[0072] Optionally, in the embodiments of this application, the aforementioned specific gesture can be any one of a single-click gesture, a swipe gesture, a drag gesture, a pressure recognition gesture, a long-press gesture, an area change gesture, a double-press gesture, or a double-tap gesture.

[0073] Optionally, in this embodiment, the aforementioned click input can be a single click, a double click, or any number of clicks, or it can be a long press or a short press. For example, the first input can be a single click by the user on the input method control.

[0074] Step 302: The electronic device responds to the sixth input and displays the input method interface.

[0075] In this embodiment of the application, the input method interface includes at least one text generation control.

[0076] Optionally, in this embodiment of the application, the electronic device may display the input method interface at a preset display position in the first interface; or, the electronic device may display the input method interface in the first interface via a pop-up window.

[0077] For example, as shown in Figure 3A, taking a mobile phone as an example, the mobile phone can display a browser application interface 10, which displays a message icon "Xiaohong: Shall we have dinner together tomorrow night?" and an input method icon 11; as shown in Figure 3B, the user can click on the input method icon 11 to display the input method interface 12, which displays a repair control 121, a settings control 122, and a text generation component 123; as shown in Figure 3C, the user can click on the text generation component 123 to display a personalized reply control 124, a Moments text generation control 125, a post text generation control 126, and an order review text generation control 127 in the input method interface.

[0078] In this embodiment, the electronic device integrates the entry point for calling the large model into the input method control. By calling the input method control, the electronic device can perform text generation operations, which is simple and convenient, simplifies the text generation steps, and improves the efficiency of text generation by the electronic device.

[0079] Step 202: The electronic device receives a first input to a first text generation control in at least one text generation control.

[0080] In this embodiment of the application, the first input is used to select a first text generation control from at least one text generation control.

[0081] Optionally, in this embodiment, the first input includes, but is not limited to: a user clicking on the first text to generate an identifier using a touch device such as a finger or stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment does not limit it.

[0082] For example, the first input mentioned above can be the user's click input on the first text generation control.

[0083] Step 203: The electronic device responds to the first input, generates the first text based on the first information and the text generation scenario corresponding to the first text generation control, and displays the first text in the second interface corresponding to the first text generation control.

[0084] In this embodiment of the application, the electronic device can input the first information and the text generation scenario corresponding to the first text generation control into the first model, generate the first text through the first model, and display the first text in the second interface corresponding to the first text generation control.

[0085] It is understandable that the electronic device can automatically jump to the second interface corresponding to the first text generation control based on the user's input to the first text generation control, and generate the first text in the background through the first model, so that the first text can be displayed in the second interface.

[0086] Optionally, in the embodiments of this application, the first model mentioned above can be any of the following: an artificial intelligence (AI) model, a neural network model, or large language models (LLMs), etc. The specific model can be determined according to actual usage requirements, and this embodiment of the application does not impose any limitations.

[0087] Optionally, in this embodiment of the application, the electronic device may display the first text in a preset area of ​​the second interface; or, the electronic device may display the first text in the second interface through a pop-up window.

[0088] Optionally, in this embodiment of the application, the preset area can be the text display area in the input method interface; or, the preset area can be the text display area in the second interface.

[0089] Optionally, in this embodiment of the application, the first text mentioned above includes at least one text, which is displayed in the text selection area of ​​the second interface.

[0090] For example, the text selection area mentioned above can be a region in the input method interface of the second interface.

[0091] For example, referring to FIG1 and FIG4, after step 203 above, the text generation method provided in this application embodiment further includes the following steps 401 and 402.

[0092] Step 401: The electronic device receives a fifth input of a second text in at least one text.

[0093] In this embodiment of the application, the fifth input is used to select a second text from at least one text.

[0094] Optionally, in this embodiment, the fifth input includes, but is not limited to: the user clicking on the second text using a touch device such as a finger or stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment does not limit it.

[0095] For example, the fifth input mentioned above can be a click input on the second text.

[0096] Step 402: In response to the fifth input, the electronic device displays the second text in the text display area of ​​the second interface.

[0097] Optionally, in this embodiment of the application, when the second interface is a conversation interface, the text display area can be a message display area; when the second interface is a text publishing interface, the text display area can be a text editing area; when the second interface is an order evaluation interface, the text display area can be an order evaluation display area.

[0098] In this embodiment, the electronic device can determine the second text required by the user from multiple texts based on the user's input, and display the second text in the text display area, thereby improving the accuracy of the electronic device in determining the text.

[0099] For example, referring to Figure 3C above, as shown in Figure 5A, when the browser application interface 10 is displayed, if the user needs to reply to the conversation message, the user can click on the personalized reply identifier 124 to allow the phone to jump to the conversation interface 13 corresponding to the contact Xiaohong. The conversation interface 13 displays the conversation message "Want to have dinner together tomorrow night?". Furthermore, the phone can generate two texts in the background based on the conversation message "Want to have dinner together tomorrow night?", the dialogue reply scenario corresponding to the personalized reply control 124, and the writing style, writing habits, and schedule corresponding to the dialogue reply scenario: "Okay, I'm busy during the day, but I'm free in the evening" and "I'm free anytime after 4:30, depending on your time". The text identifiers of these two texts are displayed in the input method interface 14 in the conversation interface 13. The text identifiers of the two texts in Figure 5A are "Okay, I'm busy during the day, but I'm free in the evening" and "I'm free anytime after 4:30, depending on your time". The message "Anytime is fine, depending on your time" indicates availability. Then, the user can click to input the second text tag, "Okay, I'm busy during the day, but free in the evening." This allows the phone to display a prompt message "Personalized content creation is complete, do you want to publish directly?", a confirmation control 15, and a negation control 16 in the conversation interface 13. If the user clicks the confirmation control, as shown in Figure 5B, the phone can send "Okay, I'm busy during the day, but free in the evening" to the contact Xiaohong and display it in the message display area 17 of the conversation interface 13. If the user clicks the negation control 16, the phone can interact with the input method service using the model interface to perform text data transmission operations, as shown in Figure 5C. The phone can then insert the text "Okay, I'm busy during the day, but free in the evening" into the currently active input box 18 of the input method for further modification by the user.

[0100] In the text generation method provided in this application embodiment, a first interface is displayed, which includes at least one text generation control and first information; then, a first input is received to the first text generation control in the at least one text generation control; finally, in response to the first input, first text is generated based on the first information and the text generation scenario corresponding to the first text generation control, and the first text is displayed in the second interface corresponding to the first text generation control. In this solution, since the first interface includes at least one text generation control, and each text generation control can correspond to a text generation scenario, the user inputs the first text generation identifier, so that the electronic device can directly generate the first text based on the first information and the text generation scenario corresponding to the first text generation control, and display the first text in the second interface corresponding to the first text generation control, without the user manually inputting the required text, reducing the steps of text generation, thereby improving the efficiency of text generation; moreover, since the first text is generated based on the first information and the text generation scenario corresponding to the first text generation control, the first text can better match the current usage scenario, meet the user's personalized needs, and thus improve the accuracy of text generation; thus, while improving the efficiency of text generation by the electronic device, the accuracy of text generation by the electronic device is also improved.

[0101] Optionally, in this embodiment of the application, the text generation scenario indicated by the first text generation control is a conversational text generation scenario, and the second interface is a conversational interface.

[0102] Optionally, in this embodiment, the aforementioned chat interface can be a private chat interface or a group chat interface. The specific interface can be determined based on actual usage needs, and this embodiment does not impose any limitations.

[0103] For example, before generating the first text in the "text generation scenario corresponding to the first information and the first text generation control" in step 203 above, the text generation method provided in this application embodiment further includes the following step 501; and the "text generation scenario corresponding to the first information and the first text generation control" in step 203 above can be specifically implemented through the following step 203a.

[0104] Step 501: The electronic device displays the session interface.

[0105] In this embodiment of the application, the above-mentioned session interface includes session messages.

[0106] Optionally, in this embodiment of the application, the aforementioned session message can be one or more.

[0107] Optionally, in this embodiment of the application, the aforementioned session messages may include historical session messages corresponding to the session interface.

[0108] Optionally, in this embodiment, the aforementioned conversation messages may include at least one of the following: text, images, video, audio, emoticons, and symbols. The specific message type can be determined based on actual usage requirements, and this embodiment does not impose any limitations.

[0109] In this embodiment of the application, the electronic device can jump from the first interface to the conversation interface based on the user's first input to the personalized reply control.

[0110] Step 203a: The electronic device generates first text based on the first information, the conversation text generation scenario, and the conversation message.

[0111] Optionally, in this embodiment of the application, the electronic device may display the first text in the text selection area of ​​the session interface.

[0112] Optionally, in this embodiment of the application, the text selection area can be a preset area in the conversation interface; or the text selection area can be the area corresponding to the input method interface in the conversation interface, that is, the first text can be displayed in the input method interface.

[0113] Optionally, in this embodiment of the application, the electronic device can display the first text in the conversation interface via a pop-up window.

[0114] Optionally, in this embodiment of the application, the electronic device can send the first text to the contact corresponding to the conversation interface by the user's input of the first text, and display the first text in the text display area of ​​the conversation interface.

[0115] It is understandable that the above text display area can be the session message display area.

[0116] Optionally, in this embodiment of the application, before sending the first text to the contact corresponding to the conversation interface, the electronic device may display a pop-up window indicating whether to send. If the user selects yes, the electronic device may call the send function to send the first text to the contact, saving the user manual input time. If the user selects no, the electronic device may interact with the input method service through the large language model interface to perform text data transmission operations and insert the first text into the currently active input box of the input method for further modification by the user.

[0117] It should be noted that the specific process can be found in the above embodiments, and will not be repeated here to avoid repetition.

[0118] Optionally, in this embodiment of the application, after the user modifies the first text, they can input the send control in the input method so that the electronic device can send the modified first text to the contact corresponding to the conversation interface.

[0119] In this embodiment, the electronic device can generate first text based on the conversation messages, first information, and conversation text generation scenario in the conversation interface, which can make the first text more in line with the current usage scenario, meet the user's personalized needs, and thus improve the accuracy of text generation.

[0120] Optionally, in this embodiment of the application, the text generation scenario indicated by the first text generation control is a text publishing scenario, and the second interface is a text publishing interface, which includes title text and body text.

[0121] In this embodiment of the application, the title text and body text described above can be used to represent the user's text generation intent.

[0122] It should be noted that the title text and body text mentioned above were entered by the user.

[0123] For example, before "generating the first text based on the first information and the text generation scenario corresponding to the first text generation control" in step 203 above, the text generation method provided in this application embodiment further includes the following steps 601 and 602; and the "generating the first text based on the first information and the text generation scenario corresponding to the first text generation control" in step 203 above can be specifically implemented through the following step 203b.

[0124] Step 601: The electronic device displays the text publishing interface.

[0125] In this embodiment of the application, the title text generation identifier and the body text generation identifier are displayed in the identifier selection area of ​​the above-mentioned text publishing interface.

[0126] Optionally, in this embodiment of the application, the above-mentioned identifier selection area can be a preset area in the text publishing interface; or, the above-mentioned identifier selection area can be the area corresponding to the input method interface, that is, the electronic device can display the title text generation identifier and the body text generation identifier in the input method interface.

[0127] Optionally, in this embodiment of the application, the electronic device can display the title text generation identifier and the body text generation identifier in the text publishing interface via a pop-up window.

[0128] Optionally, in this embodiment, the title text generation identifier can be any of the following: text identifier, image identifier, emoticon identifier, or special symbol identifier, etc. The specific identifier can be determined according to actual usage requirements, and this embodiment does not impose any limitations.

[0129] Optionally, in this embodiment, the aforementioned text generation identifier can be any of the following: text identifier, image identifier, emoticon identifier, or special symbol identifier, etc. The specific identifier can be determined according to actual usage requirements, and this embodiment does not impose any limitations.

[0130] Step 602: The electronic device receives a third input for the title text generation identifier and the body text generation identifier.

[0131] In this embodiment of the application, the third input is used to select the title text generation identifier and the body text generation identifier in the text publishing interface.

[0132] Optionally, in this embodiment, the third input includes, but is not limited to: the user clicking on the title text generation identifier and the body text generation identifier using a touch device such as a finger or stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment does not limit it.

[0133] For example, the third input mentioned above can be the user's click input for the title text generation identifier and the body text generation identifier.

[0134] Step 203b: The electronic device responds to the third input and generates the first text based on the title text, body text, published text generation scenario, and first information.

[0135] In this embodiment of the application, the electronic device can input the title text, body text, text generation scenario and first information into the first model, generate the first text through the first model, and display the first text in the text publishing interface.

[0136] Optionally, in this embodiment of the application, the text display area can be the editing display area in the text publishing interface; or, the text display area can be the text display area in the input method interface.

[0137] For example, the text display area mentioned above can be the title input box and the body input box in the text publishing interface.

[0138] Optionally, in this embodiment, the third input may include a first sub-input and a second sub-input. The user may input the title text generation identifier as the first sub-input, so that the electronic device may input the title text and the text generation scenario into the first model. Through the first model, the first sub-text corresponding to the title text is generated and displayed in the text publishing interface. Then, the user may input the body text generation identifier as the second sub-input, so that the electronic device may input the body text and the text generation scenario into the first model. Through the first model, the second sub-text corresponding to the body text is generated and displayed in the text publishing interface. The first text includes the first sub-text and the second sub-text.

[0139] Optionally, in the embodiments of this application, the aforementioned first sub-text can be one or more.

[0140] Optionally, in the embodiments of this application, the aforementioned second subtext can be one or more.

[0141] For example, referring to Figure 3C and as shown in Figure 6A, when the browser application interface 10 is displayed, if the user needs to post a message, the user can click the post text generation identifier 126 to input the text, so that the mobile phone can display the text posting interface 20. The text posting interface 20 includes the title text "A's Concert" and the body text "A's Concert". The text posting interface 20 also displays an input method interface 21, which includes a title generation identifier 22 and a body text generation identifier 23. The user can click the title generation identifier 22 to input the title text "A's Concert" and the text generation scenario into the first model, generate the title "Concert", and display it in the input method interface 21. Then, as shown in Figure 6B, the user can click the body text generation identifier 23 to input the body text "A's Concert" and the text generation scenario into the first model, generate the body text "A's Concert, Feel the Voice of Young People", and display the body text "A's Concert, Feel the Voice of Young People" in the input method interface 21.

[0142] Optionally, in this embodiment of the application, after generating the main text, the electronic device can add topic tags to the main text.

[0143] Optionally, in this embodiment, after generating the title text or body text, the electronic device can display the generated title text or body text in the input method interface. The user can input the generated title text or body text, so that the electronic device can display a pop-up window asking whether to modify it. If the user selects no, the electronic device can directly replace the generated title text or body text displayed in the text publishing interface with the generated title text or body text. If the user selects yes, the electronic device can display the generated title text or body text in the input box of the input method, and the user can modify the title text or body text and input the upload control in the input method, so that the electronic device can replace the generated title text or body text displayed in the text publishing interface with the generated title text or body text.

[0144] In this embodiment of the application, when the text publishing interface is displayed, the user can input the title text generation control and the body text generation control, so that the electronic device can generate the text corresponding to the title text and the text corresponding to the body text. This simplifies the text generation process of the electronic device without the need for multiple applications, thereby improving the efficiency of text generation by the electronic device.

[0145] Optionally, in this embodiment of the application, the electronic device can receive input from the user for the text generation identifier in the Moments section, thereby displaying the aforementioned text editing interface, which may include a fifth text and at least one image.

[0146] In this embodiment of the application, the fifth text mentioned above is input by the user, and the at least one image mentioned above is uploaded by the user.

[0147] In this embodiment of the application, the electronic device can input the fourth text, at least one image, the first information, and the Moments text generation scene corresponding to the Moments text generation identifier into the first model to generate the first text and display the first text in the text editing interface.

[0148] Optionally, in this embodiment, the electronic device can display the first text in the input method interface, where the user can input the first text. The electronic device can then display a publish control. If the user selects "yes," the electronic device can directly replace the fifth text in the text editing interface with the first text, package the first text and image data into a publishing unit, and transmit the packaged publishing unit to the server via a network call through the text editing interface, thereby publishing the content. If the user selects "no," the electronic device can display the first text in the input box of the input method control, where the user can modify the first text and input the publish control in the input method. The electronic device can then package the modified first text and image data into a publishing unit, transmit the packaged publishing unit to the server via a network call through the text publishing interface, thereby publishing the content.

[0149] For example, in conjunction with scenario 2 above, and as shown in Figure 3C and Figure 7A, when the browser application interface 10 is displayed, if the user needs to edit a Moments message, the user can click the Moments text generation identifier 125 to display the text editing interface 30 on the phone. This text editing interface 30 includes the fifth text "Watching B's concert" and a concert picture. The phone can input the first information, the fifth text "Watching B's concert", a concert picture, and the Moments text generation scenario into the first model to obtain two first texts: "I was fortunate enough to attend B's concert, and I was very excited" and "Let's rock with B, it's so wonderful!". These two first texts are displayed in the input method interface 31 of the text editing interface 30. Then, the user can click to input the text "Let's rock with B, it's so wonderful!". As shown in Figure 7B, the mobile phone can display a pop-up window 32 indicating whether to publish. This pop-up window 32 displays "Personalized content creation is complete, publish now?", as well as a confirmation control 33 and a rejection control 34. As shown in Figure 7C, if the user clicks the confirmation control 33, the mobile phone can package the first text and image data into a publishing unit, transmit it over the network through the text publishing interface, and send the packaged publishing unit to the server, thereby realizing the publication of the content. If the user clicks the rejection control 34, the mobile phone can display the first text in the input box for the user to modify. After the user has finished modifying, they can click the publish control of the input method, so that the mobile phone can package the modified first text and image data into a publishing unit, transmit it over the network through the text publishing interface, and send the packaged publishing unit to the server, thereby realizing the publication of the content.

[0150] In this embodiment of the application, when the text publishing interface is displayed, the user can directly input the text generation identifier in the text publishing interface so that the electronic device can generate the text required by the user, which simplifies the steps of text generation by the electronic device and improves the efficiency of text generation by the electronic device.

[0151] Optionally, in this embodiment of the application, the text generation scenario indicated by the first text generation control is an order evaluation text generation scenario, and the second interface is an order evaluation interface, which includes order evaluation information.

[0152] It should be noted that the order review information mentioned above was entered by the user.

[0153] Optionally, in this embodiment, the order evaluation information may include at least one of the following: text, images, videos, and emoticons. The specific details can be determined based on actual usage needs, and this embodiment does not impose any limitations.

[0154] For example, before "generating the first text based on the first information and the text generation scenario corresponding to the first text generation control" in step 203 above, the text generation method provided in this application embodiment further includes the following steps 701 and 702; and the "generating the first text based on the first information and the text generation scenario corresponding to the first text generation control" in step 203 above can be specifically implemented through the following step 203c.

[0155] Step 701: The electronic device displays the order evaluation interface.

[0156] In this embodiment of the application, at least one order evaluation identifier is displayed in the identifier selection area of ​​the order evaluation interface.

[0157] Optionally, in this embodiment of the application, the above-mentioned identifier selection area can be the area corresponding to the input method interface, that is, the above-mentioned at least one order evaluation identifier can be displayed in the input method interface; or, the above-mentioned identifier selection area can be a pop-up window.

[0158] Optionally, in this embodiment, each of the at least one order evaluation identifier can be a text identifier, an image identifier, an emoticon identifier, or a special symbol identifier, etc. The specific identifier can be determined according to actual usage requirements, and this embodiment does not impose any limitations.

[0159] For example, the above-mentioned at least one order rating identifier may include at least one of the following: positive rating identifier, neutral rating identifier, and negative rating identifier.

[0160] Step 702: The electronic device receives a fourth input for the first order evaluation identifier in at least one order evaluation identifier.

[0161] In this embodiment of the application, the fourth input is used to select a first order evaluation identifier from at least one order evaluation identifier.

[0162] Optionally, in this embodiment, the fourth input includes, but is not limited to: the user clicking on the first order evaluation mark using a touch device such as a finger or stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs. The specific input can be determined according to actual usage needs, and this embodiment does not limit it.

[0163] For example, the fourth input mentioned above can be the user's click input on the rating identifier of the first order.

[0164] Step 203c: The electronic device responds to the fourth input and generates the first text based on the order evaluation information, the evaluation information corresponding to the first order evaluation identifier, the order evaluation text generation scenario, and the first information.

[0165] In this embodiment of the application, the electronic device can input order evaluation information, evaluation information corresponding to the first order evaluation identifier, order evaluation text generation scenario and first information into the first model, generate the first text through the first model, and display the first text in the text display area of ​​the order evaluation interface.

[0166] Optionally, in this embodiment of the application, the text display area can be the area corresponding to the input method interface, that is, the first text can be displayed in the input method interface; or, the text display area can be a preset area in the order evaluation interface.

[0167] Optionally, in this embodiment of the application, the electronic device can display the first text in the order evaluation interface via a pop-up window.

[0168] Optionally, in this embodiment of the application, when the first text is displayed on the input method interface, the user can input the first text so that the electronic device can display a pop-up window indicating whether to publish. The pop-up window includes a confirm control and a negative control. If the user selects the confirm control, the electronic device can directly publish the first text on the order evaluation interface. If the user selects the negative control, the electronic device can display the first text in the input box of the input method control. The user can modify the first text and then input it into the publish control in the input method so that the electronic device can display the modified first text on the order evaluation interface.

[0169] For example, referring to Figure 3C and as shown in Figure 8A, when the browser application interface 10 is displayed, if a user reviews a store displayed in the browser application interface 10, the user can click to input the order review text generation identifier 127, so that the mobile phone can display the order evaluation interface 40 of the store. The order evaluation interface 40 displays the order store name "A-location specialty snack shop", the evaluation information "not delicious", and positive review identifier 41, neutral review identifier 42 and negative review identifier 43. The user can click the negative review identifier 43, as shown in Figure 8B. The electronic device can display two first texts in the input method interface 44. The two first texts are "Report food, don't come here, family members!" and "The quality needs improvement, please choose carefully." The user can then click to input the text "Report food, report food everywhere, don't come to my family!" as shown in Figure 8C. This will cause the phone to display a posting pop-up window 45 on the order review interface 40. The posting pop-up window 45 displays "Personalized content has been created, do you want to post it directly?", as well as a confirmation control 46 and a rejection control 47. If the user selects the confirmation control 46, the phone can directly post the selected text on the order review interface 40. If the user selects the rejection control 47, the electronic device can display the selected text in the input box of the input method control. The user can modify the selected text and then input it into the posting control in the input method so that the phone can display the modified text on the order review interface 40.

[0170] In this embodiment of the application, when the order evaluation interface is displayed, the electronic device can directly generate the first text of the user's needs based on the user's input, reducing the steps of text generation by the electronic device and thus improving the efficiency of text generation by the electronic device.

[0171] Optionally, in this embodiment of the application, the above-mentioned at least one text generation control is a first text generation control, which is used to indicate the text generation scenario corresponding to the first interface.

[0172] For example, referring to Figure 1 and as shown in Figure 9, the "displaying the first text in the second interface corresponding to the first text generation control" in step 203 above can be specifically implemented through step 801 below.

[0173] Step 801: The electronic device displays the first text on the first interface.

[0174] It is understandable that the first interface mentioned above can be the second interface.

[0175] Optionally, in this embodiment, the first interface can be any of the following: a conversation interface, a text posting interface, a text editing interface, or an order evaluation interface, etc. The specific interface can be determined according to actual usage needs, and this embodiment does not impose any limitations.

[0176] Optionally, in this embodiment, the first information may be a conversation message, edited text, an image, or evaluation information, etc. The specific details can be determined according to actual usage requirements, and this embodiment does not impose any limitations.

[0177] In this embodiment of the application, the electronic device can display the first text generation control corresponding to the first interface according to the interface type of the first interface.

[0178] For example, the electronic device can obtain the interface type of the first interface, and then determine the first text generation control according to the interface type of the first interface through a preset mapping table, and display the first text generation control in the input method interface.

[0179] Mapping table

[0180] It is understandable that if the first interface changes, the first text generation control in the input method interface will also change accordingly.

[0181] For example, when the first interface changes from a conversation interface to an order evaluation interface, the conversation reply text generation identifier in the input method interface will also change to an order evaluation text generation identifier. In other words, the electronic device can listen to window changes, automatically determine the current scene, and display the corresponding first text generation control according to the preset mapping table.

[0182] For example, as shown in FIG10A, when the mobile phone displays a conversation interface, the mobile phone can display a personalized reply control 124 in the input method interface 14 of the conversation interface 13; as shown in FIG10B, when the mobile phone displays a text posting interface 20, the mobile phone can display a text generation identifier 126 in the input method interface 21 of the text posting interface 20; as shown in FIG10C, when the mobile phone displays a text editing interface 30, the mobile phone can display a Moments text generation identifier 125 in the input method interface 32 of the text editing interface 30; as shown in FIG10D, when the mobile phone displays an order review interface 40, the mobile phone can display an order review text generation identifier 127 in the input method interface 44 of the order review interface 40.

[0183] In this embodiment of the application, when the first interface is the second interface, the electronic device can directly generate the first text based on the first information and the text generation scenario corresponding to the first text generation control.

[0184] It should be noted that the specific process of generating the first text in the first interface can be found in the above embodiments, and will not be repeated here to avoid repetition.

[0185] In this embodiment, since the first text is generated based on the first information and the text generation scenario corresponding to the first text generation control, the first text can better fit the current usage scenario to meet the user's personalized needs, thereby improving the accuracy of text generation.

[0186] Optionally, in this embodiment of the application, the step 203 above, "generating the first text based on the first information and the text generation scenario corresponding to the first text generation control", can be specifically implemented through the following steps 901 to 903.

[0187] Step 901: The electronic device inputs the first information and the text generation scenario into the first model, and performs semantic parsing on the first information through the first model to determine the text generation intent.

[0188] In this embodiment of the application, the electronic device performs vectorization processing on the first information and the text generation scenario respectively through the encoder in the first model to generate a vector that can represent the deep semantics of the text, and then determines the text generation intention through the vector.

[0189] Optionally, in this embodiment of the application, the first model mentioned above may be a model stored in a server; or the first model mentioned above may be a model stored in an electronic device, wherein the model structure of the model stored in the electronic device is different from the model structure of the model stored in the server.

[0190] Optionally, in this embodiment of the application, the electronic device can display a model selection interface, which includes a first control and a second control. The first control is used to indicate the model stored in the server, and the second control is used to indicate the model stored in the electronic device. The user can make selection inputs to the first control or the second control so that the electronic device can determine to use the model stored in the server as the first model; or use the model stored in the electronic device as the first model.

[0191] Optionally, in this embodiment of the application, when the electronic device determines to use the model stored in the electronic device, the electronic device may request the user to authorize access to personal information including location, chat history, schedule, etc., as well as information of the currently running application, i.e., the first profile information as described below, through a pop-up window.

[0192] Step 902: The electronic device determines the text style feature information that matches the text generation scenario based on the text generation scenario.

[0193] In this embodiment of the application, the electronic device can determine the text style feature information that matches the text generation scenario by using the first relationship stored in the first model and the text generation scenario.

[0194] For example, when the above text generation scenario is a conversation scenario, the first model can determine the text style feature information corresponding to the conversation scenario as: brief and lively through the first relation; when the above text generation scenario is a text editing scenario, the first model can determine the text style feature information corresponding to the text editing scenario as: detailed and lively through the first relation; when the above text generation scenario is an order evaluation scenario, the first model can determine the text style feature information corresponding to the order evaluation scenario as: brief and serious through the first relation.

[0195] Step 903: The electronic device generates the first text based on the text generation intent, text style feature information, and first profile information.

[0196] In this embodiment of the application, the first profile information includes user attribute information and user behavior information, and the first model is trained based on the profile information.

[0197] Optionally, in this embodiment, the aforementioned user attribute information may include at least one of the following: age, gender, region, interests and preferences, and consumption habits. The specific details can be determined based on actual usage needs, and this embodiment does not impose any limitations.

[0198] Optionally, in this embodiment, the aforementioned user behavior information may include at least one of the following: schedule information, browsing information in the application, location information, purchase records, search history, etc. The specific details can be determined based on actual usage needs, and this embodiment does not impose any limitations.

[0199] In this embodiment, the electronic device can generate first text with specific individual characteristics and in line with user needs through a first model trained based on profile information, thereby satisfying the user's personalized needs and improving the flexibility of the electronic device in generating text.

[0200] Optionally, in the embodiments of this application, the text generation method provided in the embodiments of this application further includes the following steps 1001 to 1003.

[0201] Step 1001: The electronic device uses the initial model to predict the text based on the second profile information and the text training samples to obtain the third text.

[0202] Optionally, in this embodiment of the application, the second profile information may include user attribute information and user behavior information.

[0203] Optionally, in this embodiment of the application, the electronic device can obtain the second profile information through the personalized instruction template in the initial model.

[0204] For example, when the initial model is a model in the server, since the server cannot obtain user privacy data, it first randomly generates batches of user age, gender, occupation, high-frequency sentences and daily text information. With the help of the summarization capability of the initial model, it constructs a personalized template for full fine-tuning of the server. The content in the personalized template is the second profile information mentioned above.

[0205] For example, when the initial model is a model in an electronic device, high-frequency words and phrases in the dialogue data are obtained based on the TF-IDF algorithm, and schedule information is extracted using a model with information extraction capabilities. Finally, leveraging the summarizing capabilities of the initial model, a personalized instruction template is generated, and the content of this personalized template is the aforementioned second profile information.

[0206] Optionally, in this embodiment of the application, after the electronic device obtains the second portrait information, the electronic device can perform prefix optimization processing on the second portrait information to obtain the vector corresponding to the second portrait information; then, the electronic device can input the second portrait information, the vector corresponding to the second portrait information, and the text training sample into the initial model to perform text prediction and obtain the fourth text.

[0207] It should be noted that, in order to enhance the model's understanding of the user's personalized style, the electronic device learns the user's personalized style vector through prefix tuning, and uses it as part of the input to train the model, thereby enhancing the model's perception of personalized information.

[0208] For example, as shown in Figure 11, taking the second profile information as "the user is a stay-at-home mom who loves taking photos and has a puppy", the encoder 50 encodes the second profile information to obtain an encoded vector. This encoded vector is then input into the pooling layer 51 to perform three-stage pooling to obtain the pooling result. The pooling result is then input into the linear layer 52 to normalize the pooling result, obtaining the vector corresponding to the second profile information. The vector corresponding to the second profile information is then concatenated with the text training sample and input into the initial model 53 to predict the sixth text. The electronic device updates the encoder weights based on the cross-entropy loss between the sixth text and the reference text.

[0209] It should be noted that the purpose of this stage is to obtain the user's high-dimensional representation information from the hidden space, and this high-dimensional representation information is highly related to the response task.

[0210] Optionally, in this embodiment of the application, the electronic device can input the second profile information, the vector corresponding to the second profile information, the task template and the text training sample into the initial model to predict the fourth text.

[0211] For example, referring to Figure 11 and as shown in Figure 12, when the initial model is a model in the server, the model structure of the initial model 53 may include an input layer 54, a multi-head attention layer 55, a first summation layer normalization 56, a feedforward network layer 57, a second summation layer normalization 58, and an output layer 59. The electronic device can input the second profile information, the vector corresponding to the second profile information, the task template, and the text training samples into the input layer 54 of the initial model. This input layer concatenates the second profile information, the vector corresponding to the second profile information, the task template, and the text training samples to obtain a first vector. The first vector is then input into the multi-head attention layer 55 and the first summation layer normalization 56 respectively to obtain a normalized first vector. The normalized first vector is then input into the feedforward network layer 57 and the second summation layer normalization 58, and finally outputs the fourth text through the output layer 59.

[0212] For example, referring to Figure 12 and as shown in Figure 13, when the initial model is a model in an electronic device, the model structure of the initial model 60 may include an input layer 61, a multi-head attention layer 62, a first summation layer normalization 63, a feedforward network layer 64, a gating system 65, a fixed attribute expert layer 66, a variable attribute expert layer 67, a second summation layer normalization 68, and an output layer 69; wherein, the electronic device can input the second profile information, the vector corresponding to the second profile information, the task template, and the text training samples into the input layer 61 of the initial model, and the input layer 61 will input the second profile information, the vector corresponding to the second profile information, the task template, and the text training samples into the input layer 61 of the initial model. The second profile information, the corresponding vector, the task template, and the text training samples are concatenated to obtain a first vector. This first vector is then input into a multi-head attention layer 62 and a first summation layer normalization layer 63 to obtain a normalized first vector. The normalized first vector is then input into a feedforward network layer 64, a second summation layer normalization layer 68, and a gating system 65. The gating system 65 inputs the fixed attributes of the normalized first vector into a fixed attribute expert layer 66 and the variable attributes into a variable attribute expert layer 67. Finally, the first model... The second vector is obtained and input into the second summation and normalization layer 68. The fourth text is then output through the output layer 69. Let W0 be the weights of the initial model, and H be the second vector. in Let G be the normalized first vector, G be the gating function, and E be the attribute expert layer.

[0213] For example, the aforementioned fixed-attribute expert layer can be represented as ΔWE1 =B1A1, the aforementioned fixed attribute expert layer can be characterized as ΔW E2 =B2A2.

[0214] Optionally, in this embodiment, the fixed attributes include at least one of the following: age, occupation, and gender. The fixed attribute expert layer is used to control text style features.

[0215] Optionally, in this embodiment, the variable attributes include at least one of the following: schedule information, purchase records, search history, etc. The variable attribute expert layer is used to control the characteristics of the response content.

[0216] Step 1002: The electronic device performs cross-entropy calculation on the third text and the reference text to calculate the loss value.

[0217] Optionally, in this embodiment of the application, the electronic device may perform text semantic inspection processing between the fourth text and the reference text to determine the difference between the fourth text and the reference text, and obtain the above-mentioned loss value based on the difference.

[0218] Step 1003: The electronic device updates the model parameters of the initial model based on the loss value to obtain the first model.

[0219] Optionally, in this embodiment of the application, when the initial model is a model stored in the server, the electronic device can update the model parameters of the initial model through backpropagation based on the loss value to obtain the first model.

[0220] Optionally, in this embodiment of the application, when the initial model is a model stored in an electronic device, the electronic device can update only the model parameters of the fixed attribute expert layer and the variable attribute expert layer in the initial model through backpropagation based on the loss value to obtain the first model.

[0221] It should be noted that, in the case where the initial model is a model stored in an electronic device, and considering that the second profile information is updated and accumulated in real time, the above update behavior is also performed periodically.

[0222] Optionally, in this embodiment, during the content creation process using the model stored in the electronic device, the electronic device can continuously collect user feedback on the content generated by the model. By using the Direct Preference Optimization (DPO) algorithm and incorporating user evaluation criteria, the model can learn to perform behaviors that are perceived as more reasonable or ideal by the user. Specifically, the generated results selected by the user are used as positive samples xtrue, and the unselected content is used as negative samples xtalse, constructing a preference dataset Dpre. Using the DPO algorithm, the collected user feedback is integrated into the training process, enabling the model to learn user preference patterns, provide more accurate content recommendations that better meet the user's personalized needs, enhance user experience, and increase user stickiness.

[0223] For example, when providing users with text creation results in a text editing scenario, two different pieces of content are output under the recommended tone: "Who is so lucky! They got a ticket to A"; "Singing with A together, so touching." The former has a more mature and stable tone, while the latter is more lively and cute. When the user selects the last result, the model will accumulate this selection behavior in the preference database and gradually learn the exclusive style pattern.

[0224] It should be noted that the execution timing of steps 1001 to 1003 can be before step 201 or before step 203, and the specific implementation of this application does not impose any restrictions. For example, the execution timing of steps 1001 to 1003 can be before step 201.

[0225] In this embodiment, the electronic device constructs personalized instruction hard and soft templates by combining user profile data within the device and performs periodic preference fine-tuning, thereby generating text creation results that better match the user's personalized characteristics. Simultaneously, user privacy data, including personalized prompts, is not uploaded to the cloud, greatly enhancing data localization and privacy security, and simplifying the process reduces the burden of edge-side training and inference.

[0226] As exemplarily shown in Figure 14, the model training process provided in this application embodiment will be explained in detail below through specific examples. Specifically, it may include the implementation of steps 71 to 77 described below.

[0227] Step 71: The electronic device generates personalized instruction hard prompts.

[0228] Step 72: Train personalized instruction software prompts on electronic devices.

[0229] In this embodiment, the aforementioned training personalized instruction soft prompt refers to the prefix optimization processing of the second profile information in the above embodiment.

[0230] Step 73: Perform full fine-tuning of the electronic device in the cloud.

[0231] Step 74: The electronic device determines whether user information can be authorized for access.

[0232] In this embodiment of the application, if possible, the electronic device proceeds to step 75; if not, the electronic device proceeds to step 76.

[0233] Step 75: The electronic device performs hybrid LoRa expert fine-tuning on the model in the electronic device.

[0234] In this embodiment, the hybrid LoRa expert refers to the fixed attribute expert layer and the variable attribute expert layer in the above embodiment.

[0235] Step 76: The electronic device generates text using the model within the electronic device.

[0236] Step 77: The electronic device performs preference optimization training.

[0237] In this embodiment, the electronic device constructs personalized instruction hard and soft templates by combining user profile data within the device and performs periodic preference fine-tuning, thereby generating text creation results that better match the user's personalized characteristics. Simultaneously, user privacy data, including personalized prompts, is not uploaded to the cloud, greatly enhancing data localization and privacy security, and simplifying the process reduces the burden of edge-side training and inference.

[0238] Figure 15 shows a possible structural schematic diagram of the text generation device involved in an embodiment of this application. As shown in Figure 15, the text generation device 80 may include: a display module 81, a receiving module 82, and a generation module 83.

[0239] The display module 81 is used to display a first interface, which includes at least one text generation control and first information. The receiving module 82 is used to receive a first input to the first text generation control. The generation module 83 is used to generate first text based on the first information and the text generation scenario corresponding to the first text generation control, in response to the first input received by the receiving module 82. The display module 82 is also used to display the first text in a second interface corresponding to the first text generation control.

[0240] In one possible implementation, the at least one text generation control is a first text generation control, which is used to indicate the text generation scenario corresponding to the first interface. The display module 81 is specifically used to display the first text on the first interface.

[0241] In one possible implementation, the text generation scenario indicated by the first text generation control is a conversational text generation scenario, and the second interface is a conversational interface. The display module 81 is further configured to display the conversational interface, which includes conversational messages, before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control. The generation module 83 is specifically configured to generate the first text based on the first information, the conversational text generation scenario, and the conversational messages.

[0242] In one possible implementation, the text generation scenario indicated by the first text generation control is a published text generation scenario, and the second interface is a text publishing interface, which includes title text and body text. The display module 81 is further configured to display the text publishing interface before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control. The title text generation identifier and body text generation identifier are displayed in the identifier selection area of ​​the text publishing interface. The receiving module 82 is further configured to receive a third input for the title text generation identifier and body text generation identifier. The generation module 83 is specifically configured to generate the first text based on the title text, body text, published text generation scenario, and first information in response to the third input received by the receiving module 82.

[0243] In one possible implementation, the text generation scenario indicated by the first text generation control is an order review text generation scenario, and the second interface is an order review interface, which includes order review information. The display module 81 is further configured to display the order review interface before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control. At least one order review identifier is displayed in the identifier selection area of ​​the order review interface. The receiving module 82 is further configured to receive a fourth input for the first order review identifier among the at least one order review identifier. The generation module 83 is specifically configured to generate the first text in response to the fourth input, based on the order review information, the review information corresponding to the first order review identifier, the order review text generation scenario, and the first information.

[0244] In one possible implementation, the first text includes at least one text displayed in a text selection area of ​​the second interface. The receiving module 82 is further configured to receive a fifth input for a second text among the at least one text after the display module displays the first text. The display module 81 is further configured to display the second text in a text display area of ​​the second interface in response to the fifth input received by the receiving module 82.

[0245] In one possible implementation, the receiving module 82 is further configured to receive a sixth input to the first interface after the display module displays the first interface. The display module 81 is further configured to display an input method interface, which includes at least one text generation control, in response to the sixth input received by the receiving module 82.

[0246] In one possible implementation, the aforementioned generation module 83 is specifically used to input the first information and the text generation scenario into the first model, perform semantic parsing on the first information through the first model to determine the text generation intent; and determine the text style feature information matching the text generation scenario based on the text generation scenario; and generate the first text based on the text generation intent, the text style feature information, and the first profile information; wherein the first profile information includes user attribute information and user behavior information, and the first model is trained based on the profile information.

[0247] In one possible implementation, the text generation apparatus 80 provided in the above embodiments of this application further includes a prediction module, a processing module, and an update module. The prediction module is used to predict text based on the second profile information and text training samples using an initial model to obtain a third text. The processing module is used to perform cross-entropy calculation on the third text and the reference text to calculate a loss value. The update module is used to update the model parameters of the initial model based on the loss value to obtain a first model.

[0248] This application provides a text generation device. Since the first interface includes at least one text generation control, and each control corresponds to a text generation scenario, the user inputs a first text generation identifier. This allows the device to directly generate first text based on first information and the corresponding text generation scenario, and display the first text on the second interface corresponding to the control. This eliminates the need for the user to manually input the desired text, reducing the steps involved and improving efficiency. Furthermore, because the first text is generated based on the first information and the corresponding scenario, it better suits the current usage scenario, meeting the user's personalized needs and improving accuracy. Thus, while improving efficiency, the device also enhances the accuracy of text generation.

[0249] The text generation device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, a mobile electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0250] The text generation device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0251] The text generation apparatus provided in this application embodiment can implement all the processes implemented in the above method embodiments, and will not be described again here to avoid repetition.

[0252] Optionally, as shown in FIG16, this application embodiment also provides an electronic device 90, including a processor 91 and a memory 92. The memory 92 stores a program or instructions that can run on the processor 91. When the program or instructions are executed by the processor 91, they implement the various steps of the above-described text generation method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0253] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0254] Figure 17 is a schematic diagram of the hardware structure of an electronic device that implements an embodiment of this application.

[0255] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.

[0256] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for powering various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in Figure 17 does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0257] The display unit 106 is used to display a first interface, which includes at least one text generation control and first information. The user input unit 107 is used to receive a first input to the first text generation control among the at least one text generation control. The processor 110 is used to generate first text in response to the first input, based on the first information and the text generation scenario corresponding to the first text generation control. The display unit 106 is also used to display the first text in a second interface corresponding to the first text generation control.

[0258] Optionally, in this embodiment, the at least one text generation control is a first text generation control, which is used to indicate the text generation scenario corresponding to the first interface. The display unit 106 is specifically used to display the first text on the first interface.

[0259] Optionally, in this embodiment, the text generation scenario indicated by the first text generation control is a conversational text generation scenario, and the second interface is a conversational interface. The display unit 106 is further configured to display the conversational interface, which includes conversational messages, before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control. The processor 110 is specifically configured to generate the first text based on the first information, the conversational text generation scenario, and the conversational messages.

[0260] Optionally, in this embodiment, the text generation scenario indicated by the first text generation control is a published text generation scenario, and the second interface is a text publishing interface, which includes title text and body text. The display unit 106 is further configured to display the text publishing interface before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control. The title text generation identifier and body text generation identifier are displayed in the identifier selection area of ​​the text publishing interface. The user input unit 107 is further configured to receive a third input regarding the title text generation identifier and body text generation identifier. The processor 110 is specifically configured to generate the first text in response to the third input, based on the title text, body text, published text generation scenario, and first information.

[0261] Optionally, in this embodiment, the text generation scenario indicated by the first text generation control is an order review text generation scenario, and the second interface is an order review interface, which includes order review information. The display unit 106 is further configured to display the order review interface before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control. At least one order review identifier is displayed in the identifier selection area of ​​the order review interface. The user input unit 107 is further configured to receive a fourth input for the first order review identifier among the at least one order review identifier. The processor 110 is specifically configured to generate the first text in response to the fourth input, based on the order review information, the review information corresponding to the first order review identifier, the order review text generation scenario, and the first information.

[0262] Optionally, in this embodiment of the application, the first text includes at least one text, which is displayed in the text selection area of ​​the second interface. The user input unit 107 is further configured to receive a fifth input for a second text among the at least one text after displaying the first text. The display unit 106 is further configured to display the second text in the text display area of ​​the second interface in response to the fifth input.

[0263] Optionally, in this embodiment, the user input unit 107 is further configured to receive a sixth input to the first interface after the first interface has been displayed. The display unit 106 is further configured to display an input method interface in response to the sixth input, the input method interface including at least one text generation control.

[0264] Optionally, in this embodiment of the application, the processor 110 is specifically used to input the first information and the text generation scenario into the first model, perform semantic parsing on the first information through the first model to determine the text generation intent; and determine the text style feature information matching the text generation scenario based on the text generation scenario; and generate the first text based on the text generation intent, the text style feature information and the first profile information; wherein the first profile information includes user attribute information and user behavior information, and the first model is trained based on the profile information.

[0265] Optionally, in this embodiment of the application, the processor 110 is further configured to perform text prediction based on the second portrait information and text training samples using an initial model to obtain a third text; and to perform cross-entropy calculation on the third text and the reference text to calculate a loss value; and to update the model parameters of the initial model based on the loss value to obtain a first model.

[0266] This application provides an electronic device. Since the first interface includes at least one text generation control, and each text generation control corresponds to a text generation scenario, the user inputs a first text generation identifier, allowing the electronic device to directly generate first text based on first information and the text generation scenario corresponding to the first text generation control. The first text is then displayed on the second interface corresponding to the first text generation control, eliminating the need for the user to manually input the desired text, reducing the steps involved in text generation, and thus improving efficiency. Furthermore, since the first text is generated based on the first information and the text generation scenario corresponding to the first text generation control, it is more suitable for the current usage scenario, meeting the user's personalized needs and improving accuracy. Thus, while improving efficiency, the accuracy of text generation is also enhanced.

[0267] The electronic device provided in this application embodiment can implement the various processes implemented in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0268] For details on the beneficial effects of the various implementation methods in this embodiment, please refer to the beneficial effects of the corresponding implementation methods in the above method embodiments. To avoid repetition, these will not be repeated here.

[0269] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0270] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0271] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.

[0272] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0273] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0274] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0275] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0276] This application provides a computer program product that is stored in a storage medium and executed by at least one processor to implement the various processes of the text generation method embodiments described above, and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0277] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0278] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0279] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A text generation method, the method comprising: Display a first interface, which includes at least one text generation control and first information; Receive a first input to the first text generation control in the at least one text generation control; In response to the first input, based on the first information and the text generation scenario corresponding to the first text generation control, the first text is generated and displayed in the second interface corresponding to the first text generation control.

2. The method according to claim 1, wherein, The at least one text generation control is the first text generation control, which is used to indicate the text generation scenario corresponding to the first interface. Displaying the first text in the second interface corresponding to the first text generation control includes: The first text is displayed on the first interface.

3. The method according to claim 1, wherein, The text generation scenario indicated by the first text generation control is a conversational text generation scenario, and the second interface is a conversational interface; Before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control, the method further includes: The session interface is displayed, and the session interface includes session messages; The step of generating the first text based on the first information and the text generation scenario corresponding to the first text generation control includes: Based on the first information, the conversation text generation scenario, and the conversation message, the first text is generated.

4. The method according to claim 1, wherein, The first text generation control indicates a text generation scenario for publishing text, and the second interface is a text publishing interface, which includes title text and body text. Before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control, the method further includes: The text publishing interface is displayed, and the title text generation identifier and the body text generation identifier are displayed in the identifier selection area of ​​the text publishing interface; Receive a third input for the title text generation identifier and the body text generation identifier; The step of generating the first text based on the first information and the text generation scenario corresponding to the first text generation control includes: In response to the third input, the first text is generated based on the title text, the body text, the published text generation scenario, and the first information.

5. The method according to claim 1, wherein, The first text generation control indicates an order review text generation scenario, and the second interface is an order review interface, which includes order review information; Before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control, the method further includes: The order evaluation interface is displayed, and at least one order evaluation icon is displayed in the icon selection area of ​​the order evaluation interface. Receive a fourth input for the first order evaluation identifier in the at least one order evaluation identifier; The step of generating the first text based on the first information and the text generation scenario corresponding to the first text generation control includes: In response to the fourth input, the first text is generated based on the order evaluation information, the evaluation information corresponding to the first order evaluation identifier, the order evaluation text generation scenario, and the first information.

6. The method according to any one of claims 1 to 5, wherein, The first text includes at least one text, which is displayed in the text selection area of ​​the second interface; After displaying the first text, the method further includes: Receive a fifth input for the second text in the at least one text; In response to the fifth input, the second text is displayed in the text display area of ​​the second interface.

7. The method according to claim 1, wherein, After displaying the first interface, the method further includes: Receive the sixth input to the first interface; In response to the sixth input, an input method interface is displayed, the input method interface including the at least one text generation control.

8. The method according to claim 1, wherein, The step of generating the first text based on the first information and the text generation scenario corresponding to the first text generation control includes: The first information and the text generation scenario are input into the first model, and the first model performs semantic parsing on the first information to determine the text generation intent; Based on the text generation scenario, determine the text style feature information that matches the text generation scenario; The first text is generated based on the text generation intent, the text style feature information, and the first profile information; The first profile information includes user attribute information and user behavior information, and the first model is trained based on the profile information.

9. The method according to claim 8, wherein, The method further includes: Using the initial model, text prediction is performed based on the second profile information and text training samples to obtain the third text; Perform cross-entropy calculation on the third text and the reference text to calculate the loss value; Based on the loss value, the model parameters of the initial model are updated to obtain the first model.

10. A text generation apparatus, the text generation apparatus comprising: Display module, receiving module, and generating module; The display module is used to display a first interface, which includes at least one text generation control and first information; The receiving module is used to receive a first input to the first text generation control in the at least one text generation control; The generation module is used to generate first text in response to the first input received by the receiving module, based on the first information and the text generation scenario corresponding to the first text generation control; The display module is also used to display the first text in the second interface corresponding to the first text generation control.

11. The apparatus according to claim 10, wherein, The at least one text generation control is the first text generation control, which is used to indicate the text generation scenario corresponding to the first interface. The display module is specifically used to display the first text in the first interface.

12. The apparatus according to claim 10, wherein, The text generation scenario indicated by the first text generation control is a conversational text generation scenario, and the second interface is a conversational interface; The display module is also used to display the conversation interface before generating the first text in the text generation scenario based on the first information and the first text generation control, the conversation interface including conversation messages; The generation module is specifically used to generate first text based on the first information, the conversation text generation scenario, and the conversation message.

13. The apparatus according to claim 10, wherein, The first text generation control indicates a text generation scenario for publishing text, and the second interface is a text publishing interface, which includes title text and body text. The display module is also used to display a text publishing interface before generating the first text in the text generation scenario corresponding to the first information and the first text generation control. The text publishing interface displays a title text generation identifier and a body text generation identifier in the identifier selection area. The receiving module is further configured to receive a third input for the title text generation identifier and the body text generation identifier; The generation module is specifically used to generate the first text in response to the third input received by the receiving module, based on the title text, the body text, the published text generation scenario, and the first information.

14. The apparatus according to claim 10, wherein, The first text generation control indicates an order review text generation scenario, and the second interface is an order review interface, which includes order review information; The display module is also used to display an order evaluation interface before generating the first text in the text generation scenario based on the first information and the first text generation control, wherein at least one order evaluation identifier is displayed in the identifier selection area of ​​the order evaluation interface; The receiving module is further configured to receive a fourth input for the first order evaluation identifier in the at least one order evaluation identifier; The generation module is specifically used to generate the first text in response to the fourth input, based on the order evaluation information, the evaluation information corresponding to the first order evaluation identifier, the order evaluation text generation scenario, and the first information.

15. The apparatus according to any one of claims 10 to 14, wherein, The first text includes at least one text, which is displayed in the text selection area of ​​the second interface; The receiving module is further configured to receive a fifth input on the second text of the at least one text after the display module displays the first text; The display module is further configured to display the second text in the text display area of ​​the second interface in response to the fifth input received by the receiving module.

16. The apparatus according to claim 10, wherein, The receiving module is also used to receive a sixth input to the first interface after the display module displays the first interface; The display module is further configured to display an input method interface in response to the sixth input received by the receiving module, the input method interface including the at least one text generation control.

17. The apparatus according to claim 10, wherein, The generation module is specifically used to input the first information and the text generation scenario into the first model, and to perform semantic parsing on the first information through the first model to determine the text generation intent; Based on the text generation scenario, determine the text style feature information that matches the text generation scenario; The first text is generated based on the text generation intent, the text style feature information, and the first profile information; wherein the first profile information includes user attribute information and user behavior information, and the first model is trained based on the profile information.

18. The apparatus according to claim 17, wherein, The text generation device further includes a prediction module, a processing module, and an update module; The prediction module is used to predict the third text based on the second profile information and text training samples using the initial model. The processing module is used to perform cross-entropy calculation on the third text and the reference text to calculate the loss value; The update module is used to update the model parameters of the initial model based on the loss value to obtain the first model.

19. An electronic device comprising a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the text generation method as claimed in any one of claims 1 to 9.

20. A readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the text generation method as described in any one of claims 1 to 9.

21. A computer program product stored in a storage medium, wherein the computer program product, when executed by at least one processor, implements the text generation method as described in any one of claims 1 to 9.