Comment generation method, device, equipment and computer-readable storage medium
By combining the text attributes and picture attributes of the product, and using the recurrent neural network model and the product knowledge graph to generate comments, the problem of single comment attributes in the existing technology is solved, the richness and customization of comments are achieved, and user trust is improved.
Patent Information
- Application Number
- CN202210572826.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-24
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-05-24
AI Technical Summary
The existing technology is difficult to generate more than one product review, resulting in a single review attribute, which cannot meet the customized needs of different products and stores, and users' trust in the content of the comments is reduced.
By determining the input attribute vector based on the text attributes and picture attributes of the product, predicting the target attributes using the recurrent neural network model, and determining candidate keywords in combination with the product knowledge graph, rich and customized comments are generated.
The generated comment content is more rich and complete, and the comment attributes are more comprehensive, ensuring that comments are closely related to keywords and improving users' trust in the comment content.
Smart Images

Figure CN114926210B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a comment generation method, device, equipment and computer-readable storage medium. Background Art
[0002] With the continuous development of Internet technology, shopping methods are also changing. Currently, more and more users are shopping online. When people choose products online, in addition to comparing product information, they usually read product reviews before deciding whether to buy the product in the store. Therefore, product reviews have a great influence on users' consumption behavior.
[0003] To this end, merchants usually use various methods to increase the number of product reviews, especially the number of positive reviews. For example, merchants can encourage users who purchase products to write product reviews by offering rewards, or require internal employees or others to write product reviews. However, this method cannot keep up with the speed of new product launches, and is costly and inefficient.
[0004] In addition, merchants can also determine the review template by analyzing the real comments of users and select words from the word library to fill the template. However, the review attribute structure in this way looks relatively simple, and the words in the word library cannot provide customized reviews for products, resulting in the same structure or even the same content of reviews under different products / stores. This will make it easy for potential customers to distinguish that these reviews are "fake reviews" generated by machines, reducing users' trust in the review content and having a counterproductive effect. Summary of the invention
[0005] The main purpose of the present invention is to provide a comment generation method, device, equipment and computer-readable storage medium, aiming to solve the technical problem of how to avoid generating comments with a single comment attribute.
[0006] To achieve the above object, the present invention provides a comment generation method, comprising the following steps:
[0007] Determine an input attribute vector according to the product text attributes and product image attributes of the object to be evaluated;
[0008] Predicting a target attribute corresponding to the input attribute vector based on a preset recurrent neural network model;
[0009] Obtain all candidate keywords corresponding to the target attribute in the preset product knowledge graph, determine the target keyword among the candidate keywords, and generate a review of the object to be reviewed based on the target keyword.
[0010] Optionally, the step of predicting the target attribute corresponding to the input attribute vector based on a preset recurrent neural network model includes:
[0011] Determine a unit latent vector corresponding to the input attribute vector according to a preset recurrent neural network model;
[0012] A context latent vector is calculated according to each of the unit latent vectors, and an output probability value of each of the attributes is predicted according to the context latent vector, and an attribute corresponding to a maximum output probability value is determined as a target attribute.
[0013] Optionally, the step of determining a target keyword among the candidate keywords includes:
[0014] Determine the previous content corresponding to the target attribute, calculate the probability that each candidate keyword and the previous content form a complete sentence, and use the candidate keyword corresponding to the maximum probability as the target keyword.
[0015] Optionally, the step of generating a review of the object to be reviewed according to the target keyword includes:
[0016] Determine other attributes in the knowledge graph that match the target keyword and the object to be evaluated at the same time, and use the other attribute information as extended attributes;
[0017] Determine an extended attribute vector corresponding to the extended attribute, and predict a target extended attribute corresponding to the extended attribute vector based on the recurrent neural network model;
[0018] Determine a target extension keyword that matches the target extension attribute in the product knowledge graph, and generate a review of the object to be reviewed based on the target extension keyword.
[0019] Optionally, before the step of obtaining all candidate keywords corresponding to the target attribute in the preset product knowledge graph, the following steps are included:
[0020] Obtaining preset historical product reviews, and extracting entity objects in the historical product reviews and entity attribute information of the entity objects;
[0021] The target sentiment keyword corresponding to the entity object is determined according to the historical product reviews, and a product knowledge graph is constructed according to the entity object, entity attribute information and the target sentiment keyword.
[0022] Optionally, the step of determining a target emotional keyword corresponding to the entity object according to the historical product reviews includes:
[0023] Determine all sentiment keywords corresponding to the entity object according to the historical product reviews;
[0024] If there are multiple emotional keywords, traverse each of the emotional keywords and calculate the left and right information entropy of the traversed emotional keywords;
[0025] If the left-right information entropy is greater than a preset threshold, the point mutual information value of the traversed emotional keywords is calculated, and the score value of the traversed emotional keywords is calculated according to the left-right information entropy and the point mutual information value;
[0026] Determine candidate keywords among the emotion keywords according to the score values, and use the candidate keywords as target emotion keywords.
[0027] Optionally, the step of determining the input attribute vector according to the product text attributes and product image attributes of the object to be evaluated includes:
[0028] The attribute vector of the commodity text attribute of the object to be evaluated and the attribute vector of the commodity image attribute of the object to be evaluated are concatenated to obtain an input attribute vector.
[0029] In addition, to achieve the above-mentioned purpose, the present invention also provides a comment generation device, comprising:
[0030] A determination module, used to determine an input attribute vector according to a product text attribute and a product image attribute of an object to be evaluated;
[0031] A prediction module, used to predict the target attribute corresponding to the input attribute vector based on a preset recurrent neural network model;
[0032] A generation module is used to obtain all candidate keywords corresponding to the target attribute in the preset product knowledge graph, determine the target keyword among the candidate keywords, and generate a review of the object to be reviewed based on the target keyword.
[0033] In addition, to achieve the above-mentioned purpose, the present invention also provides a comment generation device, which includes a memory, a processor, and a comment generation program stored in the memory and executable on the processor. When the comment generation program is executed by the processor, the steps of the comment generation method as described above are implemented.
[0034] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a comment generation program is stored, and when the comment generation program is executed by a processor, the steps of the comment generation method as described above are implemented.
[0035] The present invention determines an input attribute vector according to the product text attributes and product image attributes of the object to be evaluated, and then predicts the target attribute corresponding to the input attribute vector according to a recurrent neural network model. This allows the product text attributes and product image attributes of the product to be considered before generating a review, so that the content of the subsequently generated review is richer and more complete. The present invention determines the candidate keywords corresponding to the target attributes according to the knowledge graph, selects one candidate keyword as the target keyword, and then generates a review based on the target keyword, thereby ensuring that the generated review is closely related to the keyword. Since the generated review comprehensively considers the product text attributes and product image attributes, the review attributes of the generated review are more comprehensive. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a schematic diagram of the terminal\device structure of the hardware operating environment involved in the embodiment of the present invention;
[0037] Figure 2 This is a flow chart of a first embodiment of a method for generating comments according to the present invention;
[0038] Figure 3 A schematic diagram of a device module of a comment generation device of the present invention;
[0039] Figure 4 Schematic diagram of the product knowledge graph scenario in the review generation method of the present invention.
[0040] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0041] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0042] like Figure 1 As shown, Figure 1 It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention.
[0043] The terminal in the embodiment of the present invention is a comment generating device.
[0044] like Figure 1As shown, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0045] Optionally, the terminal may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, the sensors include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the terminal device is moved to the ear. Of course, the terminal device may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0046] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0047] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a comment generation program.
[0048] exist Figure 1 In the terminal shown, the network interface 1004 is mainly used to connect to the backend server and perform data communication with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and perform data communication with the client; and the processor 1001 can be used to call the comment generation program stored in the memory 1005 and perform the following operations:
[0049] Reference Figure 2 The present invention provides a comment generation method. In a first embodiment of the comment generation method, the comment generation method comprises the following steps:
[0050] Step S10, determining an input attribute vector according to the product text attributes and product image attributes of the object to be evaluated;
[0051] Since current product reviews do not have information content for reference and do not evaluate product attributes and usage experience, the generated reviews are relatively simple. Therefore, in order to obtain product evaluations with effective information content and comprehensive visual text, and provide decisions for user purchasing behavior, in this embodiment, a knowledge graph containing visual and text is constructed in combination with image and structured text attribute data for information enhancement. The product attributes contained in the reviews can be made more comprehensive and have high information content as needed, while also containing thematic keywords closely related to the product.
[0052] Moreover, in this embodiment, the Encoder-Decoder framework is adopted, and the external knowledge of the knowledge graph is combined as an auxiliary enhancement means. The input can be multimodal information of pictures and texts to automatically generate comments. Specifically, in the Encoder encoding stage, the Encoder input is the product attributes (for example, price) and product pictures. First, the visual information of the picture is extracted, such as shape, size, color, etc., and the product attributes and visual information are spliced and input into the recurrent neural network to obtain each unit (h 1 ,h 2 ,h 3 ,h 4 ,h 5) hidden state vector. In the Decoder decoding stage, it is a process of predicting words and generating sentences in sequence. In the training stage, the input at each time point depends on the Embedding vector of the current word and the hidden state vector at the previous time point. The hidden state vector hidden state of the subsequent unit of the Encoder is used as the initial hidden state vector of the Decoder. The attention score is calculated for the hidden state at each time point and the hidden state in the Encoder encoding stage respectively. The context vector context vector is obtained based on the weighted sum of the attention score and the hidden state of each unit of the Encoder. The attribute or visual information most relevant to the current word to be predicted in the Encoder input information is calculated through softmax. For example, the correlation between the current predicted word and the attribute price is calculated through softmax. Then, combined with the pre-constructed knowledge graph, the corresponding "<entity, attribute> and keyword" (entity such as shoes, attribute such as price, keyword such as expensive) candidate list is found from the knowledge graph. For example, the Deocer decoding predicts that the attribute associated with the current word is price, and the knowledge base<shoes,price> The most relevant keyword is selected from the candidate list in combination with the context, and the current keyword is used as the word to be predicted, i.e., the comment. Among them, since the input attributes may not be complete, in order to obtain a more comprehensive and complete comment, it is necessary to find out whether there is additional attribute information from the knowledge graph as a supplement.
[0053] Therefore, in this embodiment, before generating comments, it is necessary to construct a knowledge graph of the product. The construction process may include entity extraction, keyword mining, knowledge mining, and knowledge storage. Among them, entity extraction may be entity extraction from existing product reviews. Keyword mining may be to extract entity / attribute-emotion keywords from historical comments on entities or titles of entities (such as products) and add them to the knowledge graph as candidate knowledge.
[0054] When it is necessary to generate comments on the object to be evaluated, it can be done by combining the text data and image data of the object to be evaluated, that is, the product text attributes and product image attributes of the object to be evaluated are input into the GRU (recurrent neural network model), and the image visual information is extracted through image Captioining (image description), and word embedding is performed separately to obtain attribute vectors, and the attribute vectors are concatenated to obtain the input attribute vector.
[0055] And because the data input to the model may contain different formats, such as structured text and unstructured text. If it is structured text data, the attribute data of the key-value dictionary can be crawled from the e-commerce platform and used as the product text attribute. If it is unstructured text data, the product title and product comments can be crawled from the e-commerce platform, and then entity extraction is performed to obtain the product text attribute. The product image attribute can be extracted by using the image captioning method to extract the visual information of the product image, such as color, shape, color, size, etc., as the visual supplementary information of the product text attribute.
[0056] After obtaining the product text attributes and product image attributes, they can be input into the recurrent neural network model to obtain the input attribute vector. The input attribute vector can include Embedding (text information) + Embedding (extracted visual information). Each unit in the neural network outputs a hidden vector hidden state, and each hidden state retains the neuron information of its own "recent memory". The object to be reviewed can be a physical object, such as a wallet, a pair of shoes, etc.
[0057] Step S20, predicting the target attribute corresponding to the input attribute vector based on a preset recurrent neural network model;
[0058] After determining the input attribute vector, the hidden vector of each unit can be obtained through the bidirectional recurrent neural network model (GRU), that is:
[0059] E = Embedding(A);
[0060]
[0061] E is the Embedding representation of the Attribute set. The bidirectional GRU model is used to model the Attribute Embedding to generate the hidden state e of the sequence. h .
[0062] After determining the hidden state, the attention score can be calculated through the attention mechanism model to obtain the decoding stage, output the hidden vector and the score value of each unit hidden vector, and then perform weighted summation on the hidden vectors of each unit according to the score values to update the context vector. The attribute score associated with the current predicted word is calculated through the softmax function, and the attribute corresponding to the largest attribute score is determined and used as the target attribute.
[0063] Moreover, the initial hidden state in the decoding stage is the hidden state vector at the last time point in the encoding stage, that is, The output hidden state at the current time point depends on the hidden state of the previous step:
[0064] h t =GRU(W t ,h t-1 );
[0065] Among them, W t is the neural network weight matrix parameter. After the context vector is updated through the attention mechanism, the output latent vector of the current Decoder stage needs to be updated, that is:
[0066]
[0067] Among them, the context hidden vector based on the attention mechanism W 1 and W 2 They are the contextual latent vector c t and the original output hidden state h at the current time point t The neural network weight matrix parameters are used to obtain the output hidden state after the current time point is updated through the tanh activation function. Finally, the probability value distribution of the output attribute at the current time point is predicted based on softmax:
[0068]
[0069] in, is the updated output hidden state at the current time point calculated above, W p It is the neural network weight matrix parameter for calculating softmax. The final probability value is a 1*N dimensional score, and the sum of the scores is 1. N is the number of product attribute sets, for example [0.01, 0.23, 0.34, 0.02, 0.24, 0.16]. The attribute corresponding to the score 0.34 is the predicted target attribute.
[0070] Step S30, obtaining all candidate keywords corresponding to the target attribute in the preset product knowledge graph, determining the target keyword among the candidate keywords, and generating a review of the object to be reviewed according to the target keyword.
[0071] After determining the target attribute, a list of candidate keywords matching the target attribute is obtained in the product knowledge graph, and then a keyword is selected from the candidate keyword list as the current predicted word, and the comment of the object to be reviewed is determined based on the current predicted word. Specifically, in the knowledge graph of the product constructed in advance, the entity-attribute pair, that is, the candidate keyword list corresponding to the target attribute, can be found according to the target attribute, and then the matching degree between all keywords in the candidate keyword list and the context is calculated according to the context, and the keyword with the largest matching degree is selected as the current predicted word, that is, the target keyword. After determining the target keyword, the target keyword can be directly used as the predicted word, that is, the comment of the object to be reviewed. The target keyword can also be enhanced and supplemented to obtain the comment of the object to be reviewed. For example, from the knowledge graph, the attribute features matching the object to be reviewed are obtained as extended attribute features, and the extended attribute features are input into the bidirectional recurrent neural network model for training to generate comment content related to the extended attribute for the object to be reviewed, and the comment content and the target keyword are used as the comment of the object to be reviewed.
[0072] In this embodiment, by determining the input attribute vector according to the product text attributes and product image attributes of the object to be evaluated, and then predicting the target attribute corresponding to the input attribute vector according to the recurrent neural network model, it is possible to take into account the product text attributes and product image attributes of the product before generating the review, so that the content of the subsequently generated review is richer and more complete, and determine the candidate keywords corresponding to the target attribute according to the knowledge graph, select one candidate keyword as the target keyword, and then generate the review according to the target keyword, so as to ensure that the generated review is closely related to the keyword, and because the generated review comprehensively considers the product text attributes and product image attributes, the review attributes of the generated review are more comprehensive.
[0073] Further, based on the first embodiment of the present invention, a second embodiment of the comment generation method of the present invention is proposed. In this embodiment, the refinement of step S20 of the above embodiment, the step of predicting the target attribute corresponding to the input attribute vector based on a preset recurrent neural network model, includes:
[0074] Step a, determining a unit latent vector corresponding to the input attribute vector according to a preset recurrent neural network model;
[0075] In this embodiment, the recurrent neural network model can be a bidirectional recurrent neural network model based on an attention mechanism. After the input attribute vector is determined, the input attribute vector can be input into the bidirectional recurrent neural network model to obtain the hidden state vector of each unit, that is, the unit hidden vector of each attribute, that is:
[0076] E = Embedding(A);
[0077]
[0078] E is the Embedding representation of the Attribute set. The bidirectional GRU model is used to model the Attribute Embedding to generate the hidden state e of the sequence. h .
[0079] Step b: calculating a context latent vector based on each of the unit latent vectors, and predicting the output probability value of each of the attributes based on the context latent vector, and determining the attribute corresponding to the maximum output probability value as the target attribute.
[0080] After determining the unit latent vector, the score of each unit latent vector can be calculated according to the attention mechanism, and then the score of each unit latent vector is weighted and summed according to the score to update the initial context vector, and then the attribute score of each attribute is calculated through the updated context vector and the softmax function, and this attribute score is used as the output probability value, and a maximum output probability value is selected among these output probability values, and the attribute corresponding to this output probability value is used as the target attribute.
[0081] In this embodiment, the unit latent vector is determined by a recurrent neural network model, and then the output probability value is predicted based on the unit latent vector, and the attribute corresponding to the maximum output probability value is determined as the target attribute, thereby ensuring the accuracy of the acquired target attribute.
[0082] Furthermore, the step of determining the target keyword among the candidate keywords includes:
[0083] Step c, determining the previous content corresponding to the target attribute, calculating the probability that each candidate keyword and the previous content form a complete sentence, and taking the candidate keyword corresponding to the maximum probability as the target keyword.
[0084] In this embodiment, after the context vector is obtained by updating the attention mechanism in the recurrent neural network model, the context vector can be used to predict the content of the previous text, and it can be used as the content of the previous text corresponding to the target attribute, and then it can be used as the content of the previous text corresponding to the target attribute, and after obtaining the candidate keywords of the target attribute from the commodity knowledge map, the keyword with the highest probability can be calculated in combination with the content of the previous text, and it can be used as the target keyword. That is, after predicting the context of the candidate keyword, each candidate word in the candidate keyword list is used as the current predicted target word, and the probability of the complete sentence is calculated respectively, and the candidate word with the highest probability is the target word. For example, if the context of the candidate keyword is theshoes is made of genuine leather, the price is, and the keywords in the candidate keyword list are expensive, cheap, then the probability of the sentence is calculated according to the calculation formula of P(W), and the keyword that makes the sentence probability the highest is selected as the current predicted word, that is, the target keyword.
[0085] Among them, the probability calculation method can be to split the sentence into word combinations, and the probability of the entire sentence is obtained by calculating the joint probability of each word. According to Markov conditional independence, the probability of each word is determined by the previous word combination.
[0086] In this embodiment, by determining the previous content corresponding to the target attribute, calculating the probability corresponding to each candidate keyword according to the previous content, and taking the candidate keyword corresponding to the maximum probability as the target keyword, the accuracy of the acquired target keyword is guaranteed.
[0087] Furthermore, the step of generating a review of the object to be reviewed according to the target keyword includes:
[0088] Step d, determining other attributes in the knowledge graph that simultaneously match the target keyword and the object to be evaluated, and using the other attributes as extended attributes;
[0089] Step e, determining an extended attribute vector corresponding to the extended attribute, and predicting a target extended attribute corresponding to the extended attribute vector based on the recurrent neural network model;
[0090] Step f, determining the target extended keywords that match the target extended attributes in the product knowledge graph, and generating a review of the object to be reviewed based on the target extended keywords.
[0091] In this embodiment, the commodity knowledge graph stores complete product attributes. Due to incomplete input information, the content of the comments generated by the encoding and decoding framework is incomplete. The comment content can be expanded according to the attributes and keywords stored in the knowledge graph, so that the final generated comments are more complete and richer in information. For example, the knowledge graph stores many attributes of the entity of shoes, including color, material, price, applicable population, style, brand, etc. If the attributes input by the user do not include the "style" attribute, the generated comments do not include the content of the style attribute. Therefore, in order to improve the accuracy of generating comments, firstly, based on the current predicted word (such as expensive) determined in the knowledge auxiliary stage, that is, the target keyword, further based on the knowledge graph, the attributes corresponding to the predicted word (such as expensive) and the information of the entity input by the user (such as formal shoes) except the attributes currently input by the user are determined as enhanced and expanded attribute information-for example, the attributes corresponding to the predicted word "expensive" and the entity "formal shoes" include the attributes of pattern, upper material and style in addition to the attribute "price" input by the user. Then the determined attributes "pattern, upper material and style" can be used as enhanced and expanded attribute information. That is, extended attributes. After determining the extended attributes, the extended attribute vector corresponding to the extended attributes can be determined. The method of obtaining the extended attribute vector can be the same as the method of obtaining the input attribute vector, which will not be elaborated here. The extended attribute vector is then input into the recurrent neural network model for model training to predict the target extended attribute corresponding to the extended attribute vector, and then the keywords corresponding to the target extended attribute are determined in the product knowledge graph and used as the target extended keywords. At this time, the target extended keyword corresponds to both the target keyword and the target extended attribute, and then a comment on the object to be commented on is generated based on the target extended keyword. In addition, in another scenario, comments on the object to be commented on can also be generated directly based on the target keyword.
[0092] In this embodiment, by determining other attributes in the knowledge graph that match the target keywords and the object to be evaluated and using them as extended attributes, and then predicting the target extended attributes based on the recurrent neural network model, the target extended keywords corresponding to the target extended attributes in the product knowledge graph are determined to generate corresponding comments, thereby ensuring the integrity of the generated comments.
[0093] Furthermore, before the step of obtaining all candidate keywords corresponding to the target attribute in the preset product knowledge graph, the method includes:
[0094] Step g, obtaining preset historical product reviews, and extracting entity objects in the historical product reviews and entity attribute information of the entity objects;
[0095] In this embodiment, it is necessary to construct a commodity knowledge graph first. When constructing the commodity knowledge graph, entity extraction can be performed first. First, entity extraction is performed from existing commodity reviews. Entity extraction includes rule-based and dictionary-based methods, statistical-based methods, and deep learning methods. This embodiment uses the method of named entity recognition to extract entities and attributes. For example, if the entity is "shoes", the corresponding attributes (i.e., entity attribute information) may include name, origin, user group, style, material, shape, style, pattern, etc. Further, the attribute "material" may have different types (also referred to as relationships in this proposal), including: cowhide, synthetic leather, mesh, polyurethane, etc. Then, from the structured and semi-structured data crawled from the e-commerce platform, the relationship between entities is extracted through rules and supervised learning to form a triple form, such as <Xtep sports shoes, material, synthetic leather>. Among them, the determination of entity objects is mainly entity disambiguation. Entity disambiguation needs to distinguish the phenomenon of polysemy. For example, the commodity apple can refer to both the apple brand and the fruit apple, which needs to be distinguished in combination with the commodity category and attribute.
[0096] Step h: determine the target sentiment keywords corresponding to the entity object based on the historical product reviews, and construct a product knowledge graph based on the entity object, entity attribute information and the target sentiment keywords.
[0097] After determining the entity object and the entity attribute information of the entity object, keyword mining can be performed. The entity / attribute-emotional keywords can be extracted from the historical comments on the entity or the title of the entity (such as a product) and added to the knowledge graph as candidate keywords, that is, the candidate keywords in the emotional keywords, the entity objects, and the entity attribute information are stored in the preset knowledge graph to obtain the product knowledge graph. Among them, for example, the results of mining keywords according to different words: if the word is "effect", the mined emotional keywords can be "good", "good", "obvious", "general", "poor", "strong", "thin", "comfortable", "suitable", "amazing", "significant", "perfect", "appropriate", "powerful", "gentle", "tight", "good", "easy", "high", "tight", "long", "sufficient", "viscous", "skin-fitting", "delicate", "good", "good", "very good", "very good", "relaxed", "white", "good", "thin", etc. If the word is "quality", the sentiment keywords mined can be "good", "good", "bad", "average", "high", and "important". If the word is "price / performance ratio", the sentiment keywords mined can be "high", "good", "low", and "good". The product knowledge graph can be as follows Figure 4As shown, the emotional knowledge graph contains <entity, attribute>, type and emotional keywords - for example: Crocodile formal shoes (entity), pattern (attribute), type (solid color), monotonous or mature or texture (emotional keywords). If the attribute is the upper material, the type is cowhide, and the emotional keywords are wear-resistant, durable and soft. If the attribute is price, and it is 160 yuan, the emotional keywords are cheap, expensive and affordable. If the attribute is style, the emotional keyword is British style. Among them, the target emotional keywords include candidate keywords.
[0098] In this embodiment, by extracting entity objects and entity attribute information of historical product reviews and determining target sentiment keywords of the entity objects, a product knowledge graph is constructed based on the entity objects, entity attribute information and target sentiment keywords, thereby ensuring the accuracy of the acquired product knowledge graph.
[0099] Specifically, the step of determining the target emotional keyword corresponding to the entity object according to the historical product reviews includes:
[0100] Step i, determining all emotional keywords corresponding to the entity object according to the historical product reviews;
[0101] Step j, if there are multiple emotional keywords, traverse each of the emotional keywords and calculate the left and right information entropy of the traversed emotional keywords;
[0102] In this embodiment, entity / attribute-emotional keywords are extracted from historical comments on entities (such as historical product reviews) or titles of entities (such as products) to obtain all emotional keywords corresponding to the entity objects. When there are multiple emotional keywords, each emotional keyword is traversed, and the target emotional keyword is calculated in the same way for each emotional keyword. That is, point mutual information and information entropy can be used to discover and mine new words. The left and right information entropies of the bigram bi-gram words are first calculated. Usually, the information entropy on the left and right sides of a candidate word (specifically the emotional keywords in the historical comments / titles) is calculated to reflect whether a word has rich left and right collocations. If a certain threshold is reached, it is considered that the two fragments can form a new word. The calculation formula of information entropy is:
[0103]
[0104] Where p(x) represents the frequency of word x. H(x) represents the left and right information entropy value of word x. Check whether the left and right information entropy values are greater than the preset threshold (an arbitrary value set in advance). Information entropy is used to measure the value of randomness (also known as uncertainty) of the file content. The greater the randomness, the greater the value of information entropy; otherwise, the smaller the value.
[0105] Step k, if the left-right information entropy is greater than a preset threshold, then calculating the point mutual information value of the traversed emotional keywords, and calculating the score value of the traversed emotional keywords according to the left-right information entropy and the point mutual information value;
[0106] Step 1: determining candidate keywords among the emotion keywords according to the score values, and using the candidate keywords as target emotion keywords.
[0107] When it is found that the left and right information entropy is greater than the preset threshold, the point mutual information value PMI of the emotional keyword (i.e. the traversed emotional keyword) can be calculated, that is:
[0108]
[0109] Finally, we sum the left and right information entropies and the pointwise mutual information values to get the score of the sentiment keyword, and then select the top N words according to the scores as the entity / attribute-candidate sentiment keywords, i.e., candidate keywords, and use these candidate keywords as the target sentiment keywords. Among them, the pointwise mutual information PMI (Pointwise Mutual Information) is used to measure the correlation between two things (such as two words). The larger the PMI value, the greater the correlation; otherwise, the smaller it is.
[0110] In this embodiment, when there are multiple emotional keywords, candidate keywords in each emotional keyword are determined according to the left and right information entropy and point mutual information value of the emotional keyword, and the candidate keywords are used as target emotional keywords, thereby ensuring the accuracy and effectiveness of the acquired target emotional keywords.
[0111] Furthermore, the step of determining the input attribute vector according to the product text attributes and product image attributes of the object to be evaluated includes:
[0112] Step m: concatenate the attribute vector of the commodity text attribute of the object to be evaluated and the attribute vector of the commodity image attribute of the object to be evaluated to obtain an input attribute vector.
[0113] In this embodiment, when generating comments on the object to be evaluated, it is necessary to combine the product text data and product image data of the object to be evaluated. After obtaining the product text attributes and product image attributes of the object to be evaluated, they are vectorized separately to obtain the attribute vector of the product text attributes of the object to be evaluated and the attribute vector of the product image attributes of the object to be evaluated, and then the two attribute vectors are spliced to obtain the input attribute vector.
[0114] In this embodiment, the input attribute vector is obtained by concatenating the attribute vector of the commodity text attribute and the attribute vector of the commodity image attribute, thereby ensuring the accuracy and validity of the obtained input attribute vector.
[0115] In addition, refer to Figure 3 The embodiment of the present invention further provides a comment generation device, comprising:
[0116] A determination module A10, used to determine an input attribute vector according to the commodity text attribute and commodity image attribute of the object to be evaluated;
[0117] A prediction module A20, used to predict the target attribute corresponding to the input attribute vector based on a preset recurrent neural network model;
[0118] The generation module A30 is used to obtain all candidate keywords corresponding to the target attribute in the preset product knowledge graph, determine the target keyword among the candidate keywords, and generate a review of the object to be reviewed based on the target keyword.
[0119] Optionally, the prediction module A20 is used to:
[0120] Determine a unit latent vector corresponding to the input attribute vector according to a preset recurrent neural network model;
[0121] A context latent vector is calculated according to each of the unit latent vectors, and an output probability value of each of the attributes is predicted according to the context latent vector, and an attribute corresponding to a maximum output probability value is determined as a target attribute.
[0122] Optionally, the generating module A30 is used to:
[0123] Determine the previous content corresponding to the target attribute, calculate the probability that each candidate keyword and the previous content form a complete sentence, and use the candidate keyword corresponding to the maximum probability as the target keyword.
[0124] Optionally, the generating module A30 is used to:
[0125] Determine other attributes in the knowledge graph that match the target keyword and the object to be evaluated at the same time, and use the other attribute information as extended attributes;
[0126] Determine an extended attribute vector corresponding to the extended attribute, and predict a target extended attribute corresponding to the extended attribute vector based on the recurrent neural network model;
[0127] Determine a target extension keyword that matches the target extension attribute in the product knowledge graph, and generate a review of the object to be reviewed based on the target extension keyword.
[0128] Optionally, the generating module A30 is used to:
[0129] Obtaining preset historical product reviews, and extracting entity objects in the historical product reviews and entity attribute information of the entity objects;
[0130] The target sentiment keyword corresponding to the entity object is determined according to the historical product reviews, and a product knowledge graph is constructed according to the entity object, entity attribute information and the target sentiment keyword.
[0131] Optionally, the generating module A30 is used to:
[0132] Determine all sentiment keywords corresponding to the entity object according to the historical product reviews;
[0133] If there are multiple emotional keywords, traverse each of the emotional keywords and calculate the left and right information entropy of the traversed emotional keywords;
[0134] If the left-right information entropy is greater than a preset threshold, the point mutual information value of the traversed emotional keywords is calculated, and the score value of the traversed emotional keywords is calculated according to the left-right information entropy and the point mutual information value;
[0135] Determine candidate keywords among the emotion keywords according to the score values, and use the candidate keywords as target emotion keywords.
[0136] Optionally, the determination module A10 is used to:
[0137] The attribute vector of the commodity text attribute of the object to be evaluated and the attribute vector of the commodity image attribute of the object to be evaluated are concatenated to obtain an input attribute vector.
[0138] The steps implemented by each functional module of the comment generation device may refer to the various embodiments of the comment generation method of the present invention, and will not be described in detail here.
[0139] In addition, the present invention also provides a comment generation device, which includes: a memory, a processor and a comment generation program stored in the memory; the processor is used to execute the comment generation program to implement the steps of each embodiment of the above-mentioned comment generation method.
[0140] The present invention also provides a computer-readable storage medium, which stores one or more programs. The one or more programs can also be executed by one or more processors to implement the steps of each embodiment of the above-mentioned comment generation method.
[0141] The specific implementation of the computer-readable storage medium of the present invention is basically the same as the above-mentioned embodiments of the comment generation method, and will not be repeated here.
[0142] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0143] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0145] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A comment generation method, characterized in that: The comment generation method comprises the following steps: Determine an input attribute vector according to the product text attributes and product image attributes of the object to be evaluated; Predicting the target attribute corresponding to the input attribute vector based on a preset recurrent neural network model; wherein the step of predicting the target attribute corresponding to the input attribute vector based on the preset recurrent neural network model comprises: determining the unit latent vector corresponding to the input attribute vector according to the preset recurrent neural network model; calculating the context latent vector according to each of the unit latent vectors, and predicting the output probability value of each of the attributes according to the context latent vector, and determining the attribute corresponding to the maximum output probability value as the target attribute; Obtain all candidate keywords corresponding to the target attribute in the preset product knowledge graph, determine the target keyword in each of the candidate keywords, and generate a review of the object to be reviewed based on the target keyword; wherein the step of determining the target keyword in each of the candidate keywords includes: determining the above content corresponding to the target attribute, calculating the probability that each candidate keyword and the above content form a complete sentence, and taking the candidate keyword corresponding to the maximum probability as the target keyword.
2. The comment generation method according to claim 1, characterized in that: The step of generating a review of the object to be reviewed according to the target keyword comprises: Determine other attributes in the product knowledge graph that match both the target keyword and the object to be evaluated, and use the other attributes as extended attributes; Determine an extended attribute vector corresponding to the extended attribute, and predict a target extended attribute corresponding to the extended attribute vector based on the recurrent neural network model; Determine a target extension keyword that matches the target extension attribute in the product knowledge graph, and generate a review of the object to be reviewed based on the target extension keyword.
3. The comment generation method according to claim 1, characterized in that: Before the step of obtaining all candidate keywords corresponding to the target attribute in the preset commodity knowledge graph, the method includes: Obtain preset historical product reviews, and extract entity objects in the historical product reviews and entity attribute information of the entity objects; The target sentiment keyword corresponding to the entity object is determined according to the historical product reviews, and a product knowledge graph is constructed according to the entity object, entity attribute information and the target sentiment keyword.
4. The comment generation method according to claim 3, characterized in that: The step of determining the target emotional keyword corresponding to the entity object according to the historical product reviews includes: Determine all sentiment keywords corresponding to the entity object according to the historical product reviews; If there are multiple emotional keywords, traverse each of the emotional keywords and calculate the left and right information entropy of the traversed emotional keywords; If the left-right information entropy is greater than a preset threshold, the point mutual information value of the traversed emotional keywords is calculated, and the score value of the traversed emotional keywords is calculated according to the left-right information entropy and the point mutual information value; Determine candidate keywords among the emotion keywords according to the score values, and use the candidate keywords as target emotion keywords.
5. The comment generation method according to any one of claims 1 to 4, characterized in that: The step of determining the input attribute vector according to the commodity text attributes and commodity image attributes of the object to be evaluated includes: The attribute vector of the commodity text attribute of the object to be evaluated and the attribute vector of the commodity image attribute of the object to be evaluated are concatenated to obtain an input attribute vector.
6. A comment generation device, characterized in that: The comment generating device comprises: A determination module, used to determine an input attribute vector according to a product text attribute and a product image attribute of an object to be evaluated; A prediction module, used to predict the target attribute corresponding to the input attribute vector based on a preset recurrent neural network model; wherein the prediction of the target attribute corresponding to the input attribute vector based on the preset recurrent neural network model includes: determining the unit latent vector corresponding to the input attribute vector according to the preset recurrent neural network model; calculating the context latent vector according to each of the unit latent vectors, and predicting the output probability value of each of the attributes according to the context latent vector, and determining the attribute corresponding to the maximum output probability value as the target attribute; A generation module is used to obtain all candidate keywords corresponding to the target attribute in a preset product knowledge graph, determine the target keyword in each of the candidate keywords, and generate a review of the object to be reviewed based on the target keyword; wherein, determining the target keyword in each of the candidate keywords includes: determining the above content corresponding to the target attribute, calculating the probability that each candidate keyword and the above content form a complete sentence, and taking the candidate keyword corresponding to the maximum probability as the target keyword.
7. A review generating device, characterized in that: The comment generation device comprises: a memory, a processor, and a comment generation program stored in the memory and executable on the processor, wherein the comment generation program implements the steps of the comment generation method according to any one of claims 1 to 5 when executed by the processor.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a review generation program, and when the review generation program is executed by a processor, the steps of the review generation method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Comment generation method and device, server and storage medium
CN110263340A
Comment generation method and device, server and storage medium
CN110287278A