Comment processing model training, comment ranking method and device, equipment and medium
By training a review processing model and using emotion recognition, feature recognition, and text classification modules to analyze product reviews, the problem of low sorting efficiency and accuracy in existing technologies is solved, achieving efficient and accurate review sorting.
Patent Information
- Application Number
- CN202210948975.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-08-09
AI Technical Summary
The current technology for sorting product reviews is inefficient and inaccurate, mainly because manual screening methods carry too much personal bias, resulting in low sorting accuracy.
By training a comment processing model, the model analyzes comment texts using a sentiment recognition module, a feature recognition module, and a text classification module, focusing on sentiment category, discrete features, and content quality, respectively. The quality of comments is determined by combining the outputs of the three modules, and the model is iteratively updated until convergence is achieved.
It improves the efficiency and accuracy of judging the quality of product reviews, and achieves efficient and accurate review sorting.
Smart Images

Figure CN115374277B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of classification models, in particular to a comment processing model training method and device, a comment sorting method and device, equipment and a medium. BACKGROUND
[0002] With the development of science and technology, more and more commodities are sold online. When users choose and purchase commodities, they often check the commodity comments of different commodities of the same type, and then filter the purchased commodities based on these commodity comments. Therefore, it is very important to effectively sort commodity comments.
[0003] In the prior art, a merchant sorts high-quality comments in front and low-quality comments in back according to personal ideas through manual screening. As a result, the sorting efficiency of commodity comments is low. Since the manual screening sorts commodity comments according to personal ideas, the sorting accuracy of commodity comments is low. SUMMARY
[0004] The present application provides a comment processing model training method and device, a comment sorting method and device, equipment and a medium to solve the problem of low sorting efficiency and low accuracy of commodity comments in the prior art.
[0005] A comment processing model training method comprises the following steps:
[0006] Obtain at least one training comment text group; one training comment text group comprises a training comment text, a training comment label, a training text feature and a training text vector;
[0007] Obtain a preset comment model comprising initial parameters; the preset comment model comprises a sentiment recognition module, a feature recognition module and a text classification module;
[0008] Input the training comment text into the sentiment recognition module to obtain a first comment value, input the training text feature into the feature recognition module to obtain a second comment value, and input the training text vector into the text classification module to obtain a third comment value;
[0009] Determine a predicted comment label corresponding to the training comment text according to the first comment value, the second comment value and the third comment value, and determine a predicted loss value of the preset comment model according to the predicted comment label and the training comment label;
[0010] When the predicted loss value does not reach a preset convergence condition, iteratively update the initial parameters in the preset comment model until the predicted loss value reaches the convergence condition, and record the preset comment model after convergence as a comment processing model.
[0011] A comment processing model training device, comprising:
[0012] a text acquisition module for acquiring at least one training comment text group; one of the training comment text groups comprises training comment text, training comment label, training text feature and training text vector;
[0013] a model acquisition module for acquiring a preset comment model comprising initial parameters; the preset comment model comprises a sentiment recognition module, a feature recognition module and a text classification module;
[0014] a text prediction module for inputting the training comment text into the sentiment recognition module to obtain a first comment value, inputting the training text feature into the feature recognition module to obtain a second comment value, and inputting the training text vector into the text classification module to obtain a third comment value;
[0015] a loss determination module for determining a predicted comment label corresponding to the training comment text according to the first comment value, the second comment value and the third comment value, and determining a predicted loss value of the preset comment model according to the predicted comment label and the training comment label;
[0016] a model update module for iteratively updating the initial parameters in the preset comment model when the predicted loss value does not reach a preset convergence condition, until the predicted loss value reaches the convergence condition, and recording the preset comment model after convergence as a comment processing model.
[0017] A comment sorting method, comprising:
[0018] receiving a comment sorting instruction; the comment sorting instruction comprises a plurality of target comment texts;
[0019] determining target text features and target text vectors corresponding to the target comment texts, and inputting the target comment texts, the target text features and the target text vectors into a comment processing model; the comment processing model is obtained according to the above comment processing model training method;
[0020] obtaining sentiment comment values corresponding to the target comment texts, feature comment values corresponding to the target text features and text comment values corresponding to the target text vectors output by the comment processing model;
[0021] determining a comment sorting value of each target comment text according to the sentiment comment value, the feature comment value and the text comment value corresponding to the same target comment text;
[0022] sorting each target comment text according to the comment sorting value to obtain a comment text sorting result.
[0023] A comment sorting device, comprising:
[0024] An instruction receiving module configured to receive a comment sorting instruction, wherein the comment sorting instruction comprises a plurality of target comment texts corresponding to a target commodity;
[0025] A text processing module configured to determine target text features and a target text vector corresponding to the target comment texts, and input the target comment texts, the target text features and the target text vector into a comment processing model; the comment processing model is obtained according to the comment processing model training method;
[0026] A comment value obtaining module configured to obtain a sentiment comment value corresponding to the target comment texts, a feature comment value corresponding to the target text features and a text comment value corresponding to the target text vector output by the comment processing model;
[0027] A comment value integrating module configured to determine a comment sorting value of a target comment text according to a sentiment comment value, a feature comment value and a text comment value corresponding to the target comment text;
[0028] A comment sorting module configured to sort each target comment text according to the comment sorting value to obtain a comment text sorting result corresponding to the target commodity.
[0029] A computer device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the comment processing model training method or the comment sorting method when executing the computer program.
[0030] A computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the comment processing model training method or the comment sorting method.
[0031] The comment processing model training method, the comment sorting method, the device and the medium set the sentiment recognition module, the feature recognition module and the phrase classification module in the preset comment model, so that the sentiment recognition module focuses on the sentiment category in the training comment text, the feature recognition module focuses on the discrete feature (i.e. the training text feature) of the training comment text, and the text classification module focuses on the content quality (i.e. the training text vector) of the training comment text. Therefore, the determination of whether the training comment text is a high-quality comment is realized based on sentiment category analysis, discrete feature analysis and content quality analysis, and the efficiency and accuracy of determining the advantages and disadvantages of the product comment are improved. Therefore, the goods comments are sorted according to the advantages and disadvantages of the goods comments, and the efficiency and accuracy of the goods comment sorting are improved. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0033] Figure 1 is an application environment schematic diagram of the comment processing model training method or the comment sorting method in an embodiment of the present application;
[0034] Figure 2 is a flowchart of the comment processing model training method in an embodiment of the present application;
[0035] Figure 3 is a flowchart of the comment sorting method in an embodiment of the present application;
[0036] Figure 4 is a principle block diagram of the comment processing model training device in an embodiment of the present application;
[0037] Figure 5 is a principle block diagram of the comment sorting device in an embodiment of the present application;
[0038] Figure 6 is a schematic diagram of a computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The technical solutions of the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0040] The comment processing model training method provided by the embodiments of the present application can be applied in the application environment as shown in Figure 1 . Specifically, the comment processing model training method is applied in a comment processing model training system, which includes a client and a server as shown in Figure 1 . The client and the server communicate through a network to solve the problem of low efficiency and low accuracy in sorting product comments in the prior art. The client, also known as the user end, is a program that provides local services for customers corresponding to the server. The client can be installed on, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers. The server can be an independent server or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0041] In an embodiment, as shown in Figure 2 , a comment processing model training method is provided. Taking the server in Figure 1 as an example, the method includes the following steps:
[0042] S10: Obtain at least one training comment text group. One of the training comment text groups includes a training comment text, a training comment label, a training text feature, and a training text vector.
[0043] As can be understood, the training comment text can be collected from different application programs. For example, the comments of different products can be collected from a shopping application program as the training comment text, or the comments of different products can be collected from a takeout application program as the training comment text. The training comment label is used to represent the comment score of the training comment text (the higher the comment score, the better the training comment text is. Conversely, the lower the comment score, the worse the training comment text is). Further, the training comment label can be a comment score range. That is, only if the score obtained by subsequent prediction of the training comment text belongs to the comment score range, the prediction is considered to be successful. Conversely, if the score obtained by subsequent prediction of the training comment text does not belong to the comment score range, the prediction is considered to be unsuccessful. The training comment label can be obtained by manual annotation in advance.
[0044] Further, the training text feature is a discrete feature of the training review text. For example, the training text feature can be the number of positive sentiment words (such as very good, multiple repurchases, or strong recommendation, etc.) contained in the training review text, the number of negative sentiment words (such as poor quality, negative review, or complaint, etc.) contained in the training review text, the number of text characters (i.e., the total number of characters contained in the training review text), and whether there is an advertising suspicion (whether the training review text contains adding WeChat, adding QQ, or searching for a public number, etc. can be determined by a regular expression). The training text vector is a vector representation of the training review text. The training text vector can be generated by performing vector conversion on the training review text by a text processing model (such as a bert model, etc.). Further, the training review label, the training text feature, and the training text vector in the same training review text group are associated with the training review text in the training review text group.
[0045] S20: Obtain a preset review model containing initial parameters; the preset review model includes an emotion recognition module, a feature recognition module, and a text classification module.
[0046] As can be understood, the preset review model is a model for predicting the comment score of the training review text. In the preset review model, the emotion recognition module, the feature recognition module, and the text classification module are set. The emotion recognition module can be constructed using a fasttext model, which is used to determine the emotion category of the training review text, such as a positive emotion category or a negative emotion category. Thus, the probability value of the training review text being a high-quality review is determined according to the emotion category, and the probability value is taken as the comment score of the training review text in the emotion category. In this embodiment, a word set containing positive sentiment words and negative sentiment words can be constructed in advance. Thus, the emotion recognition module is trained by using the word set, so that the emotion recognition module can recognize the positive sentiment words or negative sentiment words contained in the text (such as the training review text).
[0047] Further, the feature recognition module is a logistic regression module, which is used to determine whether the training review text is a high-quality review according to the training text feature, and outputs the probability value of the training review text being a high-quality review, so that the probability value is taken as the comment score of the training review text in the discrete feature. In this embodiment, the discrete features corresponding to high-quality reviews and the discrete features corresponding to low-quality reviews can be constructed in advance, so that the feature recognition module is trained by using the discrete features corresponding to high-quality reviews and the discrete features corresponding to low-quality reviews, so that the feature recognition module can distinguish whether the training text feature is a discrete feature corresponding to a high-quality review or a discrete feature corresponding to a low-quality review.
[0048] Further, the text classification module can be constructed by using a BERT model. The text classification module judges whether the training comment text is a high-quality comment from the content quality, and obtains a probability value of the training comment text being a high-quality comment, so as to take the probability value as a comment score of the training comment text from the content quality. In this embodiment, a content quality label library can be constructed in advance. The quality label library can be constructed from five aspects of commodity quality, user experience, customer service, logistics service and after-sales service by means of crawling or collecting on the Internet. The quality label library includes a high-quality content word set and a poor-quality content word set, so that the text classification module is trained according to the high-quality content word set and the poor-quality content word set. The text classification module can distinguish high-quality words and poor-quality words in the training comment text according to the training text vector.
[0049] S30: inputting the training comment text into the sentiment recognition module to obtain a first comment value, inputting the training text feature into the feature recognition module to obtain a second comment value, and inputting the training text vector into the text classification module to obtain a third comment value.
[0050] It can be understood that the first comment value represents a probability value of the sentiment recognition module determining that the training comment text is a high-quality comment from the sentiment category. The second comment value represents a probability value of the feature recognition module determining that the training comment text is a high-quality comment from the discrete feature based on the training text feature. The third comment value represents a probability value of the text classification module determining that the training comment text is a high-quality comment from the content quality based on the training text vector.
[0051] Specifically, after obtaining the preset comment model, the training comment text, the training text feature and the training text vector can be input into the preset comment model. The sentiment recognition module in the preset comment model determines the sentiment category of the training comment text, so as to determine the first comment value of the training comment text being a high-quality comment according to the sentiment category. The feature recognition module in the preset comment model determines the text feature distribution of the training text feature, so as to determine the second comment value of the training comment text corresponding to the training text feature being a high-quality comment according to the text feature distribution. The text classification module in the preset comment model determines whether the words contained in the training text vector are words corresponding to a high-quality comment, so as to output the third comment value of the training comment text corresponding to the training text vector being a high-quality comment.
[0052] S40: determining a predicted comment label corresponding to the training comment text according to the first comment value, the second comment value and the third comment value, and determining a predicted loss value of the preset comment model according to the predicted comment label and the training comment label.
[0053] It can be understood that the predicted comment label is a label representing whether the preset comment model predicts the training comment text to be a high-quality comment. The predicted comment label can be a label representing that the training comment text is a high-quality comment, or a label representing that the training comment text is not a high-quality comment. The predicted loss value represents the degree of difference between the training comment label and the predicted comment label.
[0054] Specifically, after obtaining the first comment value, the second comment value and the third comment value, the sum of the first comment value, the second comment value and the third comment value corresponding to the same training comment text is determined as the comment value sum. The comment value sum is compared with a preset comment value threshold (the preset probability value threshold can be set according to training requirements, for example, the preset comment value threshold is set to 0.7 or 0.8, etc.), and a comparison result is obtained, so as to determine the predicted comment label corresponding to the training comment text according to the comparison result. After determining the predicted comment label, the predicted loss value can be determined according to the training comment label and the predicted comment label corresponding to the same training comment text. The predicted loss value can be determined according to the training comment label and the predicted comment label by using a loss function such as a cross-entropy loss function or an absolute value loss function. Further, it is pointed out in the above description that the training comment label can be a comment score range. Further, after obtaining the predicted comment label, since the predicted comment label is a comment score representing that the training comment text is a high-quality comment. Therefore, it can be determined whether the comment score of the predicted comment label belongs to the comment score range corresponding to the training comment label. That is, only when the comment score of the predicted comment label belongs to the comment score range, it is considered that the prediction is successful. On the contrary, if the comment score of the subsequent predicted comment label does not belong to the comment score range, it is considered that the prediction fails.
[0055] The comparison result can be a result representing that the comment value sum is greater than or equal to the preset comment value threshold, or a result representing that the comment value sum is less than the preset comment value threshold. Further, when the comparison result represents that the comment value sum is greater than or equal to the preset comment value threshold, the comment score of the training comment text represented by the predicted comment label is high, that is, the probability that the training comment text is a high-quality comment is high. When the comparison result represents that the comment value sum is less than the preset comment value threshold, the comment score of the training comment text represented by the predicted comment label is low, that is, the probability that the training comment text is a high-quality comment is low.
[0056] S50: When the predicted loss value does not reach the preset convergence condition, iteratively update the initial parameters in the preset comment model until the predicted loss value reaches the convergence condition, and record the preset comment model after convergence as a comment processing model.
[0057] It can be understood that the convergence condition can be a condition that the prediction loss value is less than a set threshold, that is, when the prediction loss value is less than the set threshold, the training is stopped; the convergence condition can also be a condition that the prediction loss value is very small and cannot be further reduced after 10000 calculations, that is, when the prediction loss value is very small and cannot be reduced after 10000 calculations, the training is stopped, and the preset review model after convergence is recorded as a review processing model.
[0058] Further, after determining the prediction loss value of the preset review model according to the predicted review label and the training review label, when the prediction loss value does not reach the preset convergence condition, the initial parameters of the preset review model are adjusted according to the prediction loss value. The training review text, the training text feature and the training text vector in the training review text group of this training are re-input into the preset review model after adjusting the initial parameters, so that another training review text group is selected when the prediction loss value of the training review text group reaches the preset convergence condition, and the above steps S30 and S40 are executed to obtain the prediction loss value corresponding to the training review text group, and when the prediction loss value does not reach the preset convergence condition, the initial parameters of the preset review model are adjusted again according to the prediction loss value, so that the prediction loss value of the training review text group reaches the preset convergence condition.
[0059] In this way, after the preset review model is trained by all the training review text groups, the result output by the preset review model can be continuously close to the accurate result, so that the model recognition accuracy is higher and higher, until the prediction loss values of all the training review text groups reach the preset convergence condition, and the preset review model after convergence is recorded as a review processing model.
[0060] In the embodiment, by setting the sentiment recognition module, the feature recognition module and the phrase classification module in the preset review model, the sentiment recognition module focuses on the sentiment category in the training review text, the feature recognition module focuses on the discrete feature (i.e. the above-mentioned training text feature) of the training review text, and the text classification module focuses on the content quality (i.e. the above-mentioned training text vector) of the training review text. Thus, the judgment of whether the training review text is a high-quality review based on sentiment category analysis, discrete feature analysis and content quality analysis is realized, and the efficiency and accuracy of judging the pros and cons of the product review are improved. Thus, it is convenient to sort each product review according to the pros and cons of the product review, and the efficiency and accuracy of the product review sorting are improved.
[0061] In an embodiment, before step S10, that is, before the at least one training review text group is obtained, the method further comprises:
[0062] (1) obtaining a set of review texts; the set of review texts comprising at least one training review text; one training review text corresponding to one training review label.
[0063] It can be understood that the training review text can be collected from different applications. For example, the comments of different goods collected from a shopping application can be used as the training review text, or the comments of different goods collected from a take-out application can be used as the training review text. The training review label is used to represent the comment score of the training review text (the higher the comment score represents that the training review text is a high-quality comment. Conversely, the lower the comment score represents that the training review text is a low-quality comment). Further, the training review label can be a comment score range. That is, only if the score obtained by subsequent prediction of the training review text belongs to the comment score range, it can be considered that the prediction is successful. Conversely, if the score obtained by subsequent prediction of the training review text does not belong to the comment score range, it can be considered that the prediction fails. The training review label can be obtained by manual annotation in advance.
[0064] (2) performing feature extraction on the training review text to obtain training text features corresponding to the training review text.
[0065] It can be understood that in the above description, it is pointed out that the training text features are discrete features of the training review text. For example, the training text features can be the number of positive sentiment words (positive sentiment words can be very good, multiple repurchases, or strong recommendations, etc.), the number of negative sentiment words (negative sentiment words can be poor quality, negative comments, or complaints, etc.), the number of text characters (i.e., the total number of characters contained in the training review text), and whether there is an advertising suspicion (whether the training review text contains WeChat, QQ, or search for public numbers, etc. can be determined by regular expressions). Therefore, after collecting the training review text, the number of positive sentiment words and / or the number of negative sentiment words contained in the training review text can be determined according to the word set containing positive sentiment words and negative sentiment words constructed in advance. Each character in the training review text can also be counted to determine the total number of characters contained in the training review text. Regular expressions can also be set to query whether WeChat, QQ, or WeChat public number, etc. appears in the training review text according to the set regular expressions. Thus, the training text features corresponding to the training review text are determined.
[0066] (3) performing vector conversion on the training review text to obtain training text vectors corresponding to the training review text.
[0067] Specifically, after obtaining the training review text, the training review text can be segmented to obtain the segmented training review text. Then the segmented training review text is input into a text processing model (such as a bert model). The text processing model determines the word embedding vector, the sentence block tensor and the position encoding tensor of each segmented word in the training review text, so as to determine the training phrase vector corresponding to the training review text according to the word embedding vector, the sentence block tensor and the position encoding tensor of each segmented word in the training review text.
[0068] (4) The training review text, the training review label corresponding to the training review text, the training text feature and the training text vector are associated and recorded as a training review text group.
[0069] Specifically, after determining the training text feature and the training text vector corresponding to the training review text, the training review text, the training review label corresponding to the training review text, the training text feature and the training text vector can be associated and recorded as a training review text group. Thus, according to different training review texts, multiple different training review text groups can be obtained.
[0070] In an embodiment, in step S30, i.e., the input of the training review text into the sentiment recognition module, the first review value is obtained, including:
[0071] (1) The training review text is segmented by the sentiment recognition module to obtain at least one training review word in the training review text.
[0072] It can be understood that the training review word is a word group combined by different words in the training review text. In this embodiment, a third-party dictionary can be pre-set in the sentiment recognition module. The third-party dictionary includes a plurality of preset words, so that the sentiment recognition module can segment the training review text according to the preset words in the third-party dictionary. That is, the sentiment recognition module matches the preset words with the training review text, so as to disassemble the preset words contained in the training review text, and then obtain the training review word.
[0073] (2) Determine the review word vector corresponding to the training review word, and perform feature mapping on the review word vector corresponding to each training review word to obtain a mapping feature vector.
[0074] It can be understood that the review word vector is a vector representation corresponding to the training review word. The mapping feature vector is a vector obtained by linear transformation and mapping of the review word vector.
[0075] Specifically, after the training review text is segmented by the emotion recognition module, at least one training review word in the training review text is obtained, and then the hidden layer of the emotion recognition module is used to convert the vectors of each training review word, so as to obtain the review word vector corresponding to the training review word. Then, the linear transformation is performed on each training word vector, and the linearly transformed training word vector is mapped to the intermediate layer of the emotion recognition module. Finally, the linearly transformed training word vector is mapped by the intermediate layer to obtain the mapping feature vector.
[0076] (3) determining the first review value based on the mapping feature vector.
[0077] Specifically, after the mapping feature vector is obtained by mapping the review word vector corresponding to each training review word, the emotion recognition module can determine the probability value of the training review text belonging to the high-quality review based on the mapping feature vector, that is, the first review value. Further, it is pointed out in the above description that the emotion recognition module is trained by the word set containing positive emotional words and negative emotional words. In this way, the emotion recognition module can identify the vector representation corresponding to the positive emotional words and negative emotional words, and then can match the mapping feature vector with the vector representation corresponding to the positive emotional words and negative emotional words, so as to determine whether the training review word in the training review text is a positive emotional word or a negative emotional word. Finally, based on the result of identifying whether the training review word is a positive emotional word or a negative emotional word, the first review value is determined.
[0078] In an embodiment, in step S30, that is, the training text feature is input into the feature recognition module to obtain the second review value, including:
[0079] (1) determining the text feature distribution corresponding to the training text feature by the feature recognition module.
[0080] Specifically, after the preset review model is obtained, the training text feature is input into the feature recognition module in the preset review model. A distribution coordinate system is constructed in the feature recognition module, and a dividing line exists in the distribution coordinate system. Then, the feature recognition module is used to determine the text feature distribution corresponding to the training text feature, that is, all training text features are arranged in the distribution coordinate system. The position of the training text feature in the distribution coordinate system is the text feature distribution.
[0081] (2) determining the second review value based on the text feature distribution.
[0082] Specifically, after determining the text feature distribution corresponding to the training text feature by the feature recognition module, the second comment value can be determined based on the text feature distribution. That is, as indicated in the above description, a distribution coordinate system is pre-constructed in the feature recognition module, and there is a dividing line in the distribution coordinate system. The more training text features above and away from the dividing line, the higher the probability that the training comment text represents a high-quality comment. At this time, the second comment value can be 0.8 or 0.9. The more training text features below and away from the dividing line, the higher the probability that the training comment text represents a poor-quality comment. At this time, the second comment value can be 0.1 or 0.2. If all training text features are near the dividing line, the training comment text can represent a high-quality comment or a poor-quality comment. At this time, the second comment value can be about 0.5. In this way, the position relationship of the training text feature on the distribution coordinate system and the dividing line can be determined based on the text feature distribution, so as to obtain the second comment value.
[0083] In an embodiment, in step S30, that is, the input of the training text vector into the text classification module to obtain the third comment value, includes:
[0084] (1) The training text vector is convoluted by the convolution network layer in the text classification module to obtain a convolution feature vector.
[0085] Specifically, after obtaining the preset comment model, the training text vector is convoluted by the convolution kernel (the number and size of the convolution kernel are not limited in this embodiment) of the convolution network layer in the text classification module in the preset comment model, so as to extract the features in the training text vector and obtain the convolution feature vector.
[0086] (2) The convolution feature vector is pooled by the pooling network layer in the text classification module to obtain a pooling feature vector.
[0087] Specifically, after the training text vector is convoluted by the convolution network layer in the text classification module to obtain the convolution feature vector, the convolution feature vector is input into the pooling network layer (the pooling network layer can be an average pooling layer or a maximum pooling layer). The convolution feature vector is pooled by the pooling network layer to obtain the pooling feature vector. In this way, the feature dimension in the convolution feature vector can be reduced, and the data processing efficiency can be improved.
[0088] (3) The third comment value is determined by the full connection layer in the text classification module according to the pooling feature vector.
[0089] Specifically, after the convolution feature vector is pooled by the pooling network layer in the text classification module to obtain a pooled feature vector, the pooled feature vector is input into a full connection layer in the text classification module. The training review text is classified by the full connection layer according to the pooled feature vector, that is, the probability value that the training review text belongs to the high-quality review is determined, that is, the third review value. Further, it is pointed out in the above embodiment that the content quality label library including the high-quality content word set and the low-quality content word set is constructed in advance, so that the text classification module is trained according to the high-quality content word set and the low-quality content word set. Therefore, after the text classification module obtains the pooled feature vector, the pooled feature vector and the vectors corresponding to the words in the high-quality content word set and the low-quality content word set are matched by the full connection layer. Thus, it is determined that the words contained in the training review text are high-quality content words or low-quality content words, and the third review value is obtained.
[0090] In an embodiment, as shown in Figure 3 a review sorting method is provided, comprising:
[0091] S01: receiving a review sorting instruction; the review sorting instruction includes a plurality of target review texts.
[0092] It can be understood that the review sorting instruction can be sent directly by the user through the client, or can be automatically generated after the user uploads the target review text through the client. The target review text can be the reviews of different goods collected in a shopping application, or the reviews of different goods collected from a take-out application.
[0093] S02: determining a target text feature and a target text vector corresponding to the target review text, and inputting the target review text, the target text feature and the target text vector into a review processing model; the review processing model is obtained according to the above review processing model training method.
[0094] It can be understood that the target text feature is a discrete feature of the target review text. For example, the target text feature can be the number of positive sentiment words (positive sentiment words can be very good, multiple repurchases or strong recommendations, etc.), the number of negative sentiment words (negative sentiment words can be poor quality, negative reviews or complaints, etc.), the number of text characters (i.e. the total number of characters contained in the target review text), and whether there is an advertising suspicion (whether the target review text contains adding WeChat, adding QQ or searching for public numbers can be determined by regular expressions). The target text vector is a vector representation of the target review text. The target text vector can be generated by performing vector conversion on the target review text by a text processing model (such as a bert model).
[0095] S03: obtaining the sentiment review value corresponding to the target review text, the feature review value corresponding to the target text feature, and the text review value corresponding to the target text vector output by the review processing model.
[0096] Specifically, after determining the target text feature and the target text vector corresponding to the target review text, the target review text, the target text feature and the target text vector corresponding to the target review text are input into the review processing model. That is, the target review text is input into the sentiment recognition module in the review processing model, and the sentiment review value output by the sentiment recognition module is obtained. The target text feature is input into the feature recognition module in the review processing model, and the feature review value output by the feature recognition module is obtained. The target text vector is input into the text classification module in the review processing model, and the text review value output by the text classification module is obtained. The specific implementation process is the same as the review processing model training method in the above embodiment, which will not be described here.
[0097] S04: determining the review ranking value of the target review text according to the sentiment review value, the feature review value and the text review value corresponding to the same target review text.
[0098] It can be understood that the review ranking value is the probability value representing that the target review text is rated as a high-quality review text. That is, the higher the review ranking value, the higher the quality of the corresponding target review text. Conversely, the lower the review ranking value, the lower the quality of the corresponding target review text.
[0099] Specifically, after obtaining the sentiment review value corresponding to the target review text, the feature review value corresponding to the target text feature, and the text review value corresponding to the target text vector output by the review processing model, the review ranking value of the target review text can be determined according to the sentiment review value, the feature review value and the text review value corresponding to the same target review text. The review ranking value can be determined by the following expression:
[0100] y = w1x1 + w2x2 + w3x3
[0101] wherein y is the review ranking value; w1 is the first weight value corresponding to the sentiment review value; x1 is the sentiment review value; w2 is the second weight value corresponding to the feature review value; x2 is the feature review value. w3 is the third weight value corresponding to the text review value; x3 is the text review value. Further, the first weight value, the second weight value and the third weight value can be randomly set, and the sum of the first weight value, the second weight value and the third weight value is 1. Exemplarily, the first weight value is set to 0.3, the second weight value is set to 0.3, and the third weight value is set to 0.4.
[0102] S05: ranking each target review text according to the review ranking value to obtain a review text ranking result.
[0103] Specifically, after determining the comment ranking value of the target comment text according to the sentiment comment value, the feature comment value and the text comment value corresponding to the same target comment text, the target comment texts can be ranked in descending order of the comment ranking value to obtain a comment text ranking result. Then, all target comment texts can be ranked in the application program corresponding to the target comment text according to the comment text ranking result. In this way, the commodity comments can be ranked efficiently and accurately. Furthermore, high-quality comments can be ranked in the front, so that users can refer to high-quality comments when purchasing commodities, thereby improving the efficiency of users purchasing commodities.
[0104] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0105] In an embodiment, a comment processing model training device is provided, which corresponds to the comment processing model training method in the above embodiments. As shown in the figure, the comment processing model training device includes a text acquisition module 10, a model acquisition module 20, a text prediction module 30, a loss determination module 40 and a model update module 50. The functions of each module are described in detail as follows: Figure 4
[0106] The text acquisition module 10 is configured to acquire at least one training comment text group; one of the training comment text groups includes a training comment text, a training comment label, a training text feature and a training text vector;
[0107] The model acquisition module 20 is configured to acquire a preset comment model containing initial parameters; the preset comment model includes a sentiment recognition module, a feature recognition module and a text classification module;
[0108] The text prediction module 30 is configured to input the training comment text into the sentiment recognition module to obtain a first comment value, input the training text feature into the feature recognition module to obtain a second comment value, and input the training text vector into the text classification module to obtain a third comment value;
[0109] The loss determination module 40 is configured to determine a predicted comment label corresponding to the training comment text according to the first comment value, the second comment value and the third comment value, and determine a predicted loss value of the preset comment model according to the predicted comment label and the training comment label;
[0110] The model updating module 50 is configured to iteratively update the initial parameters in the preset review model until the predicted loss value reaches the preset convergence condition, and record the preset review model after convergence as a review processing model.
[0111] Preferably, the review processing model training apparatus further comprises:
[0112] The review text acquisition module is configured to acquire a review text set, wherein the review text set comprises at least one training review text, and one training review text corresponds to one training review label.
[0113] The feature extraction module is configured to perform feature extraction on the training review text to obtain training text features corresponding to the training review text.
[0114] The vector conversion module is configured to perform vector conversion on the training review text to obtain training text vectors corresponding to the training review text.
[0115] The data integration module is configured to record the training review text, the training review label corresponding to the training review text, the training text features, and the training text vectors as a training review text group.
[0116] Preferably, the text prediction module 30 comprises:
[0117] The word segmentation processing unit is configured to perform word segmentation processing on the training review text by using the sentiment recognition module to obtain at least one training review word in the training review text.
[0118] The feature mapping unit is configured to determine a review word vector corresponding to the training review word, and perform feature mapping on the review word vector corresponding to each training review word to obtain a mapping feature vector.
[0119] The first prediction unit is configured to determine the first review value based on the mapping feature vector.
[0120] Preferably, the text prediction module 30 further comprises:
[0121] The feature distribution determination unit is configured to determine a text feature distribution corresponding to the training text features by using the feature recognition module.
[0122] The second prediction unit is configured to determine the second review value based on the text feature distribution.
[0123] Preferably, the text prediction module 30 further comprises:
[0124] a convolution processing unit configured to perform convolution processing on the training text vector through a convolution network layer in the text classification module to obtain a convolution feature vector;
[0125] a vector pooling unit configured to perform pooling processing on the convolution feature vector through a pooling network layer in the text classification module to obtain a pooling feature vector;
[0126] a third prediction unit configured to determine the third comment value according to the pooling feature vector through a full connection layer in the text classification module.
[0127] The specific limitations of the comment processing model training apparatus can be referred to the limitations of the comment processing model training method described above, which will not be repeated here. Each module in the above comment processing model training apparatus can be realized by software, hardware, or a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0128] In an embodiment, as shown in Figure 5 a comment sorting apparatus is provided, comprising:
[0129] an instruction receiving module 01 configured to receive a comment sorting instruction; the comment sorting instruction includes a plurality of target comment texts corresponding to a target commodity;
[0130] a text processing module 02 configured to determine a target text feature and a target text vector corresponding to the target comment text, and input the target comment text, the target text feature, and the target text vector into a comment processing model; the comment processing model is obtained according to the above comment processing model training method;
[0131] a comment value obtaining module 03 configured to obtain a sentiment comment value corresponding to the target comment text, a feature comment value corresponding to the target text feature, and a text comment value corresponding to the target text vector output by the comment processing model;
[0132] a comment value integrating module 04 configured to determine a comment sorting value of the target comment text according to the sentiment comment value, the feature comment value, and the text comment value corresponding to the same target comment text;
[0133] a comment sorting module 05 configured to sort each target comment text according to the comment sorting value to obtain a comment text sorting result corresponding to the target commodity.
[0134] In an embodiment, a computer device is provided, which can be a server, and the internal structure diagram thereof can be as shown in Figure 6As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is used to store the data used by the comment processing model training method or the comment sorting method in the above embodiments. The network interface of the computer device is used to communicate with the external terminal through the network connection. The computer program is executed by the processor to implement a comment processing model training method, or the computer program is executed by the processor to implement a comment sorting method.
[0135] In one embodiment, a computer device is provided, including a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executing the computer program to implement the comment processing model training method in the above embodiments, or the processor executing the computer program to implement the comment sorting method in the above embodiments.
[0136] In one embodiment, a computer readable storage medium is provided, having a computer program stored thereon, the computer program being executed by a processor to implement the comment processing model training method in the above embodiments, or the computer program being executed by a processor to implement the comment sorting method in the above embodiments.
[0137] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0138] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the above-described functions.
[0139] The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method for training a comment processing model, characterized in that, The method comprises the following steps: obtaining at least one training review text set; one of the training review text sets comprises training review text, training review label, training text feature and training text vector; obtaining a preset review model containing initial parameters; the preset review model comprises a sentiment recognition module, a feature recognition module and a text classification module; inputting the training review text into the sentiment recognition module to obtain a first review value, inputting the training text feature into the feature recognition module to obtain a second review value, and inputting the training text vector into the text classification module to obtain a third review value; the first review value represents the probability value of the sentiment recognition module determining the training review text as a high-quality review from the perspective of sentiment category; the second review value represents the probability value of the feature recognition module determining the training review text as a high-quality review from the perspective of discrete feature based on the training text feature; and the third review value represents the probability value of the text classification module determining the training review text as a high-quality review from the perspective of content quality based on the training text vector; determining a predicted review label corresponding to the training review text according to the first review value, the second review value and the third review value, and determining a predicted loss value of the preset review model according to the predicted review label and the training review label; when the predicted loss value does not reach a preset convergence condition, iteratively updating the initial parameters in the preset review model until the predicted loss value reaches the convergence condition, and then recording the preset review model after convergence as a review processing model. 2.The comment processing model training method of claim 1, wherein, Before the step of obtaining at least one training review text set, the method further comprises the following steps: obtaining a review text set; the review text set comprises at least one training review text; one of the training review texts corresponds to one training review label; performing feature extraction on the training review text to obtain training text features corresponding to the training review text; performing vector conversion on the training review text to obtain training text vectors corresponding to the training review text; associating and recording the training review text, the training review label corresponding to the training review text, the training text features and the training text vectors as a training review text set. 3.The comment processing model training method of claim 1, wherein, The step of inputting the training review text into the sentiment recognition module to obtain a first review value comprises the following steps: performing word segmentation processing on the training review text by the sentiment recognition module to obtain at least one training review word in the training review text; determining a review word vector corresponding to the training review word, and performing feature mapping on the review word vector corresponding to each training review word to obtain a mapping feature vector; determining the first review value based on the mapping feature vector. 4.The comment processing model training method of claim 1, wherein, The step of inputting the training text feature into the feature recognition module to obtain a second review value comprises the following steps: determining a text feature distribution corresponding to the training text feature by the feature recognition module; determining the second review value based on the text feature distribution. 5.The comment processing model training method of claim 1, wherein, The step of inputting the training text vector into the text classification module to obtain a third review value comprises the following steps: The training text vector is subjected to convolution processing through a convolution network layer in the text classification module to obtain a convolution feature vector; The convolution feature vector is subjected to pooling processing through a pooling network layer in the text classification module to obtain a pooling feature vector; The third comment value is determined according to the pooling feature vector through a full connection layer in the text classification module.
6. A method of ranking reviews, the method comprising: Comprising: Receiving a comment ranking instruction; the comment ranking instruction includes a plurality of target comment texts; Determine the target text feature and the target text vector corresponding to the target comment text, and input the target comment text, the target text feature and the target text vector into the comment processing model; the comment processing model is obtained according to the comment processing model training method in any one of claims 1 to 5; Obtain the emotional comment value corresponding to the target comment text, the feature comment value corresponding to the target text feature and the text comment value corresponding to the target text vector output by the comment processing model; According to the emotional comment value, the feature comment value and the text comment value corresponding to the same target comment text, determine the comment ranking value of the target comment text; According to the comment ranking value, each target comment text is sorted to obtain a comment text ranking result. 7.A comment processing model training apparatus, characterized by comprising: Comprising: A text acquisition module is configured to acquire at least one training comment text group; One of the training comment text groups includes a training comment text, a training comment label, a training text feature and a training text vector; A model acquisition module is configured to acquire a preset comment model containing initial parameters; the preset comment model includes an emotion recognition module, a feature recognition module and a text classification module; A text prediction module is configured to input the training comment text into the emotion recognition module to obtain a first comment value, input the training text feature into the feature recognition module to obtain a second comment value, and input the training text vector into the text classification module to obtain a third comment value; the first comment value represents the probability value of the training comment text being a high-quality comment determined by the emotion recognition module from the emotion category; the second comment value represents the probability value of the training comment text being a high-quality comment determined by the feature recognition module from the discrete feature based on the training text feature; and the third comment value represents the probability value of the training comment text being a high-quality comment determined by the text classification module from the content quality based on the training text vector; A loss determination module is configured to determine a predicted comment label corresponding to the training comment text according to the first comment value, the second comment value and the third comment value, and determine a predicted loss value of the preset comment model according to the predicted comment label and the training comment label; A model updating module is configured to iteratively update the initial parameters in the preset comment model when the predicted loss value does not reach a preset convergence condition, until the predicted loss value reaches the convergence condition, and record the preset comment model after convergence as a comment processing model.
8. A comment ranking apparatus characterized by comprising: Comprising: An instruction receiving module is configured to receive a comment ranking instruction; the comment ranking instruction includes a plurality of target comment texts corresponding to a target commodity; The text processing module is configured to determine a target text feature and a target text vector corresponding to the target review text, and input the target review text, the target text feature, and the target text vector into a review processing model; the review processing model is obtained according to the review processing model training method in any one of claims 1 to 5; The review value acquisition module is configured to acquire a sentiment review value corresponding to the target review text, a feature review value corresponding to the target text feature, and a text review value corresponding to the target text vector output by the review processing model; The review value integration module is configured to determine a review ranking value of the target review text according to the sentiment review value, the feature review value, and the text review value corresponding to the same target review text; The review ranking module is configured to rank each target review text according to the review ranking value to obtain a review text ranking result corresponding to the target commodity.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the review processing model training method in any one of claims 1 to 5, or the processor executes the computer program to implement the review ranking method in claim 6.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the review processing model training method in any one of claims 1 to 5, or the computer program is executed by the processor to implement the review ranking method in claim 6.
Citation Information
Patent Citations
Method and system for analyzing user emotional tendency based on product comments
CN111695017A
Comment usefulness prediction method and device based on text and emotion polarity and medium
CN114266241A