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

By providing text generation controls and scenes in the interface of an electronic device, users can directly generate and display text that meets specific scenes, solving the problem of single and boring generation of text content in the prior art, and improving the efficiency and accuracy of text generation.

CN120010707APending Publication Date: 2025-05-16VIVO MOBILE COMM CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510184826.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

Existing large language models focus on general writing guidance when generating text, resulting in the generated text content being single and boring, making it difficult to meet the actual needs of users, and thus affecting the accuracy of generated text.

Method used

By providing text generation controls and corresponding text generation scenes in the interface of the electronic device, the user can directly input relevant information and select scenes. The electronic device generates corresponding text based on this and displays it in the corresponding interface.

Benefits of technology

The text generation process is simplified, the efficiency and accuracy of text generation are improved, and the personalized needs of users can be better met.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120010707A_ABST
    Figure CN120010707A_ABST
Patent Text Reader

Abstract

The invention discloses a text generation method and device, electronic equipment, a storage medium and a program product, and belongs to the technical field of artificial intelligence. The method comprises the steps of displaying a first interface, wherein the first interface comprises at least one text generation control and first information; receiving a first input for a first text generation control in the at least one text generation control; and in response to the first input, generating a first text based on the first information and a text generation scene corresponding to the first text generation control, and displaying the first text in a second interface corresponding to the first text generation control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and specifically relates to a text generation method, device, electronic device, storage medium and program product. Background Art

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

[0003] In the prior art, if a user needs to enter a text in a certain application interface, the user can enter 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 a certain application interface.

[0004] However, large language models in the prior art usually focus on providing general writing guidance, resulting in the text content generated by electronic devices being often monotonous and boring, and difficult to meet the actual needs of users. Therefore, users may modify the text content generated by electronic devices, resulting in poor accuracy of the text generated by electronic devices. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a text generation method, device, electronic device, storage medium and program product, which can simplify the text generation process and thus improve the efficiency of electronic equipment in generating text.

[0006] In a first aspect, an embodiment of the present application provides 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 a first text generation control among the at least one text generation control; in response to the first input, generating a 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.

[0007] In a second aspect, an embodiment of the present application provides a text generation device, which includes: a display module, a receiving module and a generating module. The display module is used to display a first interface, which includes at least one text generation control and a first information. The receiving module is used to receive a first input to a first text generation control in at least one text generation control. The generating module is used to generate a first text based on the first information and the text generation scene corresponding to the first text generation control in response to the first input received by the receiving module. The display module is also used to display the first text in a second interface corresponding to the first text generation control.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0009] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0010] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0011] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.

[0012] In an embodiment of the present application, a first interface is displayed, which includes at least one text generation control and a first information; then, a first input to a first text generation control in at least one text generation control is received; finally, in response to the first input, a first text is generated based on the first information and the text generation scene 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 scheme, since the first interface includes at least one text generation control, each text generation control can correspond to a text generation scene, so the user inputs the first text generation identifier so that the electronic device can directly generate the first text according to the first information and the text generation scene 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; and, since the first text is generated according to the text generation scene corresponding to the first information and the first text generation control, the first text can be more in line with the current usage scenario to meet the personalized needs of the user, thereby improving the accuracy of text generation; in this way, while improving the efficiency of text generation, the accuracy of text generation is also improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 This is one of the flowcharts of a text generation method provided in an embodiment of the present application;

[0014] Figure 2 This is the second flowchart of a text generation method provided in an embodiment of the present application;

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

[0016] Figure 3B This is the second example diagram of a browser interface provided in an embodiment of the present application;

[0017] Figure 3C This is a third example diagram of a browser interface provided in an embodiment of the present application;

[0018] Figure 4 This is the third flowchart of a text generation method provided in an embodiment of the present application;

[0019] Figure 5A This is one of the example diagrams of a conversation interface provided in an embodiment of the present application;

[0020] Figure 5B This is a second example diagram of a conversation interface provided in an embodiment of the present application;

[0021] Figure 5C This is a third example diagram of a conversation interface provided in an embodiment of the present application;

[0022] Fig. 6A This is one of the example diagrams of a publishing interface provided in an embodiment of the present application;

[0023] Figure 6B This is the second example diagram of a publishing interface provided in an embodiment of the present application;

[0024] Fig. 7A This is one of the example diagrams of an editing interface provided in an embodiment of the present application;

[0025] Figure 7B This is the second example diagram of an editing interface provided in an embodiment of the present application;

[0026] Figure 7C This is a third example diagram of an editing interface provided in an embodiment of the present application;

[0027] Fig. 8A This is one of the example diagrams of an order evaluation interface provided in an embodiment of the present application;

[0028] Figure 8B This is the second example diagram of an order evaluation interface provided in an embodiment of the present application;

[0029] Figure 8C This is a third example diagram of an order evaluation interface provided in an embodiment of the present application;

[0030] Fig. 9 This is a fourth flowchart of a text generation method provided in an embodiment of the present application;

[0031] Fig. 10A This is a fourth example diagram of a conversation interface provided in an embodiment of the present application;

[0032] Fig. 10B This is a third example diagram of a publishing interface provided in an embodiment of the present application;

[0033] Fig. 10C This is a fourth example diagram of an editing interface provided in an embodiment of the present application;

[0034] Fig. 10D This is a fourth example diagram of an order evaluation interface provided in an embodiment of the present application;

[0035] Fig.11 It is one of the structural diagrams of a text generation model provided in an embodiment of the present application;

[0036] Fig.12 This is the second structural diagram of a text generation model provided in an embodiment of the present application;

[0037] Fig.13 This is the third structural diagram of a text generation model provided in an embodiment of the present application;

[0038] Fig.14 This is the fifth flowchart of a text generation method provided in an embodiment of the present application;

[0039] Fig.15 It is a structural schematic diagram of a text generation device provided in an embodiment of the present application;

[0040] Fig.16 This is one of the hardware structure diagrams of an electronic device provided in an embodiment of the present application;

[0041] Fig.17 This is the second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0043] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0044] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "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 (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".

[0045] The text generation method, device, electronic device, storage medium and program product provided in the embodiments of the present application are described in detail below in conjunction with the accompanying drawings through specific embodiments and their application scenarios.

[0046] The text generation method, device, electronic device, storage medium and program product provided in the embodiments of the present application can be applied in scenarios where text is generated based on a large language model, such as dialogue reply scenarios, text editing scenarios, order evaluation scenarios, etc.

[0047] Scenario 1: When a conversation interface is displayed, if the contact corresponding to the conversation interface sends a conversation message "Will you like to have dinner together tomorrow night?" to the user's electronic device, the user can click on the conversation reply control in the conversation interface so that the electronic device can call the large language model, obtain the user's schedule for today, and input the conversation message, schedule, and conversation reply scenario into the large language model. The large language model can generate a reply sentence "Okay, I'm busy during the day and free at night" based on the writing style and writing habits corresponding to the conversation reply scenario, as well as the conversation message and schedule, and display the reply sentence in the conversation interface.

[0048] Scenario 2: When a text publishing interface is displayed, a user can input an overview text "concert" and at least one picture in the text publishing interface, so that the electronic device can display the overview text in the text editing area of ​​the text publishing interface and display at least one picture in the image editing area; then, the user can click on the edit text generation control in the text publishing interface, so that the electronic device can call the large language model, input the overview text, at least one picture and the text editing scene into the large language model, and the large language model can generate an edit text "B's concert was so exciting, it was worth the trip" according to the writing style and writing habits corresponding to the text editing scene, as well as the overview text and at least one picture; and display the edit text in the text publishing interface.

[0049] Scenario 3: When the order evaluation interface is displayed, the user can input the summary text "not delicious" in the order evaluation interface, so that the electronic device can display the summary text in the evaluation display area in the order evaluation interface; then, the user can input the order evaluation logo in the order evaluation interface, so that the electronic device can display three evaluation logos in the logo selection area in the order evaluation interface, and the three evaluation logos can be a bad evaluation logo, a medium evaluation logo, and a good evaluation logo; the user can click and input the bad evaluation logo, so that the electronic device can call the large language model, and input the evaluation information corresponding to the summary text and the bad evaluation logo into the large language model, and the large language model can generate the order evaluation information "not delicious at all, my family members pulled out the weeds" according to the writing style and writing habits corresponding to the order evaluation scenario, as well as the evaluation information corresponding to the summary text and the bad evaluation logo. And display the order evaluation information in the order evaluation interface.

[0050] It should be noted that the above-mentioned scenarios 1 to 3 are only illustrative examples of some scenarios in which the embodiments of the present application may be applied. In actual implementation, the embodiments of the present application can also be applied to any more possible scenarios such as appointment, procurement, subscription, etc., and the embodiments of the present application are not limited here.

[0051] In the text generation method, device, electronic device, storage medium and program product provided in the embodiments of the present 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 according to 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 need for the user to manually input the required text, thereby reducing the steps of text generation and improving the efficiency of text generation; and, since the first text is generated according to the first information and the text generation scenario corresponding to the first text generation control, the first text can be more in line with the current usage scenario to meet the user's personalized needs, thereby improving the accuracy of text generation; in this way, while improving the efficiency of text generation, the accuracy of text generation is also improved.

[0052] The execution subject of the text generation method provided in the embodiment of the present application may be a text generation device, and the text generation device may be an electronic device, or a functional module in an electronic device. The technical solution provided in the embodiment of the present application is described below using an electronic device as an example.

[0053] The present application embodiment provides a text generation method, Figure 1 A flowchart of a text generation method provided by an embodiment of the present application is shown. Figure 1 As shown, the text generation method provided in the embodiment of the present application may include the following steps 201 to 203.

[0054] Step 201: The electronic device displays a first interface.

[0055] In an embodiment of the present application, the above-mentioned first interface includes at least one text generation control and first information.

[0056] Optionally, in the embodiment of the present application, the first interface may be any interface in any application in the electronic device.

[0057] Exemplarily, the first interface may be any of the following: a conversation interface, a text posting interface, or an order evaluation interface, etc. The specific interface may be determined according to actual usage requirements, and the embodiment of the present application does not limit this.

[0058] It can be understood that the above-mentioned first information may be information contained in the first interface.

[0059] Exemplarily, the first information may include at least one of the following: a conversation message, an edited text, an image, and evaluation information, etc. The specific information may be determined according to actual use requirements, and is not limited in the embodiments of the present application.

[0060] Optionally, in the embodiment of the present application, the above-mentioned text generation control may include at least one of the following: a personalized reply control, a circle of friends text generation control, a posting text generation space, or an order review text generation control, etc. The specifics may be determined according to actual use requirements, and the embodiment of the present application does not limit this.

[0061] Optionally, in an embodiment of the present application, each text generation control in the at least one text generation control may correspond to a text generation scenario.

[0062] Exemplarily, the above text generation scenario may be any of the following: a conversation reply scenario, an evaluation information generation scenario, or a text editing scenario, etc. The specific scenario may be determined according to actual usage requirements, and the present application embodiment does not limit this.

[0063] Optionally, in an embodiment of the present application, each text generation control in the at least one text generation control may correspond to an application interface.

[0064] Exemplarily, the above application interface may be any of the following: a conversation interface, a friend circle editing interface, a text posting interface, an order evaluation interface, etc. The specific interface may be determined according to actual use requirements, and the present application embodiment does not impose any limitation thereto.

[0065] Optionally, in an embodiment of the present application, the electronic device may display the at least one text generation control in a blank area in the first interface; or, the electronic device may display the at least one text generation control in the first interface via a pop-up window.

[0066] Optionally, in the embodiment of the present application, combined with Figure 1 ,like Figure 2 As shown, after the above step 201, the text generation method provided in the embodiment of the present application also includes the following steps 301 and 302.

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

[0068] In the embodiment of the present application, the sixth input is used by the user to select an input method control in the first interface.

[0069] Optionally, in an embodiment of the present application, the sixth input includes but is not limited to: a click input of the input method control by a user through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible input, which can be determined based on actual usage requirements and is not limited in the embodiment of the present application.

[0070] Optionally, in an embodiment of the present application, the above-mentioned specific gesture can be any one of a single-click gesture, a sliding gesture, a drag gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double-press gesture, and a double-click gesture.

[0071] Optionally, in the embodiment of the present application, the click input may be a single click input, a double click input, or any number of click inputs, etc., and may also be a long press input or a short press input. For example, the first input may be a single click input of the user to the input method control.

[0072] Step 302: The electronic device displays an input method interface in response to a sixth input.

[0073] In an embodiment of the present application, the above-mentioned input method interface includes at least one text generation control.

[0074] Optionally, in an embodiment of the present 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.

[0075] For example, Figure 3A As shown, taking the electronic device as a mobile phone as an example, the mobile phone can display a browser application interface 10, in which a message mark "Xiaohong: Let's have dinner together tomorrow night?" and an input method mark 11 are displayed; Figure 3B As shown, the user can click the input method identifier 11 to input, so that the mobile phone can display the input method interface 12, and the input method interface 12 displays a repair control 121, a setting control 122 and a text generation component 123; Figure 3C As shown, the user can click and input the text generation component 123 so that the mobile phone can display the personalized reply control 124, the circle of friends text generation control 125, the published text generation control 126 and the order review text generation control 127 in the input method interface.

[0076] In an embodiment of the present application, the electronic device integrates the entry for calling the large model into the input method control. By calling the input method control, the electronic device can implement text generation operations. The operation is simple and convenient, which simplifies the steps of text generation and improves the efficiency of text generation by the electronic device.

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

[0078] In the embodiment of the present application, the above-mentioned first input is used to select a first text generation control from at least one text generation control.

[0079] Optionally, in an embodiment of the present application, the above-mentioned first input includes but is not limited to: a click input of the user on the above-mentioned first text generation mark through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible input, which can be determined based on actual usage requirements and is not limited in the embodiment of the present application.

[0080] Exemplarily, the first input may be a click input of the user on the first text generation control.

[0081] Step 203: The electronic device generates a first text in response to the first input based on the first information and the text generation scene corresponding to the first text generation control, and displays the first text in a second interface corresponding to the first text generation control.

[0082] In an embodiment of the present application, the electronic device can input the first information and the text generation scene 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.

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

[0084] Optionally, in the embodiment of the present application, the first model may be any one of the following: an artificial intelligence (AI) model, a neural network model, or a large language model (LLMs), etc. The specific model may be determined according to actual use requirements, and the embodiment of the present application does not limit it.

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

[0086] Optionally, in an embodiment of the present application, the above-mentioned preset area may be a text display area in the above-mentioned input method interface; or, the above-mentioned preset area may be a text display area in the second interface.

[0087] Optionally, in an embodiment of the present application, the first text includes at least one text, and the at least one text is displayed in a text selection area in the second interface.

[0088] Exemplarily, the text selection area may be an area in an input method interface in the second interface.

[0089] For example, in combination Figure 1 ,like Figure 4 As shown, after the above step 203, the text generation method provided in the embodiment of the present application also includes the following steps 401 and 402.

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

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

[0092] Optionally, in an embodiment of the present application, the fifth input includes but is not limited to: a click input of the second text by a user through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible input, which can be determined based on actual usage requirements and is not limited in the embodiment of the present application.

[0093] Exemplarily, the fifth input may be a click input on the second text.

[0094] Step 402: The electronic device displays a second text in a text display area in a second interface in response to a fifth input.

[0095] Optionally, in an embodiment of the present application, when the above-mentioned second interface is a conversation interface, the above-mentioned text display area may be a message display area; when the above-mentioned second interface is a text posting interface or a text publishing interface, the above-mentioned text display area may be a text editing area; when the above-mentioned second interface is an order evaluation interface, the above-mentioned text display area may be an order evaluation display area.

[0096] In the embodiment of the present application, 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.

[0097] For example, in combination with the above Figure 3C ,like Figure 5AAs shown, when the above-mentioned browser application interface 10 is displayed, if the user needs to reply to the conversation message, the user can click and input the personalized reply mark 124, so that the mobile phone can jump to the conversation interface 13 corresponding to the contact Xiaohong, and the conversation interface 13 displays the conversation message "Will you have dinner together tomorrow night?"; and the mobile phone can generate two texts "OK, I'm busy during the day and free at night" and "I'm available anytime after 4:30, depending on your time" in the background according to the conversation message "Will you have dinner together tomorrow night?", the conversation reply scene corresponding to the personalized reply control 124, and the writing style, writing habits and schedule corresponding to the conversation reply scene, and display the text marks of the two texts in the input method interface 14 in the conversation interface 13; the text marks of the two texts Figure 5A In the example, the user can click on the second text mark "OK, I'm busy during the day, but I'm free at night" and "I'm available anytime after 4:30, depending on your time" to indicate "OK, I'm busy during the day, but I'm free at night"; then, the user can click on the second text mark "OK, I'm busy during the day, but I'm free at night" to enable the mobile phone to display a prompt message "The personalized content has been created, do you want to publish it directly?", a confirmation control 15 and a negative control 16 in the conversation interface 13. If the user chooses to click on the confirmation control, as shown in FIG. Figure 5B As shown, the mobile phone can send "OK, I'm busy during the day, but I'm free at night" to the contact Xiaohong, and display "OK, I'm busy during the day, but I'm free at night" in the message display area 17 of the conversation interface 13; if the user chooses to click and input the negative control 16, the mobile phone can interact with the input method service using the model interface to perform the text data transmission operation, such as Figure 5C As shown, the mobile phone can insert the text "OK, I'm busy during the day, and I'm free at night" into the current active input box 18 of the input method for further modification by the user.

[0098] In the text generation method provided in the embodiment of the present application, a first interface is displayed, which includes at least one text generation control and a first information; then, a first input to a first text generation control in at least one text generation control is received; finally, in response to the first input, a first text is generated based on the first information and the text generation scene 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 scheme, since the first interface includes at least one text generation control, each text generation control can correspond to a text generation scene, so the user inputs the first text generation identifier so that the electronic device can directly generate the first text according to the first information and the text generation scene 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; and, since the first text is generated according to the text generation scene corresponding to the first information and the first text generation control, the first text can be more in line with the current usage scenario to meet the personalized needs of the user, thereby improving the accuracy of text generation; in this way, while improving the efficiency of electronic device text generation, the accuracy of electronic device text generation is also improved.

[0099] Optionally, in an embodiment of the present application, the text generation scenario indicated by the first text generation control is a conversation text generation scenario, and the second interface is a conversation interface.

[0100] Optionally, in the embodiment of the present application, the above-mentioned conversation interface can be a private chat interface or a group chat interface. It can be determined according to actual use requirements, and the embodiment of the present application does not limit it.

[0101] Exemplarily, before generating the first text in the "text generation scenario based on the first information and the first text generation control" in the above step 203, the text generation method provided in the embodiment of the present application also includes the following step 501; and the "text generation scenario based on the first information and the first text generation control corresponding to the text generation control" in the above step 203 can be specifically implemented through the following step 203a.

[0102] Step 501: The electronic device displays a conversation interface.

[0103] In the embodiment of the present application, the above-mentioned conversation interface includes conversation messages.

[0104] Optionally, in an embodiment of the present application, the above-mentioned session message may be one or more.

[0105] Optionally, in the embodiment of the present application, the above-mentioned session message may include a historical session message corresponding to the session interface.

[0106] Optionally, in the embodiment of the present application, the above-mentioned conversation message may include at least one of the following: text, image, video, audio, emoticon, symbol, etc. The specific content may be determined according to actual use requirements, and the embodiment of the present application does not limit this.

[0107] In the embodiment of the present application, the electronic device can jump from the first interface to the conversation interface according to the user's first input to the personalized reply control.

[0108] Step 203a: The electronic device generates a scene and a conversation message based on the first information and the conversation text to generate a first text.

[0109] Optionally, in an embodiment of the present application, the electronic device may display the first text in a text selection area in the conversation interface.

[0110] Optionally, in an embodiment of the present application, the above-mentioned text selection area can be a preset area in the conversation interface; or the above-mentioned text selection area can be an area corresponding to the input method interface in the conversation interface, that is, the above-mentioned first text can be displayed in the input method interface.

[0111] Optionally, in an embodiment of the present application, the electronic device may display the first text in the conversation interface via a pop-up window.

[0112] Optionally, in the embodiment of the present application, the electronic device may send the first text to the contact corresponding to the conversation interface through the user's input of the first text, and display the first text in the text display area in the conversation interface.

[0113] It can be understood that the above text display area can be a conversation message display area.

[0114] Optionally, in an embodiment of the present application, before sending the first text to the contact corresponding to the conversation interface, the electronic device may display a pop-up window for selecting whether to send. If the user selects yes, the electronic device may call a sending function to send the first text to the above-mentioned contact, thereby saving manual input time for the user; if the user selects no, the electronic device may interact with the large language model interface and the input method service, execute the text data transmission operation, and insert the first text into the currently active input box of the input method for further modification by the user.

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

[0116] Optionally, in the embodiment of the present application, after modifying the first text, the user may input a send control in the input method so that the electronic device may send the modified first text to the contact corresponding to the conversation interface.

[0117] In an embodiment of the present application, the electronic device can generate a first text based on the conversation message, the first information and the conversation text generation scenario in the conversation interface, so that the first text is more in line with the current usage scenario to meet the user's personalized needs, thereby improving the accuracy of text generation.

[0118] Optionally, in an embodiment of the present 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 a title text and a body text.

[0119] In the embodiment of the present application, the above-mentioned title text and body text can be used to characterize the user's text generation intention.

[0120] It should be noted that the above title text and body text are input by the user.

[0121] Exemplarily, before the "generating a first text based on the text generation scenario corresponding to the first information and the first text generation control" in the above step 203, the text generation method provided in the embodiment of the present application also includes the following steps 601 and 602; and the "generating a first text based on the text generation scenario corresponding to the first information and the first text generation control" in the above step 203 can be specifically implemented through the following step 203b.

[0122] Step 601: The electronic device displays a text publishing interface.

[0123] In the embodiment of the present application, a title text generation logo and a body text generation logo are displayed in the logo selection area of ​​the above-mentioned text publishing interface.

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

[0125] Optionally, in an embodiment of the present application, the electronic device may display a title text generation mark and a body text generation mark in a text publishing interface via a pop-up window.

[0126] Optionally, in the embodiment of the present application, the above-mentioned title text generation mark can be any of the following: a text mark, an image mark, an expression mark or a special symbol mark, etc. The specific mark can be determined according to actual use requirements, and the embodiment of the present application does not limit it.

[0127] Optionally, in the embodiment of the present application, the above text generation mark can be any of the following: a text mark, an image mark, an expression mark or a special symbol mark, etc. The specific mark can be determined according to actual use requirements, and the embodiment of the present application does not limit it.

[0128] Step 602: The electronic device receives a third input of a title text generation identifier and a body text generation identifier.

[0129] In the embodiment of the present application, the third input is used to select a title text generation mark and a body text generation mark in the text publishing interface.

[0130] Optionally, in an embodiment of the present application, the above-mentioned third input includes but is not limited to: the user's click input of the above-mentioned title text generation mark and the body text generation mark through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible input, which can be determined based on actual usage requirements and is not limited in the embodiment of the present application.

[0131] Exemplarily, the third input may be a click input by the user for a title text generation mark and a body text generation mark.

[0132] Step 203b: The electronic device generates a first text in response to the third input by generating a scene and the first information based on the title text, the body text, and the published text.

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

[0134] Optionally, in the embodiment of the present application, the above-mentioned text display area may be an editing display area in a text posting interface; or, the above-mentioned text display area may be a text display area in an input method interface.

[0135] Exemplarily, the text display area may be a title input box and a text input box in a text publishing interface.

[0136] Optionally, in an embodiment of the present application, the above-mentioned third input may include a first sub-input and a second sub-input, and the user may make a first sub-input for the title text generation identifier so that the electronic device may input the title text and the text generation scene into the first model, and generate a first sub-text corresponding to the title text through the first model, and display the first sub-text in the text publishing interface; then, the user may make a second sub-input for the body text generation identifier so that the electronic device may input the body text and the text generation scene into the first model, and generate a second sub-text corresponding to the body text through the first model, and display the second sub-text in the text publishing interface, wherein the first text includes the above-mentioned first sub-text and second sub-text.

[0137] Optionally, in an embodiment of the present application, the first subtext may be one or more.

[0138] Optionally, in an embodiment of the present application, the second subtext may be one or more.

[0139] For example, in combination Figure 3C ,like Fig. 6A As shown, when the above-mentioned browser application interface 10 is displayed, if the user needs to publish a message, the user can click on the publish text generation mark 126 to click and input, so that the mobile phone can display the text publishing interface 20, and the text publishing interface 20 includes the title text "A's Concert" and the body text "A's Concert", and the text publishing interface 20 displays an input method interface 21, and the input method interface 21 includes a title generation mark 22 and a body generation mark 23; the user can click and input the title generation mark 22, so that the mobile phone can input the title text "A's Concert" and the text generation scene into the first model, generate the title "Concert", and display it in the input method interface 21; then, as shown in FIG. Figure 6B As shown, the user can click and input the text generation mark 23 so that the mobile phone can input the text "A's concert" and the text generation scene into the first model, generate the text "A's concert, feel the voice of young people", and display the text "A's concert, feel the voice of young people" in the input method interface 21.

[0140] Optionally, in an embodiment of the present application, after generating the main text, the electronic device may add topic tags to the main text.

[0141] Optionally, in an embodiment of the present application, after generating the title text or the body text, the electronic device may display the generated title text or the body text in the input method interface, and the user may input the generated title text or the body text so that the electronic device may display a pop-up window asking whether to modify the text. If the user selects no, the electronic device may directly replace the generated title text or the body text in the text publishing interface with the generated title text or the body text; if the user selects yes, the electronic device may display the generated title text or the body text in the input box of the input method, and the user may modify the title text or the body text and input the upload control in the input method so that the electronic device may replace the generated title text or the body text in the text publishing interface with the generated title text or the body text.

[0142] In an embodiment of the present application, when a text publishing interface is displayed, a user can input into a title text generation control and a body text generation control so that the electronic device can generate text corresponding to the title text and text corresponding to the body text without going through multiple applications, thereby simplifying the steps for the electronic device to generate text and improving the efficiency of the electronic device to generate text.

[0143] Optionally, in an embodiment of the present application, the electronic device may receive a user's input of a circle of friends text generation identifier, thereby displaying the above-mentioned text editing interface, which may include a fifth text and at least one image.

[0144] In the embodiment of the present application, the fifth text is input by the user, and the at least one image is uploaded by the user.

[0145] In an embodiment of the present application, the electronic device can input the circle of friends text generation scene corresponding to the fourth text, at least one image, the first information and the circle of friends text generation identifier into the first model to generate a first text, and display the first text in the text editing interface.

[0146] Optionally, in an embodiment of the present application, the electronic device can display the first text in the input method interface, and the user can input the first text so that the electronic device can display whether to publish the control. If the user selects yes, the electronic device can directly replace the fifth text in the displayed text editing interface with the first text, and package the first text and image data into a publishing unit, which is transmitted over the network through an interface call of the text editing interface, and the packaged publishing unit is sent to the server, thereby realizing the publication of the content; if the user selects no, the electronic device can display the first text in the input box of the input method control, and the user can modify the first text and input the publish control in the input method, so that the electronic device can package the modified first text and image data into a publishing unit, which is transmitted over the network through an interface call of the text publishing interface, and the packaged publishing unit is sent to the server, thereby realizing the publication of the content.

[0147] For example, in combination with the above scenario 2, Figure 3C ,like Fig. 7A As shown, when the above-mentioned browser application interface 10 is displayed, if the user needs to edit the circle of friends message, the user can click on the circle of friends text generation mark 125, so that the mobile phone can display the text editing interface 30, and the text editing interface 30 includes the fifth text "Watch B's concert" and a concert picture; and the mobile phone can input the first information, the fifth text "Watch B's concert", a concert picture and the circle of friends text generation scene into the first model to obtain two first texts, which are: "I am fortunate to be at B's concert and feel very excited" and "Come and swing with B, so happy", and display "I am fortunate to be at B's concert and feel very excited" and "Come and swing with B, so happy" in the input method interface 31 in the text editing interface 30; then, the user can click to input the text "Come and swing with B, so happy", as shown in FIG. Figure 7B As shown, the mobile phone can display a pop-up window 32 indicating whether to publish, in which "personalized creation content has been created, whether to publish directly", a confirmation control 33 and a negative control 34 are displayed; Figure 7CAs shown, if the user clicks and inputs the confirmation control 33, the mobile phone can package the first text and image data into a publishing unit, and transmit the packaged publishing unit to the server through the interface call of the text publishing interface, thereby realizing the publication of the content; if the user clicks and inputs the negative control 34, the mobile phone can display the first text in the input box for the user to modify. After the user completes the modification, the user can click and input 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, and transmit the packaged publishing unit to the server through the interface call of the text publishing interface, thereby realizing the publication of the content.

[0148] In an embodiment of the present application, when a text publishing interface is displayed, a user can directly input a text generation identifier in the text publishing interface so that the electronic device can generate the text required by the user, thereby simplifying the steps of the electronic device to generate text and improving the efficiency of the electronic device to generate text.

[0149] Optionally, in an embodiment of the present 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.

[0150] It should be noted that the above order evaluation information is input by the user.

[0151] Optionally, in the embodiment of the present application, the order evaluation information may include at least one of the following: text, image, video, emoticon, etc. The specific information may be determined according to actual use requirements, and the embodiment of the present application does not limit it.

[0152] Exemplarily, before the "generating a first text based on the first information and the text generation scenario corresponding to the first text generation control" in the above step 203, the text generation method provided in the embodiment of the present application also includes the following steps 701 and 702; and the "generating a first text based on the first information and the text generation scenario corresponding to the first text generation control" in the above step 203 can be specifically implemented through the following step 203c.

[0153] Step 701: The electronic device displays an order evaluation interface.

[0154] In the embodiment of the present application, at least one order evaluation logo is displayed in the logo selection area in the above-mentioned order evaluation interface.

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

[0156] Optionally, in the embodiment of the present application, each of the at least one order evaluation identifier may be a text identifier, an image identifier, an expression identifier, or a special symbol identifier, etc. The specific identifier may be determined according to actual use requirements, and the embodiment of the present application does not limit the identifier.

[0157] Exemplarily, the at least one order evaluation identifier may include at least one of the following: a good evaluation identifier, a medium evaluation identifier, and a bad evaluation identifier.

[0158] Step 702: The electronic device receives a fourth input of a first order evaluation identifier among at least one order evaluation identifier.

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

[0160] Optionally, in an embodiment of the present application, the above-mentioned fourth input includes but is not limited to: a click input of the above-mentioned first order evaluation logo by a user through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible input, which can be determined based on actual usage requirements and is not limited in the embodiment of the present application.

[0161] Exemplarily, the fourth input may be a click input of the user on the first order evaluation identifier.

[0162] Step 203c: the electronic device generates a 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.

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

[0164] Optionally, in an embodiment of the present application, the above-mentioned text display area can be an area corresponding to the input method interface, that is, the above-mentioned first text can be displayed in the input method interface; or, the above-mentioned text display area can be a preset area in the order evaluation interface.

[0165] Optionally, in an embodiment of the present application, the electronic device may display the first text in the order evaluation interface via a pop-up window.

[0166] Optionally, in an embodiment of the present 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 asking whether to publish or not, the pop-up window including a confirmation control and a negative control. If the user selects the confirmation control, the electronic device can directly publish the first text in 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 the publish control in the input method so that the electronic device can display the modified first text in the order evaluation interface.

[0167] For example, in combination Figure 3C ,like Fig. 8A As shown, when the above-mentioned browser application interface 10 is displayed, if a user comments on a store displayed in the browser application interface 10, the user can click and input the order comment text generation mark 127, so that the mobile phone can display the order evaluation interface 40 of the store, and the order evaluation interface 40 displays the order store name "A place special snack shop", the evaluation information "not delicious", and the good review mark 41, the medium review mark 42 and the bad review mark 43. The user can click the bad review mark 43, as shown in FIG. Figure 8B As shown, the electronic device can display two first texts in the input method interface 44, and the two first texts are "Report to eat, report to eat at all, don't come, my friends!" and "The level needs to be improved, please choose carefully"; then the user can click and input the text "Report to eat, report to eat at all, don't come, my friends!", as shown in FIG. Figure 8C As shown, the mobile phone can display a publish pop-up window 45 in the order evaluation interface 40, in which the publish pop-up window 45 is displayed "Personalized creation content has been completed, do you want to publish it directly", as well as a confirmation control 46 and a negative control 47. If the user selects the confirmation control 46, the mobile phone can directly publish the text selected by the user in the order evaluation interface 40; if the user selects the negative control 47, the electronic device can display the text selected by the user in the input box of the input method control. The user can modify the text selected by the user, and then input it into the publish control in the input method, so that the mobile phone can display the modified text in the order evaluation interface 40.

[0168] In an embodiment of the present application, when an order evaluation interface is displayed, the electronic device can directly generate a first text required by the user based on the user's input, thereby reducing the steps for the electronic device to generate text and thus improving the efficiency of the electronic device to generate text.

[0169] Optionally, in an embodiment of the present application, the at least one text generation control is a first text generation control, and the first text generation control is used to indicate a text generation scene corresponding to the first interface.

[0170] For example, in combination Figure 1 ,like Fig. 9 As shown, the "displaying the first text in the second interface corresponding to the first text generation control" in the above step 203 can be specifically implemented through the following step 801.

[0171] Step 801: The electronic device displays a first text in a first interface.

[0172] It can be understood that the above-mentioned first interface can be the second interface.

[0173] Optionally, in the embodiment of the present application, the first interface may be any one of the following: a conversation interface, a text posting interface, a text editing interface, or an order evaluation interface, etc. The specific interface may be determined according to actual use requirements, and the embodiment of the present application does not limit the interface.

[0174] Optionally, in the embodiment of the present application, the first information may be a conversation message, edited text, image, evaluation information, etc. The specific information may be determined according to actual use requirements, and the embodiment of the present application does not limit the information.

[0175] In the embodiment of the present 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.

[0176] Exemplarily, the electronic device may 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 relationship table, and display the first text generation control in the input method interface.

[0177] Mapping relationship table

[0178] Interface Type First text generation control Conversational Interface Personalized reply controls Text editing interface Moments text generation control Text publishing interface Post text generation control Order evaluation interface Order review text generation control

[0179] It can be understood that when the above-mentioned first interface changes, the first text generation control in the input method interface will also change accordingly.

[0180] Exemplarily, when the above-mentioned 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. That is to say, the electronic device can monitor window changes, automatically determine the current scene, and display the corresponding first text generation control according to the preset mapping relationship table.

[0181] For example, Fig. 10A As shown, when the mobile phone displays the conversation interface, the mobile phone can display the personalized reply control 124 in the input method interface 14 of the conversation interface 13; Fig. 10BAs shown, when the mobile phone displays the text publishing interface 20, the mobile phone can display the text generation mark 126 in the input method interface 21 in the text publishing interface 20; Fig. 10C As shown, when the mobile phone displays the text editing interface 30, the mobile phone can display the friend circle text generation mark 125 in the input method interface 32 in the text editing interface 30; Fig. 10D As shown, when the mobile phone displays the order evaluation interface 40 , the mobile phone can display the order review text generation mark 127 in the input method interface 44 in the order evaluation interface 40 .

[0182] In the embodiment of the present application, when the first interface is the second interface, the electronic device can directly generate the first text according to the first information and the text generation scene corresponding to the first text generation control.

[0183] It should be noted that, for the specific process of generating the first text in the first interface, please refer to the above embodiment for details, and it will not be repeated here to avoid repetition.

[0184] In the embodiment of the present application, since the first text is generated according to the text generation scenario corresponding to the first information and the first text generation control, the first text can be more in line with the current usage scenario to meet the user's personalized needs, thereby improving the accuracy of text generation.

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

[0186] Step 901: The electronic device inputs first information and a text generation scenario into a first model, performs semantic analysis on the first information through the first model, and determines a text generation intention.

[0187] In an embodiment of the present application, the electronic device vectorizes 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.

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

[0189] Optionally, in an embodiment of the present application, the electronic device may display a model selection interface, which includes a first control and a second control, the first control being used to indicate a model stored in a server, and the second control being used to indicate a model stored in the electronic device; a user may select and input the first control or the second control so that the electronic device may determine to use the model stored in the server as the first model; or to use the model stored in the electronic device as the first model.

[0190] Optionally, in an embodiment of the present application, when the electronic device determines to use a 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. and currently running application information through a pop-up window, i.e., the first portrait information described below.

[0191] Step 902: The electronic device determines text style feature information matching the text generation scenario based on the text generation scenario.

[0192] In the embodiment of the present application, the electronic device can determine the text style feature information matching the text generation scenario through the first relationship stored in the first model and the text generation scenario.

[0193] Exemplarily, when the above-mentioned text generation scenario is a conversation scenario, the above-mentioned first model can determine through the above-mentioned first relationship that the text style feature information corresponding to the conversation scenario is: brief and lively; when the above-mentioned text generation scenario is a text editing scenario, the above-mentioned first model can determine through the first relationship that the text style feature information corresponding to the text editing scenario is: detailed and lively; when the above-mentioned text generation scenario is an order evaluation scenario, the above-mentioned first model can determine through the first relationship that the text style feature information corresponding to the order evaluation scenario is: brief and serious.

[0194] Step 903: The electronic device generates a first text based on the text generation intention, the text style feature information and the first portrait information.

[0195] In an embodiment of the present application, the above-mentioned first portrait information includes user attribute information and user behavior information, and the first model is trained based on the portrait information.

[0196] Optionally, in the embodiment of the present application, the user attribute information may include at least one of the following: age, gender, region, interest preference, and consumption habits, etc. The specific information may be determined according to actual use requirements, and the embodiment of the present application does not limit this.

[0197] Optionally, in the embodiment of the present application, the user behavior information may include at least one of the following: schedule information, browsing information in the application, location information, purchase records, search history information, etc. The specific information may be determined according to actual use requirements and is not limited in the embodiment of the present application.

[0198] In an embodiment of the present application, the electronic device can generate a first text having specific individual characteristics and meeting user needs through a first model trained based on portrait information, thereby meeting the user's personalized needs and improving the flexibility of the electronic device in text generation.

[0199] Optionally, in the embodiment of the present application, the text generation method provided in the embodiment of the present application also includes the following steps 1001 to 1003.

[0200] Step 1001: The electronic device performs text prediction based on the second portrait information and the text training sample through the initial model to obtain a third text.

[0201] Optionally, in an embodiment of the present application, the above-mentioned second portrait information may include user attribute information and user behavior information.

[0202] Optionally, in an embodiment of the present application, the electronic device can obtain the second portrait information through a personalized instruction template in the initial model.

[0203] Exemplarily, when the above-mentioned 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 schedule text information, and uses the summarizing ability of the initial model to build a personalized template required for full fine-tuning of the server. The content of the personalized template is the above-mentioned second portrait information.

[0204] As another example, when the initial model is a model in an electronic device, high-frequency words and sentences in the conversation data are obtained based on the tf-idf algorithm, and schedule information is extracted using a model with information extraction capabilities. Finally, a personalized instruction template is generated with the help of the summary capability of the initial model, and the content of the personalized template is the second portrait information.

[0205] Optionally, in an embodiment of the present application, after the electronic device obtains the second portrait information, the electronic device may perform prefix tuning on the second portrait information to obtain a vector corresponding to the second portrait information; then, the electronic device may 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 to obtain a fourth text.

[0206] 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 as part of the input of the training model to enhance the model's perception of personalized information.

[0207] For example, Fig.11As shown, taking the second portrait information as "the user is a mother who loves taking photos and has a puppy", the second portrait information is encoded by the encoder 50 to obtain a coding vector, and the coding vector is input into the pooling layer 51 to perform three-segment pooling on the coding vector to obtain a pooling result; the pooling result is then input into the linear layer 52, and the pooling result is normalized to obtain a vector corresponding to the second portrait information, and then the vector corresponding to the second portrait information is concatenated with the text training sample and input into the initial model 53 to predict the sixth text, and the electronic device updates the weight of the encoder based on the cross entropy loss between the sixth text and the reference text.

[0208] It should be noted that the purpose of this stage is to obtain the user's high-dimensional representation information from the latent space, and this high-dimensional representation information is highly relevant to the reply task.

[0209] Optionally, in an embodiment of the present application, the electronic device may input the second portrait information, the vector corresponding to the second portrait information, the task template and the text training sample into the initial model to predict the fourth text.

[0210] For example, in combination Fig.11 ,like Fig.12 As shown, in the case where the above-mentioned 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 addition and layer normalization 56, a feedforward network layer 57, a second addition and layer normalization 58 and an output layer 59; wherein, the electronic device can input the second portrait information, the vector corresponding to the second portrait information, the task template and the text training sample into the input layer 54 in the initial model, and the input layer concatenates the second portrait information, the vector corresponding to the second portrait information, the task template and the text training sample to obtain a first vector, and inputs the first vector into the multi-head attention layer 55 and the first addition and layer normalization 56 respectively to obtain a normalized first vector; then the normalized first vector is input into the feedforward network layer 57 and the second addition and layer normalization 58, and the fourth text is output through the output layer 59.

[0211] For example, in combination Fig.12 ,like Fig.13As shown, in the case where the above-mentioned 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 addition and layer normalization 63, a feedforward network layer 64, a gating 65, a fixed attribute expert layer 66, a variable attribute expert layer 67, a second addition and layer normalization 68 and an output layer 69; wherein the electronic device can input the second portrait information, the vector corresponding to the second portrait information, the task template and the text training sample into the input layer 61 in the initial model, and the input layer 61 converts the second portrait information, the vector corresponding to the second portrait information, the task template and the text training sample into the input layer 61. The vectors corresponding to the two portrait information, the task template and the text training sample are spliced ​​to obtain the first vector, and the first vector is respectively input into the multi-head attention layer 62 and the first addition layer normalization 63 to obtain the normalized first vector; then the normalized first vector is input into the feedforward network layer 64, the second addition layer normalization 68 and the gating 65, and the gating 65 inputs the fixed attributes in the normalized first vector into the fixed attribute expert layer 66, and inputs the variable attributes in the normalized first vector into the variable attribute expert layer 67; then, the first model is passed (E obtains a second vector, and inputs the second vector into the second addition and normalization layer 68, and outputs the fourth text through the output layer 69; wherein, is the second vector, W0 is the weight of the initial model, H in is the normalized first vector, G is the gating function, and E is the attribute expert layer.

[0212] For example, the above fixed attribute expert layer can be represented as ΔW E1 =B1A1, the above fixed attribute expert layer can be represented as ΔW E2 =B2A2.

[0213] Optionally, in the embodiment of the present application, the fixed attribute includes at least one of the following: age, occupation, gender, etc. The fixed attribute expert layer is used to control text style features.

[0214] Optionally, in the embodiment of the present application, the variable attribute includes at least one of the following: schedule information, purchase record, search history, etc. The variable attribute expert layer is used to control the characteristics of the reply content.

[0215] Step 1002: The electronic device performs a cross entropy operation on the third text and the reference text to calculate a loss value.

[0216] Optionally, in an embodiment of the present application, the electronic device may perform text semantic checking 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.

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

[0218] Optionally, in an embodiment of the present application, when the above-mentioned initial model is a model stored in the server, the electronic device can update the model parameters of the initial model by back propagation according to the loss value to obtain the first model.

[0219] Optionally, in an embodiment of the present application, when the above-mentioned initial model is a model stored in an electronic device, the electronic device may update only the model parameters of the fixed attribute expert layer and the variable attribute expert layer in the initial model by back propagation according to the loss value to obtain a first model.

[0220] It should be noted that, when the above-mentioned initial model is a model stored in an electronic device, considering that the second portrait information is updated and accumulated in real time, the above-mentioned updating behavior is also performed regularly.

[0221] Optionally, in an embodiment of the present application, in the process of an electronic device using a model stored in the electronic device to create content, the electronic device can continuously collect user feedback information on the content generated by the model. By using the Direct Preference Optimization (DPO) algorithm and incorporating the user's evaluation criteria, the model can learn to execute behaviors that are more reasonable or ideal for 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 to construct a preference data set Dpre. Using the DPO algorithm, the collected user feedback is integrated into the training process, so that the model learns the user's preference pattern, provides more accurate content recommendations that are more in line with the user's personalized needs, enhances the user experience, and improves user stickiness.

[0222] For example, when providing users with text creation results in text editing scenarios, two different contents are output under the recommendation tone, respectively, and the two different contents are "Who is so lucky! Got A's ticket"; "Singing with A, 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 the user's selection behavior into the preference database and gradually learn the exclusive style pattern.

[0223] It should be noted that the execution timing of the above steps 1001 to 1003 may be before step 201 or before step 203, and the specific embodiment of the present application does not limit this. Exemplarily, the execution timing of the above steps 1001 to 1003 may be before step 201.

[0224] In the embodiment of the present application, the electronic device can generate text creation results that are more in line with the user's personalized characteristics by combining the user portrait data in the electronic device, constructing personalized instruction hard templates and soft templates, and performing regular preference fine-tuning. At the same time, user privacy data including personalized prompts is not uploaded to the cloud, which greatly enhances the local protection and privacy security of data, and reduces the end-side training and reasoning burden in a simplified way.

[0225] For example, Fig.14 As shown, the model training process provided by the embodiment of the present application is specifically explained below through a specific example. Specifically, it can include the following steps 71 to 77.

[0226] Step 71: The electronic device generates a personalized instruction hard prompt.

[0227] Step 72: The electronic device trains personalized instruction soft prompts.

[0228] In the embodiment of the present application, the above-mentioned training personalized instruction soft prompt refers to the prefix tuning processing of the second portrait information in the above-mentioned embodiment.

[0229] Step 73: The electronic device is fully fine-tuned in the cloud.

[0230] Step 74: The electronic device determines whether authorized access to the user information is possible.

[0231] In the embodiment of the present application, if it is possible, the electronic device proceeds to step 75, and if it is not possible, the electronic device proceeds to step 76.

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

[0233] In the embodiment of the present application, the hybrid Lora expert refers to the fixed attribute expert layer and the variable attribute expert layer in the above embodiment.

[0234] Step 76: The electronic device generates text using the model in the electronic device.

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

[0236] In the embodiment of the present application, the electronic device can generate text creation results that are more in line with the user's personalized characteristics by combining the user portrait data in the electronic device, constructing personalized instruction hard templates and soft templates, and performing regular preference fine-tuning. At the same time, user privacy data including personalized prompts is not uploaded to the cloud, which greatly enhances the local protection and privacy security of data, and reduces the end-side training and reasoning burden in a simplified way.

[0237] Fig.15FIG. 1 shows a possible structural diagram of a text generation device involved in an embodiment of the present application. Fig.15 As shown, the text generating device 80 may include: a display module 81 , a receiving module 82 and a generating module 83 .

[0238] The display module 81 is used to display a first interface, which includes at least one text generation control and a first message. The receiving module 82 is used to receive a first input to a first text generation control among the at least one text generation control. The generating module 83 is used to generate a first text based on the first message and the text generation scene 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.

[0239] In a possible implementation, the at least one text generation control is a first text generation control, and the first text generation control is used to indicate a text generation scene corresponding to the first interface. The display module 81 is specifically used to display the first text in the first interface.

[0240] In a possible implementation, the text generation scenario indicated by the first text generation control is a conversation text generation scenario, and the second interface is a conversation interface. The display module 81 is also used to display a conversation interface before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control, and the conversation interface includes a conversation message. The generation module 83 is specifically used to generate the first text based on the first information, the conversation text generation scenario and the conversation message.

[0241] In a possible implementation, 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 a title text and a body text. The display module 81 is also used to display a 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, and the title text generation logo and the body text generation logo are displayed in the logo selection area of ​​the text publishing interface. The receiving module 82 is also used to receive a third input for the title text generation logo and the body text generation logo. The generating module 83 is specifically used to generate the first text based on the title text, the body text, the publishing text generation scenario and the first information in response to the third input received by the receiving module 82.

[0242] In a possible implementation, 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. The display module 81 is also used to display an order evaluation interface before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control, and at least one order evaluation logo is displayed in the logo selection area in the order evaluation interface. The receiving module 82 is also used to receive a fourth input of a first order evaluation logo among the at least one order evaluation logo. The generation module 83 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 logo, the order evaluation text generation scenario and the first information.

[0243] In a possible implementation, the first text includes at least one text, and the at least one text is displayed in the text selection area in the second interface. The receiving module 82 is also used to receive a fifth input of a second text in the at least one text after the display module displays the first text. The display module 81 is also used to display the second text in the text display area in the second interface in response to the fifth input received by the receiving module 82.

[0244] In a 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 in response to the sixth input received by the receiving module 82, wherein the input method interface includes at least one text generation control.

[0245] In one possible implementation, the above-mentioned generation module 83 is specifically used to input the first information and the text generation scenario into the first model, perform semantic analysis on the first information through the first model, and determine the text generation intention; and based on the text generation scenario, determine the text style feature information that matches the text generation scenario; and generate the first text based on the text generation intention, the text style feature information and the first portrait information; wherein the first portrait information includes user attribute information and user behavior information, and the first model is trained based on the portrait information.

[0246] In a possible implementation, the text generation device 80 provided in the above embodiment of the present application further includes a prediction module, a processing module and an update module. The prediction module is used to perform text prediction based on the second portrait information and the text training sample through the initial model to obtain the third text. The processing module is used to perform a cross entropy operation 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.

[0247] The embodiment of the present application provides a text generation device. Since the first interface includes at least one text generation control, each text generation control can correspond to a text generation scenario. Therefore, the user inputs a first text generation identifier so that the text generation device can directly generate a first text according to 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. There is no need for the user to manually input the required text, which reduces the steps of text generation and improves the efficiency of text generation. Moreover, since the first text is generated according to the first information and the text generation scenario corresponding to the first text generation control, the first text can be more in line with the current usage scenario to meet the user's personalized needs, thereby improving the accuracy of text generation. In this way, while improving the efficiency of text generation, the accuracy of text generation is also improved.

[0248] The text generation device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0249] The text generation device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0250] The text generation device provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.

[0251] Alternatively, if Fig.16As shown, an embodiment of the present application further provides an electronic device 90, including a processor 91 and a memory 92, wherein the memory 92 stores programs or instructions that can be executed on the processor 91, and when the program or instructions are executed by the processor 91, the various steps of the above-mentioned text generation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.

[0252] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0253] Fig.17 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

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

[0255] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.17 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

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

[0257] Optionally, in the embodiment of the present application, the at least one text generation control is a first text generation control, and the first text generation control is used to indicate a text generation scenario corresponding to the first interface. The display unit 106 is specifically used to display the first text in the first interface.

[0258] Optionally, in an embodiment of the present application, the text generation scenario indicated by the first text generation control is a conversation text generation scenario, and the second interface is a conversation interface. The display unit 106 is further configured to display a conversation interface before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control, wherein the conversation interface includes a conversation message. The processor 110 is specifically configured to generate the first text based on the first information, the conversation text generation scenario, and the conversation message.

[0259] Optionally, in an embodiment of the present 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 a title text and a body text. The display unit 106 is also used to display a 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, and a title text generation logo and a body text generation logo are displayed in the logo selection area of ​​the text publishing interface. The user input unit 107 is also used to receive a third input for the title text generation logo and the body text generation logo. The processor 110 is specifically used to generate the first text based on the title text, the body text, the published text generation scenario and the first information in response to the third input.

[0260] Optionally, in an embodiment of the present 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. The display unit 106 is also used to display an order evaluation interface before generating the first text based on the first information and the text generation scenario corresponding to the first text generation control, and at least one order evaluation logo is displayed in the logo selection area in the order evaluation interface. The user input unit 107 is also used to receive a fourth input of a first order evaluation logo among the at least one order evaluation logo. The processor 110 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 logo, the order evaluation text generation scenario and the first information.

[0261] Optionally, in an embodiment of the present application, the first text includes at least one text, and the at least one text is displayed in the text selection area in the second interface. The user input unit 107 is further configured to receive a fifth input of a second text in 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 in the second interface in response to the fifth input.

[0262] Optionally, in the embodiment of the present application, the user input unit 107 is further configured to receive a sixth input to the first interface after displaying the first interface. The display unit 106 is further configured to display an input method interface in response to the sixth input, wherein the input method interface includes at least one text generation control.

[0263] Optionally, in an embodiment of the present application, the above-mentioned processor 110 is specifically used to input the first information and the text generation scenario into the first model, perform semantic analysis on the first information through the first model, and determine the text generation intention; and based on the text generation scenario, determine the text style feature information that matches the text generation scenario; and generate the first text based on the text generation intention, the text style feature information and the first portrait information; wherein the first portrait information includes user attribute information and user behavior information, and the first model is trained based on the portrait information.

[0264] Optionally, in an embodiment of the present application, the above-mentioned processor 110 is also used to perform text prediction based on the second portrait information and the text training sample through the initial model to obtain a third text; and perform cross entropy operation on the third text and the reference text to calculate the loss value; and based on the loss value, update the model parameters of the initial model to obtain the first model.

[0265] An embodiment of the present application provides an electronic device. Since the first interface includes at least one text generation control, each text generation control can correspond to a text generation scenario. Therefore, the user inputs a first text generation identifier so that the electronic device can directly generate a first text according to 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. There is no need for the user to manually input the required text, which reduces the steps of text generation and improves the efficiency of text generation. Moreover, since the first text is generated according to the first information and the text generation scenario corresponding to the first text generation control, the first text can be more in line with the current usage scenario to meet the user's personalized needs, thereby improving the accuracy of text generation. In this way, while improving the efficiency of text generation, the accuracy of text generation is also improved.

[0266] The electronic device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.

[0267] The beneficial effects of various implementations in this embodiment can be specifically referred to the beneficial effects of the corresponding implementations in the above method embodiment. To avoid repetition, they will not be described again here.

[0268] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

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

[0270] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.

[0271] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0272] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0273] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0274] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0275] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned text generation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0276] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0277] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0278] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A text generation method, characterized in that: The method comprises: Displaying a first interface, wherein the first interface includes at least one text generation control and first information; receiving a first input to a first text generating control of the at least one text generating control; In response to the first input, a first text is generated based on the first information and a 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.

2. The method according to claim 1, characterized in that The at least one text generation control is the first text generation control, and the first text generation control is used to indicate a text generation scenario corresponding to the first interface; The displaying the first text in the second interface corresponding to the first text generation control includes: The first text is displayed in the first interface.

3. The method according to claim 1, characterized in that The text generation scenario indicated by the first text generation control is a conversation text generation scenario, and the second interface is a conversation interface; Before generating the first text based on the text generation scenario corresponding to the first information and the first text generation control, the method further includes: Displaying the conversation interface, wherein the conversation interface includes conversation messages; The generating the first text based on the first information and the text generation scenario corresponding to the first text generation control includes: A first text is generated based on the first information, the conversation text generation scenario and the conversation message.

4. The method according to claim 1, characterized in that: 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, and the text publishing interface includes a title text and a body text; Before generating the first text based on the text generation scenario corresponding to the first information and the first text generation control, the method further includes: Displaying a text publishing interface, wherein a title text generation logo and a body text generation logo are displayed in a logo selection area of ​​the text publishing interface; Receiving a third input of the title text generation identifier and the body text generation identifier; The 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 posting text generation scenario, and the first information.

5. The method according to claim 1, characterized in that The text generation scenario indicated by the first text generation control is an order evaluation text generation scenario, the second interface is an order evaluation interface, and the order evaluation interface includes order evaluation information; Before generating the first text based on the text generation scenario corresponding to the first information and the first text generation control, the method further includes: Displaying an order evaluation interface, wherein at least one order evaluation logo is displayed in a logo selection area in the order evaluation interface; receiving a fourth input of a first order evaluation identifier among the at least one order evaluation identifier; The 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, characterized in that The first text includes at least one text, and the at least one text is displayed in a text selection area in the second interface; After displaying the first text, the method further includes: receiving a fifth input of a second text of the at least one text; In response to the fifth input, the second text is displayed in a text display area in the second interface.

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

8. The method according to claim 1, characterized in that The generating the first text based on the first information and the text generation scenario corresponding to the first text generation control includes: Inputting the first information and the text generation scenario into a first model, and performing semantic analysis on the first information through the first model to determine the text generation intention; Based on the text generation scenario, determining text style feature information matching the text generation scenario; Generate the first text based on the text generation intention, the text style feature information and the first portrait information; Among them, the first portrait information includes user attribute information and user behavior information, and the first model is trained based on the portrait information.

9. The method according to claim 8, characterized in that The method further comprises: Using the initial model, text prediction is performed based on the second portrait information and the text training sample to obtain a third text; Performing a cross entropy operation on the third text and the reference text to calculate a 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 device, characterized in that: The text generation device comprises: a display module, a receiving module and a generating module; The display module is used to display a first interface, wherein the first interface includes at least one text generation control and first information; The receiving module is used to receive a first input to a first text generating control among the at least one text generating control; The generating module is configured to generate a first text in response to the first input received by the receiving module and based on the first information and a text generating scenario corresponding to the first text generating control; The display module is further used to display the first text in a second interface corresponding to the first text generation control.

11. The device according to claim 10, characterized in that The at least one text generation control is the first text generation control, and the first text generation control is used to indicate a 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 device according to claim 10, characterized in that The text generation scenario indicated by the first text generation control is a conversation text generation scenario, and the second interface is a conversation interface; The display module is further configured to display the conversation interface before generating the first text based on the text generation scenario corresponding to the first information and the first text generation control, wherein the conversation interface includes the conversation message; The generating module is specifically configured to generate a first text based on the first information, the conversation text generating scenario and the conversation message.

13. The device according to claim 10, characterized in that 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, and the text publishing interface includes a title text and a body text; The display module is further used for displaying a text publishing interface before generating the first text based on the text generation scenario corresponding to the first information and the first text generation control, wherein a title text generation logo and a body text generation logo are displayed in a logo selection area of ​​the text publishing interface; The receiving module is further used to receive a third input of the title text generation identifier and the body text generation identifier; The generating module is specifically configured 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 scene and the first information.

14. The device according to claim 10, characterized in that The text generation scenario indicated by the first text generation control is an order evaluation text generation scenario, the second interface is an order evaluation interface, and the order evaluation interface includes order evaluation information; The display module is further used for displaying an order evaluation interface before generating the first text based on the text generation scenario corresponding to the first information and the first text generation control, wherein at least one order evaluation logo is displayed in the logo selection area in the order evaluation interface; The receiving module is further configured to receive a fourth input of a first order evaluation identifier among the at least one order evaluation identifier; The generating module is specifically configured 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 device according to any one of claims 10 to 14, characterized in that The first text includes at least one text, and the at least one text is displayed in a text selection area in the second interface; The receiving module is further configured to receive a fifth input of a second text in 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 a text display area in the second interface in response to the fifth input received by the receiving module.

16. The device according to claim 10, characterized in that The receiving module is further configured to receive a sixth input on 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, wherein the input method interface includes the at least one text generation control.

17. The device according to claim 10, characterized in that The generation module is specifically used to input the first information and the text generation scenario into a first model, and perform semantic analysis on the first information through the first model to determine the text generation intention; and based on the text generation scenario, determining text style feature information matching the text generation scenario; And based on the text generation intention, the text style feature information and the first portrait information, the first text is generated; wherein the first portrait information includes user attribute information and user behavior information, and the first model is trained based on the portrait information.

18. The device according to claim 17, characterized in that The text generation device also includes a prediction module, a processing module and an updating module; The prediction module is used to perform text prediction based on the second portrait information and the text training sample through the initial model to obtain a third text; The processing module is used to perform a cross entropy operation on the third text and the reference text to calculate a loss value; The updating 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, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the text generation method as claimed in any one of claims 1 to 9.

20. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the text generation method according to any one of claims 1 to 9 are implemented.

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

Citation Information

Cited By

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

    WO2026175320A1