Method and apparatus for generating marketing text for a product
By constructing a marketing text graph and utilizing multi-head self-attention and graph convolution techniques, the problem of insufficient consistency and coherence in existing marketing text generation technologies is solved, resulting in more coherent and fluent marketing text.
Patent Information
- Application Number
- CN202210871330.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-07-22
AI Technical Summary
Existing marketing text generation technologies suffer from problems such as poor consistency of generated results, logical conflicts, and insufficient coherence and fluency.
By obtaining marketing text phrases based on product attribute-attribute value pairs, constructing a marketing text graph, and using multi-head self-attention mechanism and graph convolution technology to generate marketing text, historical phrase information and attribute-attribute value pair information are integrated to generate coherent and fluent marketing text.
It improves the consistency and coherence of marketing text generation, avoids logical conflicts, and makes the generated text more fluent.
Smart Images

Figure CN115345154B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of marketing text creation, and more particularly, to a method and device for generating marketing text of a commodity. BACKGROUND
[0002] Artificial intelligence is booming in the field of natural language processing and is widely used in all aspects of people's life. Text generation technology generates target output text by analyzing input text. Marketing text generation, as an important application of text generation technology, is closely related to people's use needs, and its performance improvement has always been a hot spot for researchers in the relevant field. Marketing text generation can use artificial intelligence to automatically generate the desired marketing text of a commodity based on several attribute-value pairs of the description or effect of the commodity.
[0003] However, existing marketing text generation technology has various shortcomings, and therefore, a new method and device for generating marketing text of a commodity are needed to solve the above problems. SUMMARY
[0004] A series of simplified concepts are introduced in the summary section, which will be further described in detail in the detailed description section. The summary section of the present application does not mean to attempt to limit the key features and essential technical features of the claimed technical solutions, nor to determine the protection scope of the claimed technical solutions.
[0005] According to an aspect of the present application, a method for generating marketing text of a commodity is provided, the method comprising: obtaining a marketing text phrase corresponding to an attribute-value pair of an input commodity based on the attribute-value pair; constructing a marketing text graph based on the attribute-value pair and the obtained marketing text phrase; and generating marketing text for the commodity based on the marketing text graph.
[0006] In one embodiment, wherein the marketing text phrase corresponding to the attribute-value pair is obtained based on the attribute-value pair, comprises: retrieving a preset sentence pattern matching the attribute value in the attribute-value pair based on the attribute value; and combining the attribute value with the retrieved sentence pattern to obtain the marketing text phrase.
[0007] In one embodiment, wherein the marketing text graph is constructed based on the attribute-value pair and the obtained marketing text phrase, comprises: taking the attribute-value pair and the marketing text phrase as nodes, and connecting each node to another as an edge to construct the marketing text graph.
[0008] In one embodiment, wherein the marketing text for the item is generated based on the marketing text graph, comprises: obtaining joint semantic representations of respective nodes of the marketing text graph; decoding the marketing text snippet to obtain an output representation of the marketing text snippet; and updating the output representation of the marketing text snippet with the joint semantic representations based on an attention mechanism, and generating the marketing text for the item using the updated output representation of the marketing text snippet.
[0009] In one embodiment, wherein the joint semantic representations of respective nodes of the marketing text graph are obtained, comprises: respectively encoding the attribute-value pairs and the marketing text snippet to obtain static semantic representations of both attribute-value pair nodes and marketing text snippet nodes in the marketing text graph; computing dynamic semantic representations of respective nodes of the marketing text graph based on the static semantic representations; and fusing the static semantic representations and the dynamic semantic representations to obtain the joint semantic representations.
[0010] In one embodiment, wherein the marketing text snippet is encoded to obtain the static semantic representation of the marketing text snippet node, comprises: encoding the marketing text snippet using a multi-head self-attention mechanism to obtain the static semantic representation of the marketing text snippet node.
[0011] In one embodiment, wherein the dynamic semantic representations of respective nodes of the marketing text graph are computed based on the static semantic representations, comprises: graph convolving the marketing text graph using a two-layer graph attention network to compute the dynamic semantic representations of respective nodes of the marketing text graph.
[0012] In one embodiment, wherein the marketing text snippet is decoded to obtain the output representation of the marketing text snippet, comprises: decoding the marketing text snippet using a multi-head self-attention mechanism to obtain the output representation of the marketing text snippet.
[0013] In one embodiment, the step of constructing the marketing text graph and the step of generating the marketing text in the method are implemented using a trained marketing text generation model, the trained marketing text generation model being obtained by training a marketing text generation model through the following steps: constructing a marketing text graph based on input attribute-value pairs of a product and marketing text snippets corresponding to the attribute-value pairs, the marketing text snippets being obtained based on the attribute-value pairs; obtaining joint semantic representations of each node of the marketing text graph; decoding the marketing text snippets to obtain output representations of the marketing text snippets; updating the output representations of the marketing text snippets with the joint semantic representations based on an attention mechanism; calculating probabilities of each position in the marketing text snippets belonging to each word in a preset word table based on the updated output representations; calculating a loss based on the probabilities, and updating parameters of the marketing text generation model based on the loss.
[0014] According to another aspect of the present application, there is provided an apparatus for generating a marketing text of a product, the apparatus comprising a memory and a processor, the memory having stored thereon a computer program to be run by the processor, the computer program, when run by the processor, causing the processor to perform the method for generating a marketing text of a product as described above.
[0015] According to yet another aspect of the present application, there is provided a computer readable medium having stored thereon computer executable instructions which, when executed, perform the method for generating a marketing text of a product as described above.
[0016] The method and apparatus for generating a marketing text of a product according to embodiments of the present application rewrite short sentences, avoiding the problem of poor model generation caused by long sentence rewriting, and generate marketing texts using a marketing text graph, which fuses historical short sentence information and input attribute-value pair information into the marketing text graph, so that the generated marketing texts are more coherent and fluent, and consistency can be improved and logical conflicts can be avoided. BRIEF DESCRIPTION OF DRAWINGS
[0017] The following drawings are included herewith as part of the present application to assist in understanding the present application. The drawings illustrate preferred embodiments of the application and, together with the description, serve to explain the principles of the application.
[0018] In the drawings:
[0019] Figure 1 An exemplary step flowchart of the method for generating a marketing text of a product according to one embodiment of the present application is shown;
[0020] Figure 2A schematic diagram of an exemplary attribute-value pair table is shown according to one embodiment of the present application;
[0021] Figure 3 A schematic diagram of an exemplary marketing text graph is shown according to one embodiment of the present application; and
[0022] Figure 4 A schematic structural block diagram of an apparatus for generating marketing text of a commodity according to one embodiment of the present application is shown. DETAILED DESCRIPTION
[0023] In order to make the purposes, technical solutions and advantages of the present application more obvious, exemplary embodiments according to the present application will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described herein. Based on the embodiments of the present application described in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the protection scope of the present application.
[0024] The existing marketing text generation techniques and methods are mainly divided into three types:
[0025] Method one, directly according to a plurality of attribute-value pairs of commodity description or effect, one-step end-to-end generation of marketing text using model;
[0026] Method two, using a pipeline structure, first retrieving corresponding commodity description or effect short sentences according to a plurality of attribute-value pairs of commodity description or effect, then splicing a plurality of short sentences into long sentences, and then using a model to rewrite the long sentences to obtain marketing text.
[0027] Method three, on the basis of method two, the input long sentence is divided into a plurality of short sentences, each short sentence is rewritten using a model to predict the corresponding marketing text short sentence, and finally each marketing text short sentence is spliced in order to obtain the final marketing text.
[0028] However, the above marketing text generation methods have various problems. Among them, the first method uses a model to generate marketing text end-to-end, the model generation is too difficult, the consistency between the generated marketing text and the input attribute-attribute value pair is poor, that is, the generated result can only cover a small part of the attribute value, and the generated result is easy to have logical conflicts, for example, a halter and a round collar appear at the same time; the second method first splices several short sentences retrieved to form a long sentence, and then uses a model to rewrite the long sentence, that is, the text generation task is converted into a text rewriting task, although the consistency is improved and the logical conflict is avoided, but when rewriting the long sentence, the model is easy to accumulate errors due to the too long length of the sentence, and the generation effect becomes worse and worse; the third method splits the input long sentence into several short sentences, and then uses a model to rewrite each short sentence, and then splices the rewritten short sentences in order, but this method is easy to lose the historical information of the sentence, making the generated sentence not coherent with the previous sentence, and due to the lack of guidance of historical information, the fluency of the generated sentence will also decrease.
[0029] Therefore, in order to provide the coherence and fluency of the generated marketing text, the present application provides a method for generating marketing text of a commodity, which comprises: acquiring a marketing text short sentence corresponding to an attribute-attribute value pair of a commodity based on the input attribute-attribute value pair; constructing a marketing text graph based on the attribute-attribute value pair and the acquired marketing text short sentence; and generating a marketing text for the commodity based on the marketing text graph.
[0030] According to the method for generating marketing text of a commodity of the present application, the short sentence is rewritten, avoiding the problem that the model generation effect becomes worse due to long sentence rewriting, and the marketing text graph is used to generate the marketing text, the historical short sentence information and the input attribute-attribute value pair information are fused into the marketing text graph, so that the generated marketing text is more coherent and fluent, and the consistency can be improved and logical conflicts can be avoided.
[0031] The method and device for generating marketing text of a commodity according to the present application will be described in detail below with reference to specific embodiments.
[0032] First, refer to Figure 1 An exemplary step flowchart of the method 100 for generating marketing text of a commodity according to an embodiment of the present application is described. As shown in Figure 1 The method 100 for generating marketing text of a commodity can include the following steps:
[0033] In step S110, a marketing text short sentence corresponding to an attribute-attribute value pair of a commodity is acquired based on the input attribute-attribute value pair;
[0034] In step S120, a marketing text graph is constructed based on the attribute-attribute value pair and the acquired marketing text short sentence; and
[0035] In step S130, a marketing text for the product is generated based on the marketing text graph.
[0036] In one embodiment, the obtaining, in step S110, of the marketing text phrase corresponding to the attribute-attribute value pair based on the input attribute-attribute value pair of the product can include the following steps:
[0037] In step S1120, a preset sentence pattern matching the attribute value in the attribute-attribute value pair is retrieved based on the attribute value; and
[0038] In step S1140, the attribute value is combined with the retrieved sentence pattern to obtain the marketing text phrase.
[0039] In one embodiment, the database of attribute-attribute value pairs can be established by the following method: first, according to the specific business scenario and data, a large number of attribute-attribute value pairs about the product are obtained by manual sorting, such as skirt length-medium length skirt, skirt length-ultra short skirt, sleeve length-bat sleeve, collar type-medium high collar, color-ink green, etc., to establish the database of attribute-attribute value pairs. In one embodiment, the attribute-attribute value pairs in the database can be stored in the form of a table. Reference Figure 2 , Figure 2 A schematic diagram of an exemplary attribute-attribute value pair table according to one embodiment of the present application is shown. It should be understood that the attribute-attribute value pairs in the database can also be stored in other forms, which are not limited by the present application.
[0040] Then, according to certain rules (for example, the characteristics and writing rules of the marketing text of different product categories), a number of sentence patterns are sorted out from the massive corpus data and stored.
[0041] In one embodiment, when the attribute-attribute value pair of the product for which the marketing text is to be generated is received, a sentence pattern matching the attribute value can be retrieved from the stored sentence patterns based on the attribute value, and the attribute value is combined with the retrieved sentence pattern to obtain a number of marketing text phrases.
[0042] In one embodiment, when the marketing text graph is constructed based on the attribute-attribute value pair and the obtained marketing text phrase in step S120, since a complete marketing text graph is composed of nodes and edges, the attribute-attribute value pair and the marketing text phrase can be taken as nodes, and each pair of nodes is connected as an edge to construct the marketing text graph. Reference Figure 3 , Figure 3 A schematic diagram of an exemplary marketing text graph according to one embodiment of the present application is shown.
[0043] Specifically, the nodes can be divided into attribute-value pair nodes and marketing text phrase nodes. The edges can be divided into three types: the first type is the edge between the attribute-value pair nodes, the construction method of which can be to connect all attribute-value pairs belonging to the same attribute two by two; the second type is the edge between the marketing text phrase nodes, the construction method of which is to connect the current marketing text phrase and the previous five marketing text phrases; and the third type is the edge between the attribute-value pair nodes and the marketing text phrase nodes, the construction method of which is to connect the attribute-value pair nodes and the marketing text phrase nodes corresponding to the attribute-value pair nodes.
[0044] In one embodiment, the step of generating the marketing text for the commodity based on the marketing text graph in step S130 can include the following steps:
[0045] In step S1320, a joint semantic representation of each node of the marketing text graph is obtained.
[0046] In step S1340, the marketing text phrase is decoded to obtain an output representation of the marketing text phrase; and
[0047] In step S1360, the output representation of the marketing text phrase is updated based on the attention mechanism using the joint semantic representation, and the marketing text for the commodity is generated using the updated output representation of the marketing text phrase.
[0048] In step S1320, a joint semantic representation of each node of the marketing text graph is obtained.
[0049] In step S1322, the attribute-value pair and the marketing text phrase are respectively encoded to obtain the static semantic representation of both the attribute-value pair nodes and the marketing text phrase nodes in the marketing text graph.
[0050] In step S1324, the dynamic semantic representation of each node of the marketing text graph is calculated based on the static semantic representation of both the attribute-value pair nodes and the marketing text phrase nodes; and
[0051] In step S1326, the static semantic representation and the dynamic semantic representation are fused to obtain the joint semantic representation.
[0052] In one embodiment, the encoding of attribute-attribute value pairs in step S1322 to obtain the static semantic representation of attribute-attribute value pair nodes in the marketing text graph may include: after receiving the attribute-attribute value pair, finding the static embedding representation of each character in the attribute-attribute value pair through a table lookup operation, and then performing average pooling on the static embedding representations of all characters in the attribute-attribute value pair to obtain the overall static semantic representation of the attribute-attribute value pair. Specifically, let the text representation of the attribute-attribute value pair be... in For the lth attribute k One word, The lth attribute value v The character, l k l is the length of the attribute. v Let be the length of the attribute value. Then, the overall static semantic representation of the attribute-value pair can be expressed as:
[0053]
[0054] in, Let i be the static embedded representation of the i-th character of the attribute. E is the static embedded representation of the j-th word of the attribute value. attr It is a static semantic representation of attribute-value pairs.
[0055] In one embodiment, encoding the marketing text phrase in step S1322 to obtain a static semantic representation of the marketing text phrase node may include: encoding the marketing text phrase using a multi-head self-attention mechanism to obtain a static semantic representation of the marketing text phrase. In one embodiment, this step can be implemented using an encoder in a converter network, which utilizes a multi-head attention mechanism and has stronger semantic feature extraction and long-distance feature capture capabilities compared to other neural networks (e.g., Long Short-Term Memory (LSTM) networks).
[0056] Specifically, set The raw input for marketing text phrases, where l m Given the length of short sentences in marketing texts, then for each word... Its input embedding representation for:
[0057]
[0058] Where WE is the word embedding function and PE is the position embedding function.
[0059] Then, by concatenating the input embedding representations of all words in the marketing text phrase, the input embedding representation of the marketing text phrase can be obtained. This process can be represented as:
[0060]
[0061] Then, the input of the marketing text phrase is embedded into the l stacked blocks, each of which contains a self-attention layer and a feedforward neural network layer, and the output of the lth stacked block is:
[0062]
[0063] where FNN is a feedforward neural network function, MultiHead(Q, K, V) is a multi-head self-attention function, Q, K, and V correspond to query, key, and value inputs, respectively, and each stacked block has a feedforward neural network sublayer and a multi-head self-attention sublayer with residual connection structure and layer normalization structure. The output E m (l) As the encoded output of the marketing text phrase, the static embedding representation of the marketing text phrase is obtained where is the static embedding representation of the i-th word of the marketing text phrase.
[0064] Then, the static embedding representations of all words in the marketing text phrase are averaged and pooled to obtain the static semantic representation of the marketing text phrase as:
[0065]
[0066] where l sent is the number of words in the marketing text phrase, is the static embedding representation of the i-th word of the marketing text phrase, and E sent is the static semantic representation of the marketing text phrase.
[0067] After obtaining the static semantic representation E attr of the attribute-value pair and the static semantic representation E sent of the marketing text phrase, and constructing the marketing text graph, the static semantic representation of the attribute-value pair node and the marketing text phrase node in the marketing text graph is initialized as E attr and E sent respectively.
[0068] Since the static semantic representation E attr of the attribute-value pair and the static semantic representation E sentOnly the semantic relationship inside itself can be represented, which is a static representation. It cannot represent the dynamic semantic relationship between the attribute-value pairs, between the marketing text sentences, and between the attribute-value pairs and the marketing text sentences in the specific context of the current input marketing text. In order to solve this problem, the dynamic semantic relationship of each node in the marketing text graph can be learned.
[0069] In one embodiment, the calculation of the dynamic semantic representation of each node of the marketing text graph based on the static semantic representation of both the attribute-value pair node and the marketing text sentence node in step S1324 can include: performing graph convolution on the marketing text graph by using a two-layer graph attention network (GAT) to calculate the dynamic semantic representation of each node of the marketing text graph. It should be understood that the marketing text graph can also be graph-convolved by using a graph attention network with any number of layers, such as one layer, three layers, four layers, etc., and the present application does not limit this.
[0070] The process is described by taking the graph convolution of the marketing text graph by using a two-layer graph attention network (GAT) as an example.
[0071] Specifically, in the marketing text graph, the attribute-value pair node is denoted as E attr The initial static representation v 0 The marketing text sentence node is denoted as E sent The initial static representation v 0 Let v be the initial static representation of the i-th node, v j 0 be the initial static representation of the neighbor node j of the i-th node, then the output representation of the i-th node in the first layer GCN is obtained by the following formula:
[0072]
[0073] wherein, is the output representation of the i-th node in the first layer GAT, N i is the index set of all nodes connected to the i-th node, is the spatial transformation weight parameter matrix of the first layer node of the GAT, is the spatial transformation weight parameter matrix of the adjacent node of the first layer of the GAT, b 1 is the bias vector of the first layer of the GAT, and f is the relu activation function.
[0074] The calculation process of the second layer GAT is similar to that of the first layer GAT, and the output representation of the i-th node in the second layer GAT can be calculated according to the following formula:
[0075]
[0076] in, Let N be the output representation of the i-th node in the second layer GAT. i Let be the set of indices of all nodes connected to the i-th node. This is the spatial transformation weight parameter matrix of the second-layer node of GAT. b is the spatial transformation weight parameter matrix of the second-layer adjacent nodes of GAT. 2 This is the bias vector for the second layer of GAT.
[0077] When performing graph convolution on a marketing text graph using a two-layer graph attention network (GAT), the output of the second layer GAT represents... This is the dynamic semantic representation of a node.
[0078] In one embodiment, the fusion of static and dynamic semantic representations in step S1326 to obtain a joint semantic representation can be performed using a residual network. Specifically, the static semantic representation of the i-th node... and dynamic semantic representation The fusion can be calculated using the following formula:
[0079]
[0080] Among them, v i W is the joint semantic representation of the i-th node. n and W e Static semantic representation and dynamic semantic representation The corresponding weight parameter matrix.
[0081] In one embodiment, decoding the marketing text phrase in step S1340 to obtain the output representation of the marketing text phrase may include: decoding the marketing text phrase using a multi-head self-attention mechanism to obtain the output representation of the marketing text phrase.
[0082] Specifically, set To output a text representation of marketing text phrases, where l o To output the length of short marketing text sentences, for each word... Its input embedding representation for:
[0083]
[0084] Where WE is the word embedding function and PE is the position embedding function.
[0085] The input is embedded with all the words in the output marketing text phrase. The input embedding representation of the output marketing text short sentence is obtained by concatenation, as follows:
[0086]
[0087] The input embedding representation of the output marketing text short sentence is input into l stacked blocks, each of which contains a self-attention layer and a feedforward neural network layer, and the output of the lth stacked block is as follows:
[0088]
[0089] where FNN is a feedforward neural network function, Masked-MultiHead(Q, K, V) is a restricted multi-head self-attention function, i.e., when performing self-attention, only the words before the current position can be observed, and the words after the current position cannot be observed, Q, K, and V correspond to query input, key input, and value input, respectively, and the feedforward neural network sublayer and the multi-head self-attention sublayer in each stacked block have residual connection structure and layer normalization structure, and the output of the last stacked block is As the decoding output of the marketing text short sentence, the output representation of the marketing text short sentence is obtained as where is the output representation of the i-th word of the marketing text short sentence.
[0090] If only the current output marketing text short sentence itself is used for autoregression to generate the content of the marketing text short sentence one by one, the fluency and coherence of the generated marketing text will be poor due to the lack of historical information of the marketing text short sentence. Therefore, in step S1360, the output representation of the marketing text short sentence can be updated based on the joint semantic representation using the attention mechanism, and the updated output representation of the marketing text short sentence is used to generate the marketing text for the product. Specifically, the historical information of the marketing text short sentence is recorded using a marketing text graph, and when generating each marketing text, cross-attention operation is performed between the output representation of the marketing text short sentence and the joint semantic representation of the nodes in the marketing text graph, thereby updating the output representation of the marketing text short sentence.
[0091] Specifically, the attention weight μ j,i of the output representation of the word at the jth position of the output marketing text short sentence to the i-th node in the marketing text graph is as follows:
[0092]
[0093]
[0094] where, is the attention weight before normalization, and μ j,i is the attention weight after normalization, lI v is the number of nodes in the marketing text graph, c U c W c are trainable parameters.
[0095] The j-th position of the output marketing text short sentence is weighted by the attention weight to each node in the marketing text graph, and specifically, the updated output representation of the output marketing text short sentence is obtained by performing cross-attention operation on the j-th position of the output marketing text short sentence and the joint semantic representation of the nodes of the marketing text graph. is:
[0096]
[0097] After obtaining the updated output representation of the marketing text short sentence, the updated output representation of the marketing text short sentence can be classified to determine which word in the word table the word at the position belongs to, thereby predicting the output word one position at a time, and finally generating the final marketing text. Specifically, the updated output representation of the j-th position of the output marketing text short sentence is linearly transformed to predict the probability of belonging to each word in the word table as:
[0098]
[0099] where W out is a trainable parameter.
[0100] The word with the maximum probability is taken as the finally predicted output word:
[0101]
[0102] where, is the probability that the word at the j-th position is predicted to be the k-th word in the word table, I j is the index of the predicted word at the j-th position, and vocab is the index range of the word table.
[0103] In one embodiment, the method 100 for generating marketing text of a commodity can be implemented using logic, rules, neural network models, etc.
[0104] In one embodiment, steps S120 and S130 in the method 100 for generating marketing text of a commodity can be implemented using a trained marketing text generation model.
[0105] In one embodiment, the trained marketing text generation model is obtained by training the marketing text generation model through the following steps:
[0106] based on the input attribute-value pairs of the commodity and the marketing text snippets corresponding to the attribute-value pairs
[0107] constructing a marketing text graph, the marketing text snippets being obtained based on the attribute-value pairs;
[0108] obtaining a joint semantic representation of each node of the marketing text graph;
[0109] decoding the marketing text snippets to obtain an output representation of the marketing text snippets;
[0110] updating the output representation of the marketing text snippets based on the joint semantic representation using an attention mechanism;
[0111] calculating, based on the updated output representation, a probability that a word at each position in the marketing text snippet belongs to each word in a preset word table;
[0112] calculating a loss based on the probability, and updating parameters of the marketing text generation model based on the loss.
[0113] In an embodiment, any suitable loss function known in the art can be used to calculate the above-mentioned loss, such as an exponential loss function, a cross-entropy loss function, a logarithmic loss function, etc., which are not limited by the present application.
[0114] In an embodiment, the loss function L j may be:
[0115]
[0116] wherein, indicates whether the jthposition of the output marketing text snippet is marked as the kthword in the word table, and is 1 if yes, otherwise is 0. The total loss function L is the sum of the loss function of each position of the output marketing text snippet:
[0117]
[0118] After generating each marketing text snippet, the current output marketing text snippet can be used to supervise the generation result, and the nodes in the marketing text graph are updated through a back propagation algorithm, so that the information of the nodes in the marketing text graph is updated when each marketing text snippet is output, and the marketing text information generated in the past is implicitly recorded.
[0119] The method for generating marketing text of a commodity provided by the present application rewrites short sentences, avoids the problem that long sentence rewriting leads to poor model generation effect, and generates marketing text by using a marketing text graph, fuses historical short sentence information and input attribute-attribute value pair information into the marketing text graph, so that the generated marketing text is more coherent and fluent, and consistency can be improved and logical conflicts can be avoided.
[0120] The present application also provides a device for generating marketing text of a commodity. Figure 4 , Figure 4 A schematic structural block diagram of a device 400 for generating marketing text of a commodity according to an embodiment of the present application is shown. As shown in the figure, Figure 4 The device 400 for generating marketing text of a commodity can include a memory 410 and a processor 420, the memory 410 stores a computer program which is run by the processor 420, and when the computer program is run by the processor 420, the processor 420 executes the method 100 for generating marketing text of a commodity according to the embodiment of the present application described above. Those skilled in the art can understand the specific operation of the device 400 for generating marketing text of a commodity according to the embodiment of the present application in combination with the content described above, and for the sake of brevity, it will not be repeated here.
[0121] The device for generating marketing text of a commodity according to the present application rewrites short sentences, avoids the problem that long sentence rewriting leads to poor model generation effect, and generates marketing text by using a marketing text graph, fuses historical short sentence information and input attribute-attribute value pair information into the marketing text graph, so that the generated marketing text is more coherent and fluent, and consistency can be improved and logical conflicts can be avoided.
[0122] The present application also provides a computer readable medium having stored thereon computer executable instructions that, when executed, perform the respective steps of the method 100 for generating marketing text for a product as described above. Any tangible, non-transitory computer readable medium can be used, including magnetic storage devices (hard disk, floppy disk, etc.), optical storage devices (CD-ROM, DVD, Blu-ray Disc, etc.), flash memory, and / or the like. These computer executable instructions can be loaded into a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute on the computer or other programmable data processing apparatus, create means for implementing the functions specified by the instructions. These computer executable instructions can also be stored in a computer readable storage memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable storage memory can produce an article of manufacture, including implementing means, that implement the specified functions. The computer executable instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified by the instructions.
[0123] Further, according to embodiments of the present application, a computer program is provided, which, when being executed by a computer or processor, is adapted to perform the respective steps of the method 100 for generating marketing text for a product according to embodiments of the present application.
[0124] While example embodiments have been described herein with reference to the attached drawings, it is to be understood that the example embodiments are merely exemplary and are not intended to limit the scope of the application. Various modifications and changes can be made therein by those of ordinary skill in the art without departing from the scope and spirit of the application. All such modifications and changes are intended to be included within the scope of the application as set forth in the appended claims.
[0125] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to not obscure the understanding of this description.
[0126] Similarly, it is to be understood that the embodiments of the present application can be altered, combined, or modified and constitute modifications and variations of the example embodiments set forth herein that are within the scope of the present application. It is intended that the application(s) encompass each of the alternative of various embodiments as well as any and all equivalents. Therefore, to apprise the public of the various embodiments of the present application, this specification must be regarded as a breadth of disclosure of the application(s) rather than a limitation of the application(s).
[0127] Those skilled in the art will appreciate that all features described herein (including all features and processes described in connection with the accompanying claims, abstract and drawings) can be combined in any combination. Unless specifically stated otherwise, each feature disclosed in this specification (including any accompanying claims, abstract and drawings) can be replaced by alternative features that serve the same, equivalent or a similar purpose.
[0128] Furthermore, those skilled in the art will recognize that references in the specification to "one embodiment", "an embodiment", "an example embodiment", mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily referring to the same embodiment.
[0129] It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that one skilled in the art will be able to design many alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps other than those listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of both hardware and software, and any combination thereof. In a unit claim, any reference signs placed between parentheses shall not be construed as limiting the claim. The use of the word "about" followed by a value and / or a unit of measure to describe a criterion is intended to convey that a criterion can not be strictly met and / or that a criterion can be met approximately. Numerical parameters such as a numerical value, include all values arbitrarily rounded to the same significant figure as that numerical value. The application can be implemented by means of both hardware and software, and any combination thereof. In a unit claim, any reference signs placed between parentheses shall not be construed as limiting the claim. The use of the word "about" followed by a value and / or a unit of measure to describe a criterion is intended to convey that a criterion can not be strictly met and / or that a criterion can be met approximately. Numerical parameters such as a numerical value, include all values arbitrarily rounded to the same significant figure as that numerical value.
[0130] The above merely describes specific embodiments or specific implementation of the present application, and the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. The protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for generating a marketing text for a product, characterized by, The method comprises: obtaining a marketing text snippet corresponding to the attribute-attribute value pair based on the input attribute-attribute value pair of the commodity; constructing a marketing text graph based on the attribute-attribute value pair and the obtained marketing text snippet, specifically comprising: taking the attribute-attribute value pair and the marketing text snippet as nodes, and connecting each two nodes as edges to construct the marketing text graph; and generating marketing text for the commodity based on the marketing text graph, specifically comprising: obtaining a joint semantic representation of each node of the marketing text graph; decoding the marketing text snippet to obtain an output representation of the marketing text snippet; and updating the output representation of the marketing text snippet with the joint semantic representation based on an attention mechanism, and generating marketing text for the commodity using the updated output representation of the marketing text snippet; wherein the joint semantic representation of each node of the marketing text graph is obtained by: respectively encoding the attribute-attribute value pair and the marketing text snippet to obtain static semantic representations of both the attribute-attribute value pair nodes and the marketing text snippet nodes in the marketing text graph; calculating the dynamic semantic representation of each node of the marketing text graph based on the static semantic representation, specifically comprising: performing graph convolution on the marketing text graph using a two-layer graph attention network to calculate the dynamic semantic representation of each node of the marketing text graph; and fusing the static semantic representation and the dynamic semantic representation to obtain the joint semantic representation.
2. The method of claim 1, wherein, wherein the marketing text snippet corresponding to the attribute-attribute value pair is obtained based on the attribute-attribute value pair, comprising: retrieving a preset sentence pattern template matching the attribute value in the attribute-attribute value pair based on the attribute value; and combining the attribute value with the retrieved sentence pattern template to obtain the marketing text snippet.
3. The method of claim 1, wherein, wherein the marketing text snippet is encoded to obtain the static semantic representation of the marketing text snippet node, comprising: encoding the marketing text snippet using a multi-head self-attention mechanism to obtain the static semantic representation of the marketing text snippet node.
4. The method of claim 1, wherein, wherein the marketing text snippet is decoded to obtain the output representation of the marketing text snippet, comprising: decoding the marketing text snippet using a multi-head self-attention mechanism to obtain the output representation of the marketing text snippet.
5. The method of any one of claims 1-4, wherein, The steps of constructing the marketing text graph and generating the marketing text in the method are implemented using a trained marketing text generation model, which is obtained by training a marketing text generation model through the following steps: constructing a marketing text graph based on the input attribute-attribute value pair of the commodity and the marketing text snippet corresponding to the attribute-attribute value pair, the marketing text snippet being obtained based on the attribute-attribute value pair; obtaining a joint semantic representation of each node of the marketing text graph; decoding the marketing text snippet to obtain an output representation of the marketing text snippet; and updating, based on the attention mechanism, an output representation of the marketing text snippet using the joint semantic representation; calculating, based on the updated output representation, a probability that each word in each position of the marketing text snippet belongs to each word in a preset word table; calculating a loss based on the probability, and updating parameters of the marketing text generation model based on the loss.
6. An apparatus for generating a marketing text for a product, characterized by, The apparatus comprises a memory and a processor, the memory has a computer program stored thereon, which is run by the processor, and when the computer program is run by the processor, the processor executes the method for generating marketing text of a commodity according to any one of claims 1-5.
7. A computer readable medium characterized by The computer readable medium has computer executable instructions stored thereon, and the computer executable instructions, when executed, perform the method for generating marketing text of a commodity according to any one of claims 1-5.
Citation Information
Patent Citations
Method and device for automatically generating article, equipment and storage medium
CN110555196A
Long text generation method and device, equipment and storage medium
CN112541348A
Construction method and device of information text generation model, equipment and storage medium
CN113626614A