Artificial intelligence-based copywriting generation method and device, computer equipment and medium
By dynamically updating the number of candidate words and introducing parallel calculations, the problems of slow copy generation speed and poor diversity in the prior art are solved, and the efficiency and quality of copy generation are improved.
Patent Information
- Application Number
- CN202411151542.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-27
AI Technical Summary
The existing generative model and beam search algorithms are slower and less diverse in copywriting generation.
By obtaining the demand text input by the user, encoding and decoding based on the preset copywriting generation model, dynamically update the number of candidate words, calculating wake-up scores and confusion degrees, filtering candidate words with the highest comprehensive score, generating target copy, and calculating in parallel and template library to optimize copy content.
It improves the inference speed of copywriting generation model, increases the diversity and generation efficiency of copywriting content, and the quality and attractiveness of generated copywriting.
Smart Images

Figure CN119203931A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence development technology and the field of financial technology, and in particular to a method, device, computer equipment and storage medium for generating text based on artificial intelligence. Background Art
[0002] In the insurance and finance sector, with the acceleration of digitalization, the automated generation of marketing copy has become an important means to improve marketing efficiency and enhance customer interactivity. To achieve this goal, the industry widely uses generative models based on deep learning, especially Transformer structures, to build copywriting systems. With its powerful sequence modeling capabilities, this type of model has demonstrated excellent performance in understanding and generating natural language text.
[0003] In the decoding process of the generative model, a core strategy is to search for the optimal solution by maximizing the joint probability of all words in the text. This process is called "beam search". The beam search algorithm maintains a fixed-size candidate set (i.e., beam size, denoted as N) and only retains the N words with the highest probability at each decoding step as the starting point for subsequent decoding, thereby effectively limiting the scale of the decoding space and improving generation efficiency.
[0004] However, the setting of the beam size parameter N in the beam search algorithm has become a trade-off. Traditionally, N is a hyperparameter that needs to be manually adjusted, and its value directly affects the quality and diversity of the generated copy. Specifically, when N is set to a large value, the model will be very slow in the inference process, resulting in slower copy text generation. If N is set too small, the diversity of the text copy will be poor. Summary of the invention
[0005] The purpose of the embodiments of the present application is to propose a copywriting generation method, device, computer equipment and storage medium based on artificial intelligence to solve the technical problems that the existing copywriting generation method based on generative models and beam search algorithms has slow copywriting text generation speed and poor text copywriting diversity.
[0006] In order to solve the above technical problems, the present application embodiment provides a method for generating text based on artificial intelligence, which adopts the following technical solutions:
[0007] Get the required text entered by the user;
[0008] Encode the demand text based on an encoder in a preset copywriting generation model to obtain a corresponding text vector;
[0009] Setting the number of candidate words corresponding to the decoder in the copywriting generation model, and setting the initial state of the decoder;
[0010] Processing the text vector based on the decoder to generate a candidate word list corresponding to the number of candidate words based on a current state at each decoding time step;
[0011] For each candidate word in the candidate word list, calculating the awakening score and perplexity corresponding to the candidate word, and calculating the comprehensive score corresponding to the candidate word based on the awakening score and perplexity of the candidate word;
[0012] Filter out a specified number of candidate words with the highest comprehensive scores from all the candidate words, use the specified candidate words as candidate words for the next decoding time step, and update the number of candidate words based on the specified number;
[0013] When it is detected that the decoding end condition is met, all generated candidate sequences are obtained, and the target comprehensive score of each candidate sequence is counted;
[0014] A target candidate sequence with the highest target comprehensive score is screened out from the candidate sequences, and a target copy corresponding to the requirement text is generated based on the target candidate sequence.
[0015] Furthermore, the step of calculating the arousal score and perplexity corresponding to the candidate word specifically includes:
[0016] Call the preset wake-up model;
[0017] Performing a wake-up calculation process on the candidate word based on the wake-up model to obtain a wake-up score of the candidate word;
[0018] Get the preset perplexity function;
[0019] Obtaining a specified candidate sequence corresponding to the candidate word;
[0020] The specified candidate sequence is calculated based on the perplexity function to obtain the perplexity of the candidate word.
[0021] Furthermore, the step of calculating a comprehensive score corresponding to the candidate word based on the awakening score and confusion of the candidate word specifically includes:
[0022] Get the preset comprehensive processing function;
[0023] Obtaining a first preset hyperparameter value and a second preset hyperparameter value corresponding to the comprehensive processing function;
[0024] Based on the number of candidate words, the comprehensive processing function, the first preset hyperparameter value, and the second preset hyperparameter value, the awakening score and the perplexity of the candidate words are calculated to obtain corresponding calculation results;
[0025] The calculation result is used as the comprehensive score corresponding to the candidate word.
[0026] Furthermore, the step of obtaining all generated candidate sequences and calculating the target comprehensive score of each candidate sequence specifically includes:
[0027] Get all generated candidate sequences;
[0028] Dividing all the candidate sequences into batches corresponding to a preset number; wherein each batch contains a certain number of candidate sequences;
[0029] Get the preset parallel computing strategy;
[0030] The sum of the comprehensive scores of all candidate words contained in the candidate sequences in each of the batches is calculated based on the parallel computing strategy to obtain the target comprehensive score of the candidate sequences in each of the batches.
[0031] Furthermore, the step of generating a target text corresponding to the demand text based on the target candidate sequence specifically includes:
[0032] Performing useless information removal processing on the target candidate sequence to obtain a corresponding first text;
[0033] Performing format adjustment processing on the first text to obtain a corresponding second text;
[0034] Optimizing the second text based on a preset optimization strategy to obtain a corresponding third text;
[0035] The target text corresponding to the requirement text is generated based on the third text.
[0036] Furthermore, the step of generating the target text corresponding to the requirement text based on the third text specifically includes:
[0037] Call the preset template library;
[0038] Filtering out a target template matching the third text from the template library;
[0039] Filling the target template with content based on the target copy to obtain a filled first copy;
[0040] Fine-tune the first copy to obtain a corresponding second copy;
[0041] The second text is used as the target text.
[0042] Furthermore, after the step of selecting the target candidate sequence with the highest target comprehensive score from the candidate sequences and generating the target copy corresponding to the demand text based on the target candidate sequence, the method further includes:
[0043] Obtaining user information of the user;
[0044] Acquire communication information of the user based on the user information;
[0045] Call the preset user interface;
[0046] Based on the communication information, the target document is pushed to the user using the user interface.
[0047] In order to solve the above technical problems, the embodiment of the present application further provides a copywriting generation device based on artificial intelligence, which adopts the following technical solution:
[0048] The first acquisition module is used to acquire the requirement text input by the user;
[0049] An encoding module, used for encoding the demand text based on an encoder in a preset copywriting generation model to obtain a corresponding text vector;
[0050] A setting module, used to set the number of candidate words corresponding to the decoder in the copywriting generation model and set the initial state of the decoder;
[0051] A first processing module, configured to process the text vector based on the decoder, so as to generate a candidate word list corresponding to the number of candidate words based on a current state at each decoding time step;
[0052] A calculation module, configured to calculate, for each candidate word in the candidate word list, an awakening score and a perplexity corresponding to the candidate word, and calculate a comprehensive score corresponding to the candidate word based on the awakening score and the perplexity of the candidate word;
[0053] A second processing module is used to select a specified number of candidate words with the highest comprehensive scores from all the candidate words, use the specified candidate words as candidate words for the next decoding time step, and update the number of candidate words based on the specified number;
[0054] A statistics module, used for obtaining all generated candidate sequences and counting the target comprehensive scores of the candidate sequences when the decoding end condition is detected to be met;
[0055] A generation module is used to select a target candidate sequence with the highest target comprehensive score from the candidate sequences, and generate a target copy corresponding to the demand text based on the target candidate sequence.
[0056] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0057] Get the required text entered by the user;
[0058] Encode the demand text based on an encoder in a preset copywriting generation model to obtain a corresponding text vector;
[0059] Setting the number of candidate words corresponding to the decoder in the copywriting generation model, and setting the initial state of the decoder;
[0060] Processing the text vector based on the decoder to generate a candidate word list corresponding to the number of candidate words based on a current state at each decoding time step;
[0061] For each candidate word in the candidate word list, calculating the awakening score and perplexity corresponding to the candidate word, and calculating the comprehensive score corresponding to the candidate word based on the awakening score and perplexity of the candidate word;
[0062] Filter out a specified number of candidate words with the highest comprehensive scores from all the candidate words, use the specified candidate words as candidate words for the next decoding time step, and update the number of candidate words based on the specified number;
[0063] When it is detected that the decoding end condition is met, all generated candidate sequences are obtained, and the target comprehensive score of each candidate sequence is counted;
[0064] A target candidate sequence with the highest target comprehensive score is screened out from the candidate sequences, and a target copy corresponding to the requirement text is generated based on the target candidate sequence.
[0065] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0066] Get the required text entered by the user;
[0067] Encode the demand text based on an encoder in a preset copywriting generation model to obtain a corresponding text vector;
[0068] Setting the number of candidate words corresponding to the decoder in the copywriting generation model, and setting the initial state of the decoder;
[0069] Processing the text vector based on the decoder to generate a candidate word list corresponding to the number of candidate words based on a current state at each decoding time step;
[0070] For each candidate word in the candidate word list, calculating the awakening score and perplexity corresponding to the candidate word, and calculating the comprehensive score corresponding to the candidate word based on the awakening score and perplexity of the candidate word;
[0071] Filter out a specified number of candidate words with the highest comprehensive scores from all the candidate words, use the specified candidate words as candidate words for the next decoding time step, and update the number of candidate words based on the specified number;
[0072] When it is detected that the decoding end condition is met, all generated candidate sequences are obtained, and the target comprehensive score of each candidate sequence is counted;
[0073] A target candidate sequence with the highest target comprehensive score is screened out from the candidate sequences, and a target copy corresponding to the requirement text is generated based on the target candidate sequence.
[0074] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0075] The present application first obtains the demand text input by the user, and encodes the demand text based on the encoder in the preset text generation model to obtain the corresponding text vector; then sets the number of candidate words corresponding to the decoder in the text generation model, and sets the initial state of the decoder; then processes the text vector based on the decoder to generate a candidate word list corresponding to the number of candidate words based on the current state at each decoding time step; for each candidate word in the candidate word list, calculates the awakening score and perplexity corresponding to the candidate word, and calculates the comprehensive score corresponding to the candidate word based on the awakening score and perplexity of the candidate word; subsequently, a specified number of designated candidate words with the highest comprehensive score are screened out from all the candidate words, and the designated candidate words are used as the candidate words for the next decoding time step, and the number of candidate words is updated based on the specified number; when it is detected that the decoding end condition is met, all generated candidate sequences are obtained, and the target comprehensive score of each candidate sequence is counted; finally, a target candidate sequence with the highest target comprehensive score is screened out from the candidate sequence, and a target text corresponding to the demand text is generated based on the target candidate sequence. When the encoder of the copywriting generation model is used to process the text vector corresponding to the user input demand text to obtain a candidate word list, the application calculates the awakening score and perplexity corresponding to each candidate word in the candidate word list, and calculates the comprehensive score corresponding to the candidate word based on the awakening score and perplexity of the candidate word, and then selects a specified number of designated candidate words with the highest comprehensive score from all the candidate words and updates the number of candidate words based on the specified number, thereby realizing the dynamic update of the number of candidate words, which can greatly improve the reasoning speed of the copywriting generation model, and thus improve the generation efficiency of the target copy. In addition, by introducing a dynamic number of candidate words, the diversity of copywriting content generation can be effectively increased. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0077] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0078] Figure 2 A flowchart of an embodiment of a method for generating text based on artificial intelligence according to the present application;
[0079] Figure 3It is a structural schematic diagram of an embodiment of a text generation device based on artificial intelligence according to the present application;
[0080] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0081] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0082] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0083] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0084] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0085] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0086] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.
[0087] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0088] It should be noted that the artificial intelligence-based text generation method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the artificial intelligence-based text generation device is generally set in the server / terminal device.
[0089] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0090] Continue to refer Figure 2 , showing a flow chart of an embodiment of the method for generating text based on artificial intelligence according to the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The method for generating text based on artificial intelligence provided in the embodiment of the present application can be applied to any scenario where product recommendations are required, and the method for generating text based on artificial intelligence can be applied to products in these scenarios, for example, product recommendations in the field of finance and insurance. The method for generating text based on artificial intelligence comprises the following steps:
[0091] Step S201, obtaining the requirement text input by the user.
[0092] In this embodiment, the electronic device (e.g. Figure 1The server / terminal device shown in the figure) can obtain the demand text input by the user through a wired connection or a wireless connection. It should be pointed out that the above-mentioned wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future. The above-mentioned demand text is a demand description of the content of the copy to be generated provided by the user according to the actual copy generation needs. Exemplarily, in the business scenario of marketing copy generation for financial insurance, the content of the above-mentioned demand text may include: "Generate a copy for family elderly health insurance."
[0093] Step S202: Encode the demand text based on the encoder in the preset copy generation model to obtain a corresponding text vector.
[0094] In this embodiment, the above-mentioned copywriting generation model can adopt an encoding and decoding model of any structure, such as LSTM or Transformer, etc., and it is only necessary to ensure that the model type of the copywriting generation model is an autoregressive model, that is, the current word is predicted by the words generated in the previous order, and each word is predicted one by one in order. The above-mentioned copywriting generation model includes an encoder and a decoder. Among them, the demand text can be encoded into a corresponding series of text vectors by using the encoder in the copywriting generation model, and these text vectors capture the semantic information of the text.
[0095] Step S203, setting the number of candidate words corresponding to the decoder in the text generation model, and setting the initial state of the decoder.
[0096] In this embodiment, the number of candidate words refers to an initial beamsize set for the copy generation model, which means that at the beginning of each decoding time step, the copy generation model will consider bt most likely candidate words. There is no specific limitation on the number of candidate words, which can be set according to actual business processing requirements, for example, set to 10. In addition, the initial state of the decoder is also prepared at the same time, including the output of the encoder and the special start symbol.
[0097] Step S204, processing the text vector based on the decoder to generate a candidate word list corresponding to the number of candidate words based on the current state at each decoding time step.
[0098] In this embodiment, for each time step t (from 1 to T, T is the total number of words in the entire generated copy), the decoder in the copy generation model can be used to obtain the currently generated word sequence (i.e., the words from the first moment to the moment t-1). Then, the decoder is used to generate a probability distribution based on the current context, which covers every word in the vocabulary. Then, based on this probability distribution, the words with the highest probability and the same number as the above candidate words are selected as the corresponding candidate word list.
[0099] Step S205, for each candidate word in the candidate word list, calculate the awakening score and confusion corresponding to the candidate word, and calculate the comprehensive score corresponding to the candidate word based on the awakening score and confusion of the candidate word.
[0100] In this embodiment, the above-mentioned calculation of the awakening score and confusion corresponding to the candidate word, and the specific implementation process of calculating the comprehensive score corresponding to the candidate word based on the awakening score and confusion of the candidate word, this application will provide further detailed descriptions of this in subsequent specific embodiments, and will not be elaborated here.
[0101] Step S206, selecting a specified number of candidate words with the highest comprehensive scores from all the candidate words, using the specified candidate words as candidate words for the next decoding time step, and updating the number of candidate words based on the specified number.
[0102] In this embodiment, all comprehensive scores can be numerically compared to select a specified number of designated candidate words with the highest comprehensive scores from all the candidate words. The above-mentioned update process refers to using the specified number as the beam size (number of candidate words) of the next time step to complete the update of the number of candidate words.
[0103] Step S207, when it is detected that the decoding end condition is met, all generated candidate sequences are obtained, and the target comprehensive score of each candidate sequence is counted.
[0104] In this embodiment, the above decoding end condition means that the decoding process ends when an end symbol is generated or a preset maximum length is reached. The specific implementation process of obtaining all generated candidate sequences and counting the target comprehensive scores of each candidate sequence will be further described in detail in the subsequent specific embodiments of this application, and will not be elaborated on here.
[0105] Step S208, selecting a target candidate sequence with the highest target comprehensive score from the candidate sequences, and generating a target copy corresponding to the demand text based on the target candidate sequence.
[0106] In this embodiment, the specific implementation process of generating the target text corresponding to the demand text based on the target candidate sequence will be further described in detail in subsequent specific embodiments of the present application, and will not be elaborated on here.
[0107] When the encoder of the copywriting generation model is used to process the text vector corresponding to the user input demand text to obtain a candidate word list, the application calculates the awakening score and perplexity corresponding to each candidate word in the candidate word list, and calculates the comprehensive score corresponding to the candidate word based on the awakening score and perplexity of the candidate word, and then selects a specified number of designated candidate words with the highest comprehensive score from all the candidate words and updates the number of candidate words based on the specified number, thereby realizing the dynamic update of the number of candidate words, which can greatly improve the reasoning speed of the copywriting generation model, and thus improve the generation efficiency of the target copy. In addition, by introducing a dynamic number of candidate words, the diversity of copywriting content generation can be effectively increased.
[0108] In some optional implementations, the calculating of the arousal score and the perplexity corresponding to the candidate word in step S205 includes the following steps:
[0109] Call the preset wake-up model.
[0110] In this embodiment, the overall goal of constructing the above-mentioned copywriting generation model is to minimize the following total loss L. The total loss L includes: Among them, t is the current moment, that is, the moment when the decoder generates the current word, and T can be understood as all moments, that is, the total number of words generated in the entire copy. E is the expectation, which generates the average value of all words R. At each time step t, the difference between the dynamic beam size and the R value under the initial beam size is calculated and added to the total loss L. The total loss L is minimized as the average loss of all time steps t. Specifically, the above-mentioned awakening model is generated after training the MLP model using labeled copy data. The specific training process of the awakening model includes: preparing a large amount of labeled copy data, annotating its interestingness, transitions, homophonic puns and other features, and assigning corresponding scores (such as 1-10 points). Specifically, the parts with transitions or homophonic puns or interesting expressions are labeled and scored, with ordinary narration being 1 point, interesting 5 points, transitions being 7 points, homophonic puns being 9 points, and other similar labeling distributions, and can be manually adjusted according to actual needs. Then, the MLP model is called. The MLP model is a model that uses two fully connected layers and a softmax activation function. Based on the goal of minimizing the error between the model prediction score and the manually labeled score, the MLP model is trained using the above labeled copywriting data to obtain the trained wake-up model. The trained wake-up model can be used to score the input and output a corresponding wake-up score.
[0111] Performing wake-up calculation processing on the candidate word based on the wake-up model to obtain a wake-up score of the candidate word.
[0112] In this embodiment, the awakening score is specifically calculated by using the event trigger likelihood algorithm to calculate the candidate words currently generated cumulatively. The steps of calculating the awakening score through the awakening model specifically include: 1. Using the part-of-speech tool to perform part-of-speech tagging on each generated candidate word, that is, the current word is a noun or a verb, etc.; 2. When the generated word is a verb, it is regarded as an event occurrence, and the awakening score calculation is triggered; 3. When triggered, all candidate words from the first moment to the current moment are input into the awakening model, and the corresponding score value among the 10 values included in 1-10 points is output; 4. The score value corresponding to the maximum Softmax value is the awakening score. By using the awakening model to calculate the awakening score for the generated diverse content, the model is encouraged to generate interesting copywriting, which can improve the user's preference and increase the marketing effect.
[0113] Get the preset perplexity function.
[0114] In this embodiment, the perplexity function is specifically a perplexity() function, which is used to calculate the perplexity of the cumulative word from selecting the generated word from the beam size (number of candidate words) at the first moment to selecting the i-th word from the beam size at the current moment. The formula related to the perplexity function, that is, the perplexity function after log processing, includes: Among them, perplexity() is the perplexity function, w i is the current word, p() represents the generation of the current word w given the first word to the i-1th word. i What is the probability of . m is the number of current words.
[0115] Obtain a specified candidate sequence corresponding to the candidate word.
[0116] In this embodiment, the above-mentioned designated candidate sequence is a sequence including the candidate words.
[0117] The specified candidate sequence is calculated based on the perplexity function to obtain the perplexity of the candidate word.
[0118] In this embodiment, information extraction can be performed on the above-mentioned designated candidate sequence to obtain parameters corresponding to the above-mentioned perplexity function, and then the parameters can be substituted into the above-mentioned perplexity function for calculation processing to obtain the perplexity of the candidate word. The lower the perplexity value obtained, the better the modeling effect.
[0119] The present application calls a preset awakening model; then performs awakening calculation processing on the candidate word based on the awakening model to obtain the awakening score of the candidate word; then obtains a preset perplexity function; and obtains a specified candidate sequence corresponding to the candidate word; and then performs calculation processing on the specified candidate sequence based on the perplexity function to obtain the perplexity of the candidate word. The present application can quickly and accurately calculate the awakening score and perplexity corresponding to the candidate word by using the awakening model and perplexity function, thereby ensuring the data accuracy of the awakening score and perplexity of the candidate word.
[0120] In some optional implementations of this embodiment, the step S205 of calculating the comprehensive score corresponding to the candidate word based on the awakening score and the confusion of the candidate word includes the following steps:
[0121] Get the preset comprehensive processing function.
[0122] In this embodiment, the above comprehensive processing function specifically includes: Among them, the comprehensive processing function R is a function of the number of candidate words, that is, beam size (b) and time t, that is, calculating the R value at the current time t. The calculation of the R value is to maximize the A function and minimize the ppl function and beam size (b). Because the beam size in this application changes dynamically, it is not a fixed value. i is an index value from 1 to beam size, that is, the decoder will generate a set of words of the same beam size. For example, if the initial beam size is manually set to 10, the beam size at the current time t is 10, then the decoder will generate 10 different words, and i represents the number of these 10 words. |bt| is the manually set beam size (10), which means that the beam size at the current time t is 10. α and β are both manually set hyperparameters and correlation coefficients. This application sets α to 0.00015 and β to 0.0003. c represents the word generated by the decoder at the current time t, c i Represents the i-th word in the beam size (since the copywriting generation model is an autoregressive model, the i-th word is actually the concatenation of the cumulative words generated at the first moment to the i-th word at the current moment): Among them, A(s) is the cumulative awakening score of the word generated from the first moment selected from the beam size to the word generated at the current moment, and w i is the word generated by the model at the i-th moment, a(w) is the awakening score of the current generated word, obtained through an awakening model, which calculates the awakening score for each word. In addition, Unlike BT, It means that at time t, the model calculates the beam size from the first word to the i-th word. value, and then take the i-th largest R value in the beam size corresponding to i as the final beam size, that is, Value. The value of will be smaller than bt.
[0123] Obtain a first preset hyperparameter value and a second preset hyperparameter value corresponding to the comprehensive processing function.
[0124] In this embodiment, there is no specific limitation on the values of the first preset hyperparameter value and the second preset hyperparameter value, which can be set according to actual business processing requirements. Preferably, α in the comprehensive processing function is set to 0.00015, and β is set to 0.0003.
[0125] Based on the number of candidate words, the comprehensive processing function, the first preset hyperparameter value and the second preset hyperparameter value, the awakening score and confusion of the candidate words are calculated and processed to obtain corresponding calculation results.
[0126] In this embodiment, the awakening score, confusion, number of candidate words, the first preset hyperparameter value and the second preset hyperparameter value of the candidate word are substituted into the above-mentioned comprehensive processing function for calculation and processing, so as to obtain the corresponding calculation result, that is, the comprehensive score corresponding to the candidate word.
[0127] The calculation result is used as the comprehensive score corresponding to the candidate word.
[0128] The present application obtains a preset comprehensive processing function; then obtains a first preset hyperparameter value and a second preset hyperparameter value corresponding to the comprehensive processing function; then calculates and processes the awakening score and confusion of the candidate word based on the number of candidate words, the comprehensive processing function, the first preset hyperparameter value and the second preset hyperparameter value to obtain a corresponding calculation result; and subsequently uses the calculation result as the comprehensive score corresponding to the candidate word. The present application obtains a first preset hyperparameter value and a second preset hyperparameter value corresponding to the preset comprehensive processing function, and then calculates and processes the awakening score and confusion of the candidate word based on the number of candidate words, the comprehensive processing function, the first preset hyperparameter value and the second preset hyperparameter value, so that the comprehensive score corresponding to the candidate word can be generated quickly and accurately, ensuring the data accuracy of the generated comprehensive score.
[0129] In some optional implementations, step S207 includes the following steps:
[0130] Get all generated candidate sequences.
[0131] In this embodiment, the candidate sequence is all candidate sequences output after the decoder in the copywriting generation model completes the decoding process of the text vector, that is, when the decoding end condition is met. The candidate sequence is a sequence composed of multiple candidate words.
[0132] All the candidate sequences are divided into batches corresponding to a preset number; wherein each batch contains a certain number of candidate sequences.
[0133] In this embodiment, all candidate sequences are divided into corresponding batches according to a preset number, and each batch contains a certain number of candidate sequences. The values of the preset number and the certain number are not specifically limited and can be set according to the business processing requirements of time.
[0134] Get the preset parallel computing strategy.
[0135] In this embodiment, the above-mentioned parallel computing strategy may include a strategy of using multi-threading, multi-process or a distributed computing framework (such as Apache Spark) for parallel computing.
[0136] The sum of the comprehensive scores of all candidate words contained in the candidate sequences in each of the batches is calculated based on the parallel computing strategy to obtain the target comprehensive score of the candidate sequences in each of the batches.
[0137] In this embodiment, the strategy content corresponding to the above-mentioned parallel computing strategy can be executed to calculate the sum of the comprehensive scores of all candidate words contained in the candidate sequences in each of the batches, thereby obtaining the target comprehensive score of the candidate sequences in each of the batches.
[0138] The present application obtains all generated candidate sequences; then divides all the candidate sequences into batches corresponding to a preset number; then obtains a preset parallel computing strategy; and subsequently calculates the sum of the comprehensive scores of all candidate words contained in the candidate sequences in each of the batches based on the parallel computing strategy to obtain the target comprehensive score of the candidate sequences in each of the batches. The present application divides the generated candidate sequences into batches corresponding to a preset number, and then uses a parallel computing strategy to calculate the sum of the comprehensive scores of all candidate words contained in the candidate sequences in each of the batches, so as to quickly and accurately obtain the target comprehensive score of the candidate sequences in each of the batches, effectively improve the calculation efficiency of the target comprehensive score, optimize the processing performance of the system, and help avoid the phenomenon of performance bottlenecks.
[0139] In some optional implementations, the step of generating a target text corresponding to the requirement text based on the target candidate sequence in step S208 includes the following steps:
[0140] Perform useless information removal processing on the target candidate sequence to obtain a corresponding first text.
[0141] In this embodiment, the useless information removal process refers to checking and removing all unnecessary special symbols in the target candidate sequence, such as a start symbol, an end symbol, a filling symbol, etc.
[0142] The first text is formatted to obtain a corresponding second text.
[0143] In this embodiment, the first text may be formatted according to a preset formatting rule to obtain a corresponding second text. The formatting rule may be set according to actual business processing requirements, for example, it may include formatting contents such as capitalization of the first letter, paragraph separation, list item formatting, etc.
[0144] The second text is optimized based on a preset optimization strategy to obtain a corresponding third text.
[0145] In this embodiment, the above optimization strategy is specifically a strategy for optimizing readability. Specifically, the readability of the text can be evaluated by using natural language processing (NLP) technology to check the fluency and coherence of the text to ensure that the sentence structure is clear and the grammar is correct. Alternatively, complex sentences or paragraphs can be simplified using text summarization or rewriting technology to improve the readability of the second text.
[0146] The target text corresponding to the requirement text is generated based on the third text.
[0147] In this embodiment, the specific implementation process of generating the target text corresponding to the demand text based on the third text will be described in further detail in subsequent specific embodiments of the present application, and will not be elaborated on here.
[0148] The present application performs useless information removal processing on the target candidate sequence to obtain a corresponding first text; then performs format adjustment processing on the first text to obtain a corresponding second text; then optimizes the second text based on a preset optimization strategy to obtain a corresponding third text; and subsequently generates the target copy corresponding to the required text based on the third text. After selecting the target candidate sequence with the highest target comprehensive score from the candidate sequence, the present application will also intelligently perform useless information removal processing, format adjustment processing, and optimization processing on the target candidate sequence, thereby ensuring the quality and effect of the generated target copy, and ensuring the accuracy of the generated target copy.
[0149] In some optional implementations of this embodiment, generating the target text corresponding to the requirement text based on the third text includes the following steps:
[0150] Call the preset template library.
[0151] In this embodiment, the template library is a database containing a series of marketing copy templates pre-built according to actual marketing business needs. These templates contain placeholders for subsequent insertion of specific words and phrases.
[0152] A target template matching the third text is selected from the template library.
[0153] In this embodiment, the target template is obtained by extracting the text content, theme or keywords of the third text and then using string matching, regular expression matching or natural language processing (NLP) technology to select the best matching template from the template library.
[0154] The target template is filled with content based on the target text to obtain a filled first text.
[0155] In this embodiment, the placeholders in the target template are replaced with specific words or phrases. The specific replacement content can be automatically generated by extracting keywords from the generated target text, or can also be selected from a predefined vocabulary library.
[0156] The first text is fine-tuned to obtain a corresponding second text.
[0157] In this embodiment, the above-mentioned fine-tuning processing refers to checking the fluency and coherence of the generated first copy after replacing the placeholder of the target template to ensure that the replaced content is seamlessly connected with other parts of the target template, thereby obtaining the corresponding second copy.
[0158] The second text is used as the target text.
[0159] This application calls a preset template library; then selects a target template that matches the third text from the template library; then fills the target template with content based on the target text to obtain a filled first text; then fine-tunes the first text to obtain a corresponding second text, and uses the second text as the target text. After optimizing the second text based on a preset optimization strategy to obtain the corresponding third text, this application intelligently selects a target template that matches the third text from the template library, then fills the target template with content based on the target text to obtain the filled first text, and then fine-tunes the second text to generate the final target text, thereby achieving content addition processing for the text based on the use of the target template, effectively enhancing the attractiveness and effect of the generated target text.
[0160] In some optional implementations of this embodiment, after step S208, the electronic device may further perform the following steps:
[0161] Get user information of the user.
[0162] In this embodiment, the user information may refer to the user's name information.
[0163] Acquire the communication information of the user based on the user information.
[0164] In this embodiment, the communication information matching the user information can be queried by using the user information. The communication information may include a mobile phone number or an email address.
[0165] Call the default user interface.
[0166] In this embodiment, the above user interface is a pre-built dedicated interface for data interaction with the user.
[0167] Based on the communication information, the target document is pushed to the user using the user interface.
[0168] In this embodiment, the generated target document can be sent to the communication terminal corresponding to the communication information by using the user interface to complete the push processing of the target document.
[0169] This application obtains the user information of the user; then obtains the communication information of the user based on the user information; then calls a preset user interface; and subsequently uses the user interface to push the target copy to the user based on the communication information. After generating a target copy corresponding to the demand text based on the use of a copy generation model, this application will also intelligently obtain the corresponding communication information based on the user's user information, and then call a preset user interface to push the target copy to the user, so as to complete an intelligent response to the demand text input by the user. Since the use of a copy generation model improves the generation efficiency of the target copy, thereby reducing the time spent by the user to receive the target copy, it is beneficial to improve the user experience.
[0170] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0171] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target document, the above-mentioned target document can also be stored in a node of a blockchain.
[0172] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0173] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0174] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0175] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0176] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0177] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a text generation device based on artificial intelligence, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0178] like Figure 3 As shown, the artificial intelligence-based copywriting generation device 300 described in this embodiment includes: a first acquisition module 301, an encoding module 302, a setting module 303, a first processing module 304, a calculation module 305, a second processing module 306, a statistics module 307 and a generation module 308. Among them:
[0179] The first acquisition module 301 is used to acquire the requirement text input by the user;
[0180] An encoding module 302 is used to encode the demand text based on an encoder in a preset copywriting generation model to obtain a corresponding text vector;
[0181] A setting module 303 is used to set the number of candidate words corresponding to the decoder in the text generation model and set the initial state of the decoder;
[0182] A first processing module 304 is used to process the text vector based on the decoder to generate a candidate word list corresponding to the number of candidate words based on the current state at each decoding time step;
[0183] A calculation module 305 is used to calculate the awakening score and perplexity corresponding to each candidate word in the candidate word list, and calculate the comprehensive score corresponding to the candidate word based on the awakening score and perplexity of the candidate word;
[0184] The second processing module 306 is used to select a specified number of candidate words with the highest comprehensive scores from all the candidate words, use the specified candidate words as candidate words for the next decoding time step, and update the number of candidate words based on the specified number;
[0185] A statistics module 307 is used to obtain all generated candidate sequences and count the target comprehensive scores of the candidate sequences when it is detected that the decoding end condition is met;
[0186] The generating module 308 is used to select a target candidate sequence with the highest target comprehensive score from the candidate sequences, and generate a target copy corresponding to the requirement text based on the target candidate sequence.
[0187] In this embodiment, the operations performed by the above modules or units correspond one-to-one to the steps of the artificial intelligence-based copywriting generation method in the aforementioned implementation mode, and will not be repeated here.
[0188] In some optional implementations of this embodiment, the calculation module 305 includes:
[0189] The calling submodule is used to call the preset wake-up model;
[0190] A first calculation submodule, configured to perform a wake-up calculation process on the candidate word based on the wake-up model to obtain a wake-up score of the candidate word;
[0191] A first acquisition submodule is used to obtain a preset perplexity function;
[0192] A second acquisition submodule is used to acquire a specified candidate sequence corresponding to the candidate word;
[0193] The second calculation submodule is used to calculate the specified candidate sequence based on the perplexity function to obtain the perplexity of the candidate word.
[0194] In some optional implementations of this embodiment, the calculation module 305 further includes:
[0195] The third acquisition submodule is used to acquire a preset comprehensive processing function;
[0196] A fourth acquisition submodule, used to acquire a first preset hyperparameter value and a second preset hyperparameter value corresponding to the comprehensive processing function;
[0197] A third calculation submodule, configured to calculate the awakening score and the perplexity of the candidate word based on the number of candidate words, the comprehensive processing function, the first preset hyperparameter value, and the second preset hyperparameter value to obtain a corresponding calculation result;
[0198] A determination submodule is used to use the calculation result as a comprehensive score corresponding to the candidate word.
[0199] In some optional implementations of this embodiment, the statistics module 307 includes:
[0200] The fifth acquisition submodule is used to acquire all generated candidate sequences;
[0201] A division submodule, used to divide all the candidate sequences into batches corresponding to a preset number; wherein each batch contains a certain number of candidate sequences;
[0202] A sixth acquisition submodule, used to acquire a preset parallel computing strategy;
[0203] The fourth calculation submodule is used to calculate the sum of the comprehensive scores of all candidate words contained in the candidate sequences in each of the batches based on the parallel calculation strategy to obtain the target comprehensive score of the candidate sequence in each of the batches.
[0204] In some optional implementations of this embodiment, the generating module 308 includes:
[0205] A removal submodule, used for performing useless information removal processing on the target candidate sequence to obtain a corresponding first text;
[0206] An adjustment submodule, used for performing format adjustment processing on the first text to obtain a corresponding second text;
[0207] An optimization submodule, configured to optimize the second text based on a preset optimization strategy to obtain a corresponding third text;
[0208] A generating submodule is used to generate the target text corresponding to the requirement text based on the third text.
[0209] In some optional implementations of this embodiment, the generating submodule includes:
[0210] A calling unit, used for calling a preset template library;
[0211] A screening unit, used for screening out a target template matching the third text from the template library;
[0212] A filling unit, configured to perform content filling processing on the target template based on the target copy to obtain a filled first copy;
[0213] A fine-tuning unit, configured to perform fine-tuning on the first text to obtain a corresponding second text;
[0214] A determination unit is used to use the second text as the target text.
[0215] In some optional implementations of this embodiment, the artificial intelligence-based copywriting generation device further includes:
[0216] A second acquisition module is used to acquire user information of the user;
[0217] A third acquisition module, used to acquire the communication information of the user based on the user information;
[0218] A calling module, used for calling a preset user interface;
[0219] A push module is used to push the target document to the user using the user interface based on the communication information.
[0220] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0221] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0222] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0223] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk equipped on the computer device 4, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the copywriting generation method based on artificial intelligence, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0224] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions for running the artificial intelligence-based copywriting generation method.
[0225] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0226] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned artificial intelligence-based copywriting generation method.
[0227] 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 software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0228] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A method for generating text based on artificial intelligence, characterized in that: The steps include: Get the required text entered by the user; Encode the demand text based on an encoder in a preset copywriting generation model to obtain a corresponding text vector; Setting the number of candidate words corresponding to the decoder in the copywriting generation model, and setting the initial state of the decoder; Processing the text vector based on the decoder to generate a candidate word list corresponding to the number of candidate words based on a current state at each decoding time step; For each candidate word in the candidate word list, calculating the awakening score and perplexity corresponding to the candidate word, and calculating the comprehensive score corresponding to the candidate word based on the awakening score and perplexity of the candidate word; Filter out a specified number of candidate words with the highest comprehensive scores from all the candidate words, use the specified candidate words as candidate words for the next decoding time step, and update the number of candidate words based on the specified number; When it is detected that the decoding end condition is met, all generated candidate sequences are obtained, and the target comprehensive score of each candidate sequence is counted; A target candidate sequence with the highest target comprehensive score is screened out from the candidate sequences, and a target copy corresponding to the requirement text is generated based on the target candidate sequence.
2. The method for generating text based on artificial intelligence according to claim 1, characterized in that: The step of calculating the arousal score and the perplexity corresponding to the candidate word specifically includes: Call the preset wake-up model; Performing a wake-up calculation process on the candidate word based on the wake-up model to obtain a wake-up score of the candidate word; Get the preset perplexity function; Obtaining a specified candidate sequence corresponding to the candidate word; The specified candidate sequence is calculated based on the perplexity function to obtain the perplexity of the candidate word.
3. The method for generating text based on artificial intelligence according to claim 1, characterized in that: The step of calculating the comprehensive score corresponding to the candidate word based on the awakening score and the confusion of the candidate word specifically includes: Get the preset comprehensive processing function; Obtaining a first preset hyperparameter value and a second preset hyperparameter value corresponding to the comprehensive processing function; Based on the number of candidate words, the comprehensive processing function, the first preset hyperparameter value, and the second preset hyperparameter value, the awakening score and the perplexity of the candidate words are calculated to obtain corresponding calculation results; The calculation result is used as the comprehensive score corresponding to the candidate word.
4. The method for generating text based on artificial intelligence according to claim 1, characterized in that: The step of obtaining all generated candidate sequences and calculating the target comprehensive score of each candidate sequence specifically includes: Get all generated candidate sequences; Dividing all the candidate sequences into batches corresponding to a preset number; wherein each batch contains a certain number of candidate sequences; Get the preset parallel computing strategy; The sum of the comprehensive scores of all candidate words contained in the candidate sequences in each of the batches is calculated based on the parallel computing strategy to obtain the target comprehensive score of the candidate sequences in each of the batches.
5. The method for generating text based on artificial intelligence according to claim 1, characterized in that: The step of generating a target text corresponding to the demand text based on the target candidate sequence specifically includes: Performing useless information removal processing on the target candidate sequence to obtain a corresponding first text; Performing format adjustment processing on the first text to obtain a corresponding second text; Optimizing the second text based on a preset optimization strategy to obtain a corresponding third text; The target text corresponding to the requirement text is generated based on the third text.
6. The method for generating text based on artificial intelligence according to claim 5, characterized in that: The step of generating the target text corresponding to the requirement text based on the third text specifically includes: Call the preset template library; Filtering out a target template matching the third text from the template library; Filling the target template with content based on the target copy to obtain a filled first copy; Fine-tune the first copy to obtain a corresponding second copy; The second text is used as the target text.
7. The method for generating text based on artificial intelligence according to claim 1, characterized in that: After the step of selecting a target candidate sequence with the highest target comprehensive score from the candidate sequences and generating a target copy corresponding to the requirement text based on the target candidate sequence, the method further includes: Obtaining user information of the user; Acquire communication information of the user based on the user information; Call the preset user interface; Based on the communication information, the target document is pushed to the user using the user interface.
8. A copywriting generation device based on artificial intelligence, characterized in that: include: The first acquisition module is used to acquire the requirement text input by the user; An encoding module, used for encoding the demand text based on an encoder in a preset copywriting generation model to obtain a corresponding text vector; A setting module, used to set the number of candidate words corresponding to the decoder in the copywriting generation model and set the initial state of the decoder; A first processing module, configured to process the text vector based on the decoder, so as to generate a candidate word list corresponding to the number of candidate words based on a current state at each decoding time step; A calculation module, configured to calculate, for each candidate word in the candidate word list, an awakening score and a perplexity corresponding to the candidate word, and calculate a comprehensive score corresponding to the candidate word based on the awakening score and the perplexity of the candidate word; A second processing module is used to select a specified number of candidate words with the highest comprehensive scores from all the candidate words, use the specified candidate words as candidate words for the next decoding time step, and update the number of candidate words based on the specified number; A statistics module, used for obtaining all generated candidate sequences and counting the target comprehensive scores of the candidate sequences when the decoding end condition is detected to be met; A generation module is used to select a target candidate sequence with the highest target comprehensive score from the candidate sequences, and generate a target copy corresponding to the demand text based on the target candidate sequence.
9. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the artificial intelligence-based copywriting generation method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the artificial intelligence-based copywriting generation method as described in any one of claims 1 to 7 are implemented.
