A method, apparatus, electronic device, and storage medium for generating product recommendation copy.
By training a text generation model to adjust product attention and encoding values, the problem of weak logic in product combination purchase copy in shopping application platforms was solved, and the sequential and logical description of product recommendation copy was realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2022-07-20
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, the product combination purchase copy generated by shopping application platforms lacks logic and cannot recommend products according to the order in which they are entered.
By training a text generation model, using encoders and decoders generated from sample data, and calculating based on attention mechanisms and context vectors, the attention probability and encoding values of products are adjusted, and product recommendation copy is output in order.
It enables logical recommendations for multiple products, improves the logical consistency of product combination purchase copy, and ensures that the copy is described in the order of user input.
Smart Images

Figure CN115203563B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer processing technology, and in particular to a method, apparatus, electronic device, and storage medium for generating product recommendation copy. Background Technology
[0002] With the continuous improvement of economic level, online shopping is becoming more and more popular. Shopping application platforms recommend products to users based on the product feature information entered by the users.
[0003] Currently, for a set of product information input by a user, shopping application platforms will directly generate corresponding product combination purchase copy based on product feature information. Since the product combination purchase copy is not generated according to the order of product input, the generated product combination purchase copy lacks strong logic. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, apparatus, electronic device, and storage medium for generating product recommendation copy, in order to solve the problem that the logic of product combination purchase copy generated in the prior art is not strong.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] A first aspect of this invention discloses a method for generating product recommendation copy, the method comprising:
[0007] Retrieve the fields for multiple products input by the user;
[0008] The fields of the multiple products are used as input to the text generation model. Based on the text generation model, the fields of the multiple products are processed, and the product recommendation copy is output in order. The text generation model is trained using sample data.
[0009] Optionally, the process of training a text generation model using sample data includes:
[0010] Obtain sample data, which includes user input and corresponding historical multi-product combination text within a historical time period. The historical multi-product combination text is obtained by manually processing the historical product fields input by the user.
[0011] The encoder is trained using the product history field to determine the trained historical hidden sequence, which includes the encoded value of the identifier corresponding to each product in the history and the encoded value of each field in each product in the history.
[0012] The decoder is trained based on the vectors of the historical hidden sequence and the historical multi-product combination text, and the text generation model is determined by the trained encoder and decoder.
[0013] Optionally, training the decoder based on the vectors of the historical hidden sequence and the historical multi-product pairing copy to determine the text generation model composed of the trained encoder and decoder includes:
[0014] The decoder calculates the encoded value of the identifier corresponding to each historical item based on the attention mechanism to determine the historical attention probability of each historical item.
[0015] Based on the historical attention probability of each historical product, the vector of the encoded values of the corresponding product's fields is adjusted to determine the historical attention vector of each product's fields.
[0016] Calculate the historical context vector based on the historical attention vector of each product's fields in the history;
[0017] The historical context vector and the vector of the historical multi-product combination copy are processed to determine the output vector;
[0018] The output vector and the historical context vector are processed using the classification function in the decoder to determine the decoding probability of the vector of the historical multi-product combination copy.
[0019] The loss value is determined by calculating the likelihood based on the decoding probability of the vector of the historical multi-product combination copywriting.
[0020] When the loss value is determined to be within a preset range, a text generation model is determined to be composed of the encoder and decoder obtained from the current training.
[0021] Optionally, the step of processing the fields of the multiple products based on the text generation model and outputting product recommendation copy arranged in order includes:
[0022] The encoder in the text generation model processes the fields of the multiple products to determine the corresponding encoding hidden sequence. The encoding hidden sequence includes the encoding value of each field in each product and the encoding value of the identifier corresponding to each product.
[0023] The decoder in the text generation model processes the encoded hidden sequence to generate product recommendation copy arranged in sequence.
[0024] Optionally, the decoder in the text generation model processes the encoded hidden sequence to generate product recommendation copy arranged in sequence, including:
[0025] The decoder in the text generation model calculates the encoded value of the identifier corresponding to each product to determine the attention probability of each product.
[0026] The decoder in the text generation model adjusts the vector of encoded values of the corresponding product's fields based on the attention probability of each product, thereby obtaining the target attention vector of each product's fields.
[0027] The decoder in the text generation model calculates the context vector based on the target attention vector;
[0028] The decoder in the text generation model processes the context vector, the target output value of the previous product, and the product pairing vector of the previous product to determine the product pairing vector of the current product. If the field of the previous product is the same as the field of the first input product, the target output value of the previous product and the product pairing vector of the previous product are taken as preset values.
[0029] The product combination vectors for each product are combined according to the input order of the fields for multiple products to obtain the corresponding product recommendation copy.
[0030] Optionally, the encoder in the text generation model processes the fields of the multiple products to determine the corresponding encoded hidden sequences, including:
[0031] The encoder in the text generation model performs word segmentation on the fields of the multiple products according to preset rules to obtain the target fields of the multiple products. The target fields include each field of each product and the identifier corresponding to each product.
[0032] The encoder in the text generation model encodes the target field to obtain an encoded hidden sequence.
[0033] A second aspect of the present invention discloses a product recommendation copy generation device, the device comprising:
[0034] The acquisition module is used to acquire the fields of multiple products input by the user and use the fields of the multiple products as input to the text generation model;
[0035] A text generation model is used to process the fields of the multiple products based on the text generation model and output product recommendation copy arranged in order. The text generation model is constructed by the construction module.
[0036] Optionally, the construction module is used to obtain sample data, which includes user input and corresponding historical multi-product combination copywriting within a historical time period. The historical multi-product combination copywriting is obtained by manually processing the historical product fields input by the user.
[0037] The encoder is trained using the product history field to determine the trained historical hidden sequence, which includes the encoded value of the identifier corresponding to each product in the history and the encoded value of each field in each product in the history.
[0038] The decoder is trained based on the vectors of the historical hidden sequence and the historical multi-product combination text, and the text generation model is determined by the trained encoder and decoder.
[0039] A third aspect of the present invention discloses an electronic device for running a program, wherein the program executes a product recommendation copy generation method as shown in the first aspect of the present invention.
[0040] A fourth aspect of the present invention discloses a computer storage medium comprising a stored program, wherein, when the program is executed, it controls the device where the storage medium is located to perform a product recommendation copy generation method as shown in the first aspect of the present invention.
[0041] Based on the above embodiments of the present invention, a method, apparatus, electronic device, and computer storage medium for generating product recommendation copy are provided. The method includes: acquiring fields of multiple products input by a user; using the fields of the multiple products as input to a text generation model; processing the fields of the multiple products based on the text generation model; and outputting product recommendation copy arranged in a specific order. The text generation model is trained using sample data. In this embodiment of the present invention, by using a text generation model trained based on sample data, fields of multiple products can be predicted, and product recommendation copy arranged in a specific order can be output, enabling recommendations for multiple products and thus improving the logical consistency of product recommendation copy. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0043] Figure 1 This is a flowchart illustrating a method for generating product recommendation copy according to an embodiment of the present invention;
[0044] Figure 2 This is a schematic diagram illustrating the training process of a text generation model according to an embodiment of the present invention;
[0045] Figure 3This is a schematic diagram of a product recommendation copy generation device according to an embodiment of the present invention. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0048] It should be noted that the descriptions involving "first," "second," etc., in this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0049] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0050] As is known from the background technology, for a set of product information input by a user, shopping application platforms will directly generate corresponding product combination purchase copy based on product feature information. However, since the product combination purchase copy is not generated in the order of product input, for example, for a set of products, such as a top, pants, and a hat, the hat is described first, then the top, and finally the pants, with descriptions randomly interspersed and unable to be described in order, resulting in weak logic in the generated product combination purchase copy.
[0051] In this embodiment of the invention, a text generation model trained based on sample data can predict fields of multiple products and output product recommendation copy in sequence, thereby enabling recommendations of multiple products and improving the logic of product combination purchase copy, i.e., product recommendation copy.
[0052] See Figure 1 This is a flowchart illustrating a method for generating product recommendation copy according to an embodiment of the present invention. The method includes:
[0053] Step S101: Obtain the fields for multiple products input by the user.
[0054] In step S101, each product has at least one field.
[0055] In this embodiment of the invention, a long text containing multiple product items input by the user is obtained, i.e., the field for multiple products input by the user.
[0056] It should be noted that a long text containing multiple products can be represented by a set x, where x = (x 1,1 ,x 1,2 ,...,x 2,1 ,x 2,2 ,...,x n,1 ,...,x n,m ).
[0057] Where, x i,j The field is the j-th character / word of the i-th product in the input, where i is a positive integer greater than or equal to n, and j is a positive integer greater than or equal to m.
[0058] Step S102: Use the fields of the multiple products as input to the text generation model, process the fields of the multiple products based on the text generation model, and output the product recommendation copy arranged in order.
[0059] In step S102, the text generation model is trained using sample data.
[0060] It should be noted that the process of training a text generation model using sample data, such as... Figure 2 As shown, it includes the following steps:
[0061] Step S201: Obtain sample data.
[0062] In step S201, the sample data includes user input and corresponding historical multi-product combination text within a historical time period, i.e., multiple historical text segments. The historical multi-product combination text is obtained by manually processing the historical product fields input by the user.
[0063] In the specific implementation step S201, the historical multi-product combination text input by the user within a historical time period and the corresponding historical multi-product combination text obtained by manually processing the historical product fields input by the user are obtained.
[0064] It should be noted that historical time refers to a past period of time that is set in advance by technical personnel based on experience, such as the past year.
[0065] Step S202: Train the encoder using the product history field to determine the trained historical hidden sequence.
[0066] In step S202, the historical hidden sequence includes the encoded value of the identifier corresponding to each historical item and the encoded value of each field in each historical item.
[0067] In the specific implementation step S202, the fields of the multi-product are segmented according to the preset rules to obtain the identifier corresponding to each historical product and each field in each historical product; the identifier corresponding to each historical product and each field in each historical product are used as the input of the encoder, and the hidden layer state value of the i-th field of the encoder is updated using formula (1).
[0068] Formula (1):
[0069] h i =f enc (x i ,h i-1 (1)
[0070] Among them, f enc The update function representing the neural network calculates the hidden layer state value for each field, x. i h represents all fields of the i-th product. i-1 h is the hidden state value of the previous item. When i equals 1, h i-1 It is 0.
[0071] It should be noted that the encoder can be a neural network such as a deep learning CNN, a bidirectional long short-term memory LSTM, or a deep learning Transformer.
[0072] It should be noted that the preset rules are used to indicate the rules for generating identifiers for each product field in the delimited text.
[0073] Step S203: Train the decoder based on the vectors of the historical hidden sequence and the historical multi-product combination copy, and determine the text generation model composed of the trained encoder and decoder.
[0074] It should be noted that the specific implementation step S203, which trains the decoder based on the vectors of the historical hidden sequence and the historical multi-product combination copy, and determines the text generation model composed of the trained encoder and decoder, includes the following steps:
[0075] Step S11: The decoder calculates the encoded value of the identifier corresponding to each historical item based on the attention mechanism to determine the historical attention probability of each historical item.
[0076] In the specific implementation step S11, the encoded value of the identifier corresponding to each historical product is substituted into formula (2) for calculation to determine the historical attention probability of each historical product, and it is expressed by formula (3).
[0077] Formula (2):
[0078]
[0079] Among them, b i Let h be the historical attention probability of the i-th item. sepi s is the encoded value of the identifier corresponding to the i-th historical product, i.e., the hidden vector; t-1 Let T be the product pairing vector of the previous product, and T be the length of the long text of multiple products. W c and V c It is a parameter matrix.
[0080] Formula (3):
[0081] β i =softmax(b i (3)
[0082] Among them, b i β represents the historical attention probability for each item in history. i Let be the attention probability of the decoder for the i-th item.
[0083] Based on formulas (2) and (3), the decoder's attention to words is recalculated, that is, based on the determined attention to the product, the attention to the words for that product is determined. For example, the product the decoder should describe at this time is air conditioner, but the original attention to the words "air conditioner" and "refrigerator" is 0.2 and 0.3 respectively. This invention adjusts the attention of the product "air conditioner" to 0.9 and the attention of the product "refrigerator" to 0.05 through formulas (2) and (3), which means that the product "air conditioner" should be described at this time. After adjustment, the attention to the words "air conditioner" and "refrigerator" is 0.18 and 0.015 respectively, thereby correcting the original attention.
[0084] Step S12: Adjust the vector of encoded values of the corresponding product's fields based on the historical attention probability of each product in history, and determine the historical attention vector of each product's fields in history.
[0085] In the specific implementation step S12, the historical attention probability of each historical product and the vector of the encoded value of the corresponding product's field are substituted into formula (4) for calculation, so as to adjust the vector of the encoded value of the corresponding product's field and obtain the historical attention vector of each historical product's field.
[0086] Formula (4):
[0087] α' t,i =β i *α t,i (4)
[0088] Where, α' t,i For the adjusted historical attention vector of the i-th product's field, α t,i Let x be the field of the i-th product at time t. i The vector of encoded values, β i Let be the attention probability of the decoder for the i-th item.
[0089] Step S13: Calculate the historical context vector based on the historical attention vector of each item's field in the history.
[0090] In the specific implementation step S13, the historical attention vector of each historical product field and the encoded value of each historical product field are substituted into formula (5) for calculation to obtain the historical context vector.
[0091] Formula (5):
[0092] c' t =∑ i α' t,i h i (5)
[0093] Among them, c't Let α' be the historical context vector. t,i h is the historical attention vector of the field of the i-th product after adjustment. i This is the encoded value of the field for the i-th product.
[0094] Step S14: Process the context vector and the vector of the historical multi-product combination copy to determine the output vector.
[0095] In the specific implementation of step S14, if the field of the current product is the field of the first input product in each historical text segment, the preset value and the historical context vector are input into formula (6) for calculation to obtain the output vector of the first input product.
[0096] If the field of the current product is the field of the Qth input product in each historical text segment, the historical context vector, the target output value of the previous product in the historical text segment, and the product matching vector of the previous product in the historical text segment are substituted into formula (6) for processing to determine the output vector of the current product. Similarly, the output vector of the historical text segment is determined.
[0097] Formula (6):
[0098] S t =f dec (S t-1 ,y t-1 ,c' t (6)
[0099] Among them, S t y is the output vector of the current product within the historical text segment. t-1 c' is the target output value of the previous item within the historical text segment. t S is the historical context vector. t-1 This is the output vector of the previous item within the historical text segment.
[0100] It should be noted that the target output value y for the next item t It is based on the output vector S of the current product within the historical text segment. t Obtained through conversion.
[0101] When i = 1, S t-1 As a preset value, y t-1 This is also the default value.
[0102] It should be further noted that the preset value is a preset setting, for example, it can be set to 0, and the preset value S0 and the preset value y0 can be the same or different.
[0103] Step S15: Use the classification function in the decoder to process the output vector and the historical context vector to determine the decoding probability of the vector of the historical multi-product combination copy.
[0104] In the specific implementation step S15, the output vector and the historical context vector are input into the classification softmax layer in the decoder, i.e., calculated in formula (7), to obtain the decoding probability of the vector of the historical multi-product combination copy.
[0105] Formula (7):
[0106] P' vocab (w) = softmax(W) b S t +V b c' t (7)
[0107] Among them, P' vocab (w) represents the decoding probability of the vector of historical multi-product combination copywriting, S t W is the output vector of the current item within the historical text segment. b and V b Let c' be the parameter matrix. t This is the historical context vector.
[0108] Step S16: Calculate the likelihood based on the decoding probability of the vector of the historical multi-product combination copywriting to determine the loss value.
[0109] In the specific implementation step S16, the decoding probability of the vector of the historical multi-product combination copy is substituted into formula (8) for calculation, and the loss is calculated using negative log likelihood to obtain the corresponding loss value.
[0110] Formula (8):
[0111] Loss = -log(P' vocab (y t (8)
[0112] Among them, y t P' is the target output value for the product within the historical text segment. vocab (y t ) represents the decoding probability of vectors containing historical multi-product pairing copy.
[0113] Step S17: Determine whether the loss value meets the preset range. If the loss value meets the preset range, execute step S18. If the loss value does not meet the preset range, adjust the historical attention probability of each item in history, that is, return to execute step S12.
[0114] In the specific implementation of step S17, the loss value is compared to see if it meets the preset range. If the loss value meets the preset range, step S18 is executed. If the loss value does not meet the preset range, the historical attention probability of each item is adjusted, and then step S12 is returned to be executed.
[0115] It should be noted that the preset range is set by technical personnel based on multiple experiences.
[0116] Step S18: Determine the text generation model composed of the encoder and decoder obtained from the current training.
[0117] In the specific implementation of step S18, the encoder and decoder trained at this time are combined into a text generation model.
[0118] Based on the text generation model trained above, the specific implementation of step S102 includes the following steps:
[0119] Step S21: The encoder in the text generation model processes the fields of the multiple products to determine the corresponding encoded hidden sequence.
[0120] In step S21, the encoded hidden sequence includes the encoded value of each field in each product, and the encoded value of the identifier corresponding to each product.
[0121] In the specific implementation step S21, the encoder in the text generation model performs word segmentation on the fields of the multiple products according to preset rules to obtain the target fields of the multiple products; the encoder in the text generation model encodes the target fields to obtain the encoded hidden sequence.
[0122] The target fields include each field in each product and the identifier corresponding to each product.
[0123] For example: x = (x) obtained in step S101 1,1 ,x 1,2 ,...,x 2,1 ,x 2,2 ,...,x n,1 ,...,x n,m The data is segmented according to preset rules, and the identifier of each product is added after the field of each product to obtain the target field x = (x... 1,1 ,x 1,2 ,...[SEP1],x 2,1 ,x 2,2 ,...[SEP2],x n,1 ,...,x n,m [SEP n]).
[0124] Where, x i,j To input the j-th character / word of the i-th product, [SEP i [] represents a separator between the i-th item and the (i+1)-th item. This invention utilizes [SEP] i This allows the decoder to distinguish between different products, thereby learning the differences between each product and the logical sequence information describing the different products.
[0125] Step S22: The decoder in the text generation model processes the encoded hidden sequence to generate product recommendation copy arranged in order.
[0126] It should be noted that the specific implementation process of step S22 includes the following steps:
[0127] Step S31: The decoder in the text generation model calculates the encoded value of the identifier corresponding to each product to determine the attention probability of each product.
[0128] In the specific implementation step S31, the decoder in the text generation model substitutes the encoded value of the identifier corresponding to each product into formula (2) for calculation, determines the historical attention probability of the product, and expresses it through formula (3).
[0129] At this point, b in formula (2) i Let h be the attention probability for the i-th item. sepi s is the encoded value of the identifier corresponding to the i-th product, i.e., the hidden vector; t-1 Let T be the product pairing vector of the previous product, and T be the length of the long text of multiple products. W c and V c It is a parameter matrix.
[0130] At this point, b in formula (3) i For the attention probability of each item, β i Let be the attention probability of the decoder for the i-th item.
[0131] Step S32: The decoder in the text generation model adjusts the vector of encoded values of the corresponding product's fields based on the attention probability of each product to obtain the target attention vector of each product's fields.
[0132] In the specific implementation step S32, the attention probability of each product and the vector of the encoding value of the corresponding product's field are substituted into formula (4) for calculation, so as to adjust the vector of the encoding value of the corresponding product's field and obtain the target attention vector of each product's field.
[0133] At this point, α' in formula (4) t,i α is the target attention vector for the field of the i-th product after adjustment. t,i Let x be the field of the i-th product at time t. i The vector of encoded values, β i Let be the attention probability of the decoder for the i-th item.
[0134] Step S33: The decoder in the text generation model calculates the context vector based on the target attention vector.
[0135] In the specific implementation step S33, the target attention vector of each product's field and the encoding value of each product's field are substituted into formula (5) for calculation to obtain the context vector.
[0136] At this point, c' in formula (5) t Let α' be the context vector. t,i h is the attention vector for the field of the adjusted i-th product. i This is the encoded value of the field for the i-th product.
[0137] Step S34: The decoder in the text generation model processes the context vector, the target output value of the previous product, and the product pairing vector of the previous product to determine the product pairing vector of the current product.
[0138] In step S34, if the field of the previous product is the same as the field of the first input product, the target output value of the previous product and the product matching vector of the previous product are taken as preset values.
[0139] In the specific implementation step S34, the historical context vector, the target output value of the previous product, and the product matching vector of the previous product are substituted into formula (6) for processing to determine the product matching vector of the current product.
[0140] At this point, S in formula (6) t To determine the product pairing vector for the current product, y t-1 c' is the target output value for the previous product. t S is the context vector. t-1 This is the product pairing vector for the previous product.
[0141] It should be noted that the target output value y for the next item t It is based on the product pairing vector S of the current product. t Obtained through conversion.
[0142] When i = 1, S t-1 As a preset value, y t-1 This is also the default value.
[0143] It should be further noted that the preset value is a preset setting, for example, it can be set to 0, and the preset value S0 and the preset value y0 can be the same or different.
[0144] Step S35: Combine the product pairing vectors of each product according to the input order of the fields of multiple products to obtain the corresponding product recommendation copy.
[0145] In the specific implementation of step S35, the product matching vectors of each product calculated in step S34 are combined according to the input order of the fields of multiple products to obtain the corresponding product recommendation copy.
[0146] Optionally, the method may also include recommending the product recommendation text to the user.
[0147] In this embodiment of the invention, fields of multiple products input by the user are obtained; these fields are used as input to a text generation model, which processes the fields to output product recommendation text arranged in a specific order. The text generation model is trained using sample data. By using a text generation model trained on sample data, it is possible to predict the fields of multiple products and output product recommendation text arranged in a specific order, thus enabling recommendations for multiple products and improving the logical consistency of product recommendation text.
[0148] Corresponding to the product recommendation copy generation method shown in the above embodiments of the present invention, the present invention also discloses a product recommendation copy generation device, such as... Figure 3 The diagram shown is a structural schematic of a product recommendation copy generation device according to an embodiment of the present invention. The device includes:
[0149] The acquisition module 301 is used to acquire the fields of multiple products input by the user and use the fields of the multiple products as input to the text generation model.
[0150] The text generation model 302 is used to process the fields of the multiple products based on the text generation model and output product recommendation copy in order. The text generation model is constructed by the construction module 304.
[0151] It should be noted that the specific principles and execution processes of each unit in the product recommendation copy generation device disclosed in the above embodiments of the present invention are the same as those of the product recommendation copy generation method of the present invention. Please refer to the corresponding parts of the product recommendation copy generation method disclosed in the above embodiments of the present invention, and they will not be repeated here.
[0152] In this embodiment of the invention, fields of multiple products input by the user are obtained; these fields are used as input to a text generation model, which processes the fields to output product recommendation text arranged in a specific order. The text generation model is trained using sample data. By using a text generation model trained on sample data, it is possible to predict the fields of multiple products and output product recommendation text arranged in a specific order, thus enabling recommendations for multiple products and improving the logical consistency of product recommendation text.
[0153] Based on the product recommendation copy generation device shown in the above embodiments of the present invention, the construction module 304 is used to acquire sample data, which is the historical multi-product combination copy input by the user within a historical time period and the corresponding historical multi-product combination copy. The historical multi-product combination copy is obtained by manually processing the historical product fields input by the user. The encoder is trained using the historical product fields to determine the trained historical hidden sequence. The historical hidden sequence includes the encoded value of the identifier corresponding to each historical product and the encoded value of each field in each historical product. The decoder is trained based on the vectors of the historical hidden sequence and the historical multi-product combination copy to determine the text generation model composed of the trained encoder and the decoder.
[0154] Accordingly, the module 304, which trains the decoder based on the vectors of the historical hidden sequence and the historical multi-product combination copy, and determines the text generation model composed of the trained encoder and decoder, is specifically used for:
[0155] The decoder calculates the encoded value of the identifier corresponding to each historical product based on the attention mechanism to determine the historical attention probability of each historical product; it adjusts the vector of the encoded value of the corresponding product's field based on the historical attention probability of each historical product to determine the historical attention vector of each historical product's field; it calculates the historical context vector based on the historical attention vector of each historical product's field; it processes the historical context vector and the vector of the historical multi-product combination text to determine the output vector; it processes the output vector and the historical context vector using the classification function in the decoder to determine the decoding probability of the vector of the historical multi-product combination text; it performs likelihood calculation based on the decoding probability of the vector of the historical multi-product combination text to determine the loss value; when the loss value is determined to be within a preset range, it determines that the currently trained encoder and decoder constitute a text generation model.
[0156] Based on the product recommendation copy generation device shown in the above embodiments of the present invention, the text generation model 302 includes a decoder and an encoder; the encoder in the text generation model is used to process the fields of the multiple products to determine the corresponding encoding hidden sequence, the encoding hidden sequence including the encoding value of each field in each product, and the encoding value of the identifier corresponding to each product.
[0157] The decoder in the text generation model is used to process the encoded hidden sequence to generate product recommendation copy arranged in sequence.
[0158] Based on the product recommendation copy generation device shown in the above embodiments of the present invention, the decoder in the text generation model is specifically used for: calculating the encoded value of the identifier corresponding to each product to determine the attention probability of each product; adjusting the vector of the encoded value of the field of the corresponding product based on the attention probability of each product to obtain the target attention vector of the field of each product; calculating the context vector based on the target attention vector; processing the context vector, the target output value of the previous product, and the product matching vector of the previous product to determine the product matching vector of the current product; if the field of the previous product is the field of the first input product, the target output value of the previous product and the product matching vector of the previous product are taken as preset values; and combining the product matching vector of each product according to the input order of the fields of multiple products to obtain the corresponding product recommendation copy.
[0159] Based on the product recommendation copy generation device shown in the above embodiments of the present invention, the encoder in the text generation model is specifically used to: perform word segmentation processing on the fields of the multiple products according to preset rules to obtain the target fields of the multiple products, wherein the target fields include each field in each product and the identifier corresponding to each product; the encoder in the text generation model encodes the target fields to obtain the encoded hidden sequence.
[0160] This invention also discloses an electronic device for running database stored procedures, wherein running the database stored procedures involves executing the above-described... Figure 1 and Figure 2 A publicly disclosed method for generating product recommendation copy.
[0161] This invention also discloses a computer storage medium, the storage medium including a stored database procedure, wherein, during the execution of the stored database procedure, the device where the storage medium is located is controlled to execute the above-mentioned... Figure 1 and Figure 2 A publicly disclosed method for generating product recommendation copy.
[0162] In the context of this disclosure, a computer storage medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0163] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0164] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0165] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating product recommendation copy, characterized in that, The method includes: Retrieve the fields for multiple products input by the user; The fields of the multiple products are used as input to the text generation model. Based on the text generation model, the fields of the multiple products are processed, and the product recommendation copy is output in order. The text generation model is trained using sample data. The process of training a text generation model using sample data includes: Obtain sample data, which includes user input and corresponding historical multi-product combination text within a historical time period. The historical multi-product combination text is obtained by manually processing the historical product fields input by the user. The encoder is trained using the product history field to determine the trained historical hidden sequence, which includes the encoded value of the identifier corresponding to each product in the history and the encoded value of each field in each product in the history. The decoder is trained based on the vectors of the historical hidden sequence and the historical multi-product combination text, and the text generation model is determined by the trained encoder and decoder. The step of training the decoder based on the vectors of the historical hidden sequence and the historical multi-product combination copywriting, and determining the text generation model composed of the trained encoder and decoder, includes: The decoder calculates the encoded value of the identifier corresponding to each historical item based on the attention mechanism to determine the historical attention probability of each historical item. Based on the historical attention probability of each product in history, the vector of the encoded values of the corresponding product's fields is adjusted to determine the historical attention vector of each product's fields in history. Calculate the historical context vector based on the historical attention vector of each product's fields in the history; The historical context vector and the vector of the historical multi-product combination copy are processed to determine the output vector; The output vector and the historical context vector are processed using the classification function in the decoder to determine the decoding probability of the vector of the historical multi-product combination copy. The likelihood is calculated based on the decoding probability of the vector of the historical multi-product combination copywriting to determine the loss value; When the loss value is determined to be within a preset range, a text generation model is determined to be composed of the encoder and decoder obtained from the current training.
2. The method according to claim 1, characterized in that, The process of processing the fields of the multiple products based on the text generation model and outputting product recommendation copy arranged in order includes: The encoder in the text generation model processes the fields of the multiple products to determine the corresponding encoding hidden sequence. The encoding hidden sequence includes the encoding value of each field in each product and the encoding value of the identifier corresponding to each product. The decoder in the text generation model processes the encoded hidden sequence to generate product recommendation copy arranged in sequence.
3. The method according to claim 2, characterized in that, The decoder in the text generation model processes the encoded hidden sequence to generate product recommendation text arranged in sequence, including: The decoder in the text generation model calculates the encoded value of the identifier corresponding to each product to determine the attention probability of each product. The decoder in the text generation model adjusts the vector of encoded values of the corresponding product's fields based on the attention probability of each product, thereby obtaining the target attention vector of each product's fields. The decoder in the text generation model calculates the context vector based on the target attention vector; The decoder in the text generation model processes the context vector, the target output value of the previous product, and the product pairing vector of the previous product to determine the product pairing vector of the current product. If the field of the previous product is the same as the field of the first input product, the target output value of the previous product and the product pairing vector of the previous product are taken as preset values. The product combination vectors for each product are combined according to the input order of the fields for multiple products to obtain the corresponding product recommendation copy.
4. The method according to claim 2, characterized in that, The encoder in the text generation model processes the fields of the multiple products to determine the corresponding encoded hidden sequences, including: The encoder in the text generation model performs word segmentation on the fields of the multiple products according to preset rules to obtain the target fields of the multiple products. The target fields include each field of each product and the identifier corresponding to each product. The encoder in the text generation model encodes the target field to obtain an encoded hidden sequence.
5. A product recommendation copy generation device, characterized in that, The device includes: The acquisition module is used to acquire the fields of multiple products input by the user and use the fields of the multiple products as input to the text generation model; A text generation model is used to process the fields of the multiple products based on the text generation model and output product recommendation copy arranged in order. The text generation model is constructed by the construction module. The construction module is used to acquire sample data, which includes user input and corresponding historical multi-product combination text within a historical time period. The historical multi-product combination text is obtained by manually processing the historical product fields input by the user. The encoder is trained using the product history field to determine the trained historical hidden sequence, which includes the encoded value of the identifier corresponding to each product in the history and the encoded value of each field in each product in the history. The decoder is trained based on the vectors of the historical hidden sequence and the historical multi-product combination text, and the text generation model is determined by the trained encoder and decoder. Specifically, the construction module trains the decoder based on the vectors of the historical hidden sequence and the historical multi-product combination copy, and determines the text generation model composed of the trained encoder and decoder, specifically for: The decoder calculates the encoded value of the identifier corresponding to each historical item based on the attention mechanism to determine the historical attention probability of each historical item. Based on the historical attention probability of each product in history, the vector of the encoded values of the corresponding product's fields is adjusted to determine the historical attention vector of each product's fields in history. Calculate the historical context vector based on the historical attention vector of each product's fields in the history; The historical context vector and the vector of the historical multi-product combination copy are processed to determine the output vector; The output vector and the historical context vector are processed using the classification function in the decoder to determine the decoding probability of the vector of the historical multi-product combination copy. The likelihood is calculated based on the decoding probability of the vector of the historical multi-product combination copywriting to determine the loss value; When the loss value is determined to be within a preset range, a text generation model is determined to be composed of the encoder and decoder obtained from the current training.
6. An electronic device, characterized in that, The electronic device is used to run a program, wherein the program executes the product recommendation copy generation method as described in any one of claims 1-4.
7. A computer storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is running, it controls the device where the storage medium is located to execute the product recommendation copy generation method as described in any one of claims 1-4.