Sentiment classification method applied to original comment text

By obtaining the platform logo in the car review text and weighting the emotion classification model, the problem of low sentiment analysis of comment texts on different platforms is solved, and the accuracy of sentiment analysis is improved.

CN119202255APending Publication Date: 2024-12-27ZHEJIANG GEELY HLDG GRP CO LTD +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411332465.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The prior art is difficult to accurately analyze the emotional polarity of automotive review texts on different platforms, resulting in low accuracy of sentiment analysis.

Method used

By obtaining the platform identifier in the original comment text, preliminary data processing and weighted processing of the emotion classification model are carried out, and emotional values ​​are output using the trained emotion classification model transformation and classification layer, considering user behavior and emotional trends of different platforms.

Benefits of technology

It improves the accuracy of sentiment analysis of comment texts, can more accurately reflect emotional tendencies on different platforms, and enhances the accuracy of emotional classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202255A_ABST
    Figure CN119202255A_ABST
Patent Text Reader

Abstract

The invention provides an emotion classification method applied to an original comment text, and relates to the technical field of deep learning. The method comprises the steps of obtaining an original comment text, obtaining a platform identifier carried in the original comment text, and performing preliminary data processing on the original comment text to obtain a to-be-input comment text; inputting a to-be-input comment text into the trained sentiment classification model, and converting the to-be-input comment text into a first vector value based on an embedded layer in the trained sentiment classification model; based on a random weighting layer in the trained sentiment classification model, according to a platform identifier carried in the original comment text, performing weighting processing on the first vector value to obtain a second vector value; and performing sentiment classification processing on the second vector value based on a classification layer in the trained sentiment classification model, and outputting a sentiment value. By adopting the technical scheme, the conditions of different platforms can be considered, and the sentiment analysis accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The disclosed embodiments relate to the field of deep learning technology, and in particular to a sentiment classification method applied to original comment text. Background Art

[0002] With the rapid development of the Internet, more and more users share their car experience and vehicle evaluation through the platform. Therefore, the sentiment polarity analysis of car reviews is becoming more and more important. For consumers, massive review data provides a reliable source of information. The more negative reviews a car model has, the lower the desire to buy it. For car manufacturers, they need to pay more attention to the polarity of the public opinion of car owners' comments. Negative public opinion data will directly lead to changes in other consumers' purchase plans.

[0003] However, there are differences in user portraits, fan stickiness, and user behaviors on different platforms, and the situation of the platform itself will affect the polarity of public opinion.

[0004] Therefore, there is an urgent need for a sentiment classification method applied to original comment texts that can take into account the situations of different platforms, thereby obtaining accurate sentiment evaluation of the comment texts and improving the accuracy of sentiment analysis. Summary of the invention

[0005] In order to solve the above technical problem or at least partially solve the above technical problem, an embodiment of the present disclosure provides a sentiment classification method applied to original comment text.

[0006] A first aspect of the embodiments of the present disclosure provides a sentiment classification method applied to an original comment text, the method comprising:

[0007] Obtaining the original comment text and the platform identifier carried in the original comment text, performing preliminary data processing on the original comment text to obtain the comment text to be input; wherein the platform identifier carried in the original comment text is used to characterize the platform from which the original comment text comes;

[0008] Input the comment text to be input into the trained sentiment classification model, and convert the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained by training multiple training comment texts in multiple preset platforms;

[0009] Based on the random weighted layer in the trained sentiment classification model, the first vector value is weighted according to the platform identifier carried in the original comment text to obtain a second vector value;

[0010] Based on the classification layer in the trained sentiment classification model, sentiment classification processing is performed on the second vector value, and a sentiment value is output; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text.

[0011] In one example, the random weighted layer in the trained sentiment classification model performs weighted processing on the first vector value according to the platform identifier carried in the original comment text to obtain the second vector value, including:

[0012] Based on the random weighted layer in the trained sentiment classification model, obtaining the platform identifier carried in the original comment text;

[0013] Based on the random weighted layer in the trained sentiment classification model, and according to the platform identifier, obtaining a weight value and a bias value corresponding to the platform identifier;

[0014] Based on the random weighted layer in the trained sentiment classification model, the first vector value is weighted according to the weight value and the bias value to obtain the second vector value.

[0015] In one example, the step of performing weighted processing on the first vector value based on the random weighted layer in the trained sentiment classification model according to the weight value and the bias value to obtain the second vector value includes:

[0016] Based on the random weighted layer in the trained sentiment classification model, calculating the product value of the first vector value and the weight value to obtain a third vector value;

[0017] Based on the randomly weighted layer in the trained sentiment classification model, a sum of the third vector value and the bias value is calculated to obtain the second vector value.

[0018] In one example, the initial data processing of the original comment text to obtain the comment text to be input includes:

[0019] Acquire the original review text, and identify attribute information in the original review text; wherein the number of the attribute information is at least one;

[0020] The information entropy value of the attribute information is calculated. If the information entropy value is less than a first threshold, the attribute information is deleted to obtain the comment text to be input.

[0021] In one example, the initial data processing of the original comment text to obtain the comment text to be input includes:

[0022] Acquire the original review text, and identify attribute information in the original review text; wherein the number of the attribute information is at least one;

[0023] The null value ratio of the attribute information is calculated. If the null value ratio is greater than a second threshold, the attribute information is deleted to obtain the comment text to be input.

[0024] In one example, performing sentiment classification processing on the second vector value based on the classification layer in the trained sentiment classification model and outputting the sentiment value includes:

[0025] Based on the classification layer in the trained sentiment classification model, the second vector value is combined with the memory unit of the previous time step, sentiment classification processing is performed on the second vector value, and a sentiment value is output.

[0026] A second aspect of the disclosed embodiments provides a method for training an original sentiment classification model, which is applied to sentiment classification of original comment texts. The method includes:

[0027] Acquire multiple training review texts from multiple preset platforms, perform sentiment labeling on each of the training review texts based on a local sentiment dictionary, and obtain a label data set; wherein the label data set represents the training review texts and the sentiment values ​​carried by the training review texts; wherein the sentiment values ​​are used to represent the sentiment tendency of the training review texts;

[0028] The label data set is input into the original sentiment classification model, and the original sentiment classification model is trained to obtain a trained sentiment classification model; wherein the trained sentiment classification model is used to determine the sentiment tendency of the original comment text; and the original comment text is obtained from a preset platform.

[0029] A third aspect of the embodiments of the present disclosure provides a sentiment classification device applied to an original comment text, the device comprising:

[0030] The first acquisition module is used to acquire the original comment text and the platform identifier carried in the original comment text, and perform preliminary data processing on the original comment text to obtain the comment text to be input; wherein the platform identifier carried in the original comment text is used to represent the platform from which the original comment text comes;

[0031] An input module, used for inputting the comment text to be input into the trained sentiment classification model, and converting the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained by training multiple training comment texts in multiple preset platforms;

[0032] A processing module, configured to perform weighted processing on the first vector value based on the random weighted layer in the trained sentiment classification model and according to the platform identifier carried in the original comment text to obtain a second vector value;

[0033] The output module is used to perform sentiment classification processing on the second vector value based on the classification layer in the trained sentiment classification model, and output a sentiment value; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text.

[0034] A fourth aspect of the embodiments of the present disclosure provides a training device for an original sentiment classification model, which is applied to sentiment classification of original comment texts. The device includes:

[0035] The second acquisition module is used to acquire multiple training review texts from multiple preset platforms, and perform sentiment labeling on each of the training review texts based on a local sentiment dictionary to obtain a label data set; wherein the label data set represents the training review texts and the sentiment values ​​carried by the training review texts; wherein the sentiment values ​​are used to represent the sentiment tendency of the training review texts;

[0036] A training module is used to input the label data set into the original sentiment classification model, train the original sentiment classification model, and obtain a trained sentiment classification model; wherein the trained sentiment classification model is used to determine the sentiment tendency of the original comment text; the original comment text is obtained from a preset platform.

[0037] A fifth aspect of an embodiment of the present disclosure provides an electronic device, which includes: a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the method of the first aspect or the second aspect above.

[0038] A sixth aspect of an embodiment of the present disclosure provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of the first aspect or the second aspect described above can be implemented.

[0039] The disclosed embodiment provides a sentiment classification method applied to original comment text, the method comprising: obtaining the original comment text, obtaining the platform identifier carried in the original comment text, performing preliminary data processing on the original comment text to obtain the comment text to be input; wherein the platform identifier carried in the original comment text is used to characterize the platform from which the original comment text comes; inputting the comment text to be input into the trained sentiment classification model, converting the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained after training with multiple training comment texts in multiple preset platforms; based on the random weighting layer in the trained sentiment classification model, weighting the first vector value according to the platform identifier carried in the original comment text to obtain a second vector value; based on the classification layer in the trained sentiment classification model, sentiment classification processing is performed on the second vector value, and a sentiment value is output; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text. By adopting the technical solution, the situation of different platforms can be taken into account, and accurate sentiment evaluation of the comment text can be obtained, thereby improving the accuracy of sentiment analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1 It is a flowchart of a sentiment classification method applied to original comment text provided by an embodiment of the present disclosure;

[0043] Figure 2 is a structural diagram of a trained sentiment classification model provided by an embodiment of the present disclosure;

[0044] Figure 3 It is a flowchart of a sentiment classification method applied to original comment text provided by an embodiment of the present disclosure;

[0045] Figure 4 It is a flowchart of a training method of an original sentiment classification model provided by an embodiment of the present disclosure;

[0046] Figure 5is a structural schematic diagram of a sentiment classification device applied to original comment text provided by an embodiment of the present disclosure;

[0047] Figure 6 It is a structural schematic diagram of a training device for an original sentiment classification model provided by an embodiment of the present disclosure;

[0048] Figure 7 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0049] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0050] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0051] Figure 1 1 is a flow chart of a sentiment classification method for original comment text provided by an embodiment of the present disclosure, which can be performed by an electronic device. The electronic device can be exemplarily understood as a device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, etc. Figure 1 As shown, the method provided in this embodiment includes the following steps:

[0052] S101, obtaining the original comment text, and obtaining the platform identifier carried in the original comment text, performing preliminary data processing on the original comment text, and obtaining the comment text to be input; wherein the platform identifier carried in the original comment text is used to represent the platform from which the original comment text comes.

[0053] In one example, the original comment text is obtained from any one of the multiple preset platforms. For example, the multiple preset platforms may be 6 preset platforms. Specifically, they may be platform A, platform B, platform C, platform D, platform E, and platform F. If the original comment text is obtained from platform A, the platform identifier of the original comment text is a.

[0054] In this embodiment, after obtaining the original comment text, the original comment text needs to be cleaned. Specifically, the original comment text can be preliminarily processed to remove data that does not meet the requirements and obtain the comment text to be input.

[0055] S102, inputting the comment text to be input into the trained sentiment classification model, and converting the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained after training with multiple training comment texts in multiple preset platforms.

[0056] In one example, see Figure 2 A schematic diagram of the structure of a trained sentiment classification model is shown. Specifically, the comment text to be input is input into the trained sentiment classification model, and the dimension of the comment text to be input is reduced through the embedding layer to obtain a first vector value. In order to explain it more clearly, the first vector value can be recorded as xn, where n represents the platform identifier. For example, xa represents the first vector value after the original comment text A is obtained from platform A and processed by the embedding layer. xb represents the first vector value after the original comment text B is obtained from platform B and processed by the embedding layer.

[0057] In one example, the trained sentiment classification model is obtained by training multiple training review texts in multiple preset platforms. Specifically, multiple training review texts can be obtained from each preset platform.

[0058] S103. Based on the random weighted layer in the trained sentiment classification model, the first vector value is weighted according to the platform identifier carried in the original comment text to obtain a second vector value.

[0059] In one example, the random weighting layer in the trained sentiment classification model is used to perform different weightings on the first vector values ​​of different platforms. The second vector value can be represented by yn. For example, n represents platform A, the first vector value is xa, and the second vector value is ya.

[0060] S104. Based on the classification layer in the trained sentiment classification model, sentiment classification processing is performed on the second vector value, and a sentiment value is output; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text.

[0061] In one example, sentiment values ​​can be divided into three types: positive value, negative value, and neutral value. Among them, the positive value represents a positive meaning, the negative value represents a negative meaning, and the neutral value represents neither positive nor negative meaning.

[0062] In one example, based on the classification layer in the trained sentiment classification model, sentiment classification processing is performed on the second vector value, and the sentiment value is output, including:

[0063] Based on the classification layer in the trained sentiment classification model, the second vector value is combined with the memory unit of the previous time step, sentiment classification processing is performed on the second vector value, and the sentiment value is output.

[0064] In one example, the classification layer in the trained sentiment classification model can be obtained based on the vLSTM algorithm. Specifically, when calculating the forget gate parameter f t , output gate parameter o t When considering the hidden state h of the previous time step t-1 and the input of the current time step, which is the second vector value yn, and the memory unit C of the previous time step is added t-1 The details are as follows:

[0065] f t =σ(W f *[C t-1 ,h t-1 ,yn] + b f );

[0066] ο t =σ(W o *[C t-1 ,h t-1 ,yn]+b o );

[0067]

[0068] h t =ο t *tanh(C t );

[0069] y t =σ(W'*h t +b y );

[0070] Among them, f t is the forget gate parameter at time step t, o t is the output gate parameter at time step t, is the candidate memory unit at time step t, C t is the memory unit at time step t, yn is the second vector value, that is, the input at time step t, h t is the hidden state at time step t, y t is the output at time step t, w f 、b f 、w o 、b o 、w c 、b c , w′ is the model trainable parameter, and the calculation formulas of σ and tanh are as follows:

[0071]

[0072] In this embodiment, y t It represents the sentiment value.

[0073] The disclosed embodiment provides a sentiment classification method applied to original comment text, the method comprising: obtaining the original comment text, obtaining the platform identifier carried in the original comment text, performing preliminary data processing on the original comment text, and obtaining the comment text to be input; wherein the platform identifier carried in the original comment text is used to characterize the platform from which the original comment text comes; inputting the comment text to be input into the trained sentiment classification model, and converting the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained after training multiple training comment texts in multiple preset platforms; based on the random weighting layer in the trained sentiment classification model, weighting the first vector value according to the platform identifier carried in the original comment text to obtain a second vector value; based on the classification layer in the trained sentiment classification model, sentiment classification processing is performed on the second vector value, and a sentiment value is output; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text. By adopting the technical solution, the situation of different platforms can be taken into consideration, and then accurate sentiment evaluation of the comment text can be obtained, thereby improving the accuracy of sentiment analysis.

[0074] Figure 3 The flowchart of a sentiment classification method applied to original comment text provided by the embodiment of the present disclosure is shown. The embodiment of the present disclosure is optimized on the basis of the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.

[0075] like Figure 3 As shown, the sentiment classification method applied to the original comment text may include the following steps:

[0076] S301, obtaining the original comment text, and obtaining the platform identifier carried in the original comment text, performing preliminary data processing on the original comment text, and obtaining the comment text to be input; wherein the platform identifier carried in the original comment text is used to represent the platform from which the original comment text comes.

[0077] In one example, the original comment text is subjected to preliminary data processing to obtain the comment text to be input, including:

[0078] Acquire the original review text, and identify attribute information in the original review text; wherein the number of attribute information is at least one;

[0079] The information entropy value of the attribute information is calculated. If the information entropy value is less than a first threshold, the attribute information is deleted to obtain the comment text to be input.

[0080] The attribute information in the original comment text may be platform identification, forum name, user nickname, whether it is a major public opinion description, major public opinion keywords, page views, posting time, title, brand name, city, car series name, market segment name, post content, page URL, and whether it is a water army description. The form of this attribute information can be seen in Table 1 below:

[0081] Table 1 Attribute information in the original review text

[0082]

[0083] In this embodiment, the information entropy value can be determined by the following formula:

[0084]

[0085] Where: p xi Denotes random event X as x i The probability of calculating the information entropy value H(X) of each attribute information. Taking "whether it is a major public opinion description" as an example, calculate the information entropy value of this attribute information: i Represents the probability that the random event X is ["yes", "no"]. Where: x i The probability of "yes" x i The probability of "no" The information entropy value of this column is 0.0193. The first threshold is 2.0, so the attribute information is deleted. The advantage of this setting is that the information entropy value represents the amount of information contained. The larger the amount of information, the greater the possibility of valid information. Through this step, dirty data can be effectively removed and the original comment text can be optimized.

[0086] In one example, the original comment text is subjected to preliminary data processing to obtain the comment text to be input, including:

[0087] Acquire the original review text, and identify attribute information in the original review text; wherein the number of attribute information is at least one;

[0088] The null value ratio of the attribute information is calculated. If the null value ratio is greater than a second threshold, the attribute information is deleted to obtain the comment text to be input.

[0089] In one example, the second threshold may be 50%. If the null value ratio of the attribute information is greater than 50%, it is useless data, and the attribute information is deleted to obtain the comment text to be input.

[0090] S302, inputting the comment text to be input into the trained sentiment classification model, and converting the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained by training multiple training comment texts in multiple preset platforms.

[0091] In an example, this step may refer to the content of step S102.

[0092] S303. Based on the randomly weighted layer in the trained sentiment classification model, the platform identifier carried in the original comment text is obtained.

[0093] In an example, this step may refer to the content of step S103.

[0094] S304: Based on the randomly weighted layer in the trained sentiment classification model, and according to the platform identifier, obtain a weight value and a bias value corresponding to the platform identifier.

[0095] In one example, each platform corresponds to a different weight value and bias value. For illustration, the weight value is set to wn and the bias value is set to bn. For example, if the platform is identified as a, the weight value is wa and the bias value is ba. The advantage of this setting is that the potential relationship between the original comment texts of different platforms can be learned.

[0096] S305 . Based on the random weighted layer in the trained sentiment classification model, weighted processing is performed on the first vector value according to the weight value and the bias value to obtain a second vector value.

[0097] In one example, based on a random weighted layer in a trained sentiment classification model, a first vector value is weighted according to a weight value and a bias value to obtain a second vector value, including:

[0098] Based on the random weighted layer in the trained sentiment classification model, a product value of the first vector value and the weight value is calculated to obtain a third vector value;

[0099] Based on the randomly weighted layer in the trained sentiment classification model, the sum of the third vector value and the bias value is calculated to obtain the second vector value.

[0100] In one example, the second vector value may be determined by the following formula:

[0101] yn=xn*wn+bn;

[0102] Among them, the weight value is wn, the bias value is bn, xn*wn is the third vector value; yn is the second vector value, and the first vector value is xn. In this embodiment, the size of the matrix of xn is [batch, seq, d], batch is the set batch size, seq is the sentence length, and d is the size after dimensionality reduction.

[0103] S306. Based on the classification layer in the trained sentiment classification model, sentiment classification processing is performed on the second vector value, and a sentiment value is output; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text.

[0104] In an example, this step may refer to the content of step S104.

[0105] The disclosed embodiment provides a sentiment classification method applied to original comment text, the method comprising: based on the random weighted layer in the trained sentiment classification model, according to the platform identifier, obtaining the weight value and bias value corresponding to the platform identifier, based on the random weighted layer in the trained sentiment classification model, according to the weight value and bias value, weighting the first vector value to obtain the second vector value. By adopting this technical solution, the differences in user stickiness, comment sentiment trends, and user behavior habits of different platforms can be taken into account, and the potential relationship between comment data of different platforms can be learned, thereby outputting a more accurate sentiment value.

[0106] Figure 4 1 is a flow chart of a training method of an original sentiment classification model provided by an embodiment of the present disclosure, which method can be performed by an electronic device. Applied to sentiment classification of original comment text, the electronic device can be exemplarily understood as a device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, etc. Figure 4 As shown, the method provided in this embodiment includes the following steps:

[0107] S401. Acquire multiple training comment texts from multiple preset platforms, perform sentiment labeling on each training comment text based on a local sentiment dictionary, and obtain a label data set; wherein the label data set represents the training comment text and the sentiment value carried by the training comment text; wherein the sentiment value is used to represent the sentiment tendency of the training comment text.

[0108] In an example, the preset platforms may be platform A, platform B, platform C, platform D, platform E, and platform F. Multiple training review texts are obtained from each platform, and the multiple training review texts are processed with sentiment labels through the local sentiment dictionary to obtain a label data set. Specifically, punctuation marks may be removed from the training review text, and regular expressions may be used to remove non-numeric and Chinese character elements. The training review text may then be segmented and attribute information may be merged. Specifically, the word segmentation process is as follows: the jieba library is used for word segmentation. Considering that the car name is a proper noun, in order to avoid incorrect segmentation by the word segmenter, the car name is added to the local sentiment dictionary and then segmented.

[0109] To perform sentiment labeling on each training comment text based on the local sentiment dictionary, the sentiment value list of each clause in the training comment text can be calculated first, such as [5,1.5].

[0110] Score each clause. First, find the sentiment word in the clause and record its position. Find the degree word before the sentiment word and calculate it weightedly based on the degree word score and sentiment value. Find all negative words before the sentiment word. If the number is odd, multiply by -1. If it is even, multiply by 1. Find "!" and "?". If the end of the clause contains "," and "!", the positive value is +3. If it contains "?", the corresponding negative value is +3.

[0111] The sentiment value of the whole sentence can be obtained by adding up the sentiment values ​​of each clause. The rules for sentiment label processing are as follows:

[0112]

[0113] In the formula, positive represents the positive value of the training comment text, negative represents the negative value of the training comment text, 1 represents a positive value, 0 represents a neutral value, and -1 represents a negative value. The sentiment value is obtained based on the local sentiment dictionary, and then manually proofread to finally obtain a labeled data set.

[0114] S402, inputting the label data set into the original sentiment classification model, training the original sentiment classification model, and obtaining a trained sentiment classification model; wherein the trained sentiment classification model is used to determine the sentiment tendency of the original comment text; the original comment text is obtained from a preset platform.

[0115] In one example, 80% of the labeled data set can be input into the original sentiment classification model to train the original sentiment classification model to obtain a trained sentiment classification model; wherein, 80% of the labeled data set can be input in batches, specifically, the model batch size batch_size can be set to 64, the parameter drop_last=True for deleting indivisible batches, and the parameter shuffle=True for shuffling the data.

[0116] When training the original sentiment classification model, in order to avoid overfitting the neural network structure, you can add a batch layer BatchNorm and a temporary dropout layer Dropout. The model loss function is the crossentropy function, the optimizer is Adam, the learning rate is set to 3e-3, the initial training generation is set to 100 generations, and the loss value threshold is set to 0.01. It must be less than this value to consider the model valid. If the training set loss is still greater than this value after 100 generations of training, continue to increase the training generation until the loss is less than this value.

[0117] In this embodiment, after obtaining the trained sentiment classification model, 20% of the label data set can be used to evaluate the trained sentiment classification model, and the rules are as follows:

[0118] if accuracy train >80%, then:

[0119]

[0120] Where: accuracy train Indicates the accuracy of 80% labeled dataset, accuracy test Indicates the accuracy of 20% labeled dataset. train and accuracy test The difference ratio can be used to judge the training status of the trained sentiment classification model. The trained sentiment classification model can be divided into three categories: "model overfitting", "model training is good", and "model training is excellent". Among them, if the trained sentiment classification model is of the "model overfitting" type, it cannot be used to determine the sentiment tendency of the original comment text and needs to be retrained.

[0121] The disclosed embodiment provides a method for training an original sentiment classification model, the method comprising: obtaining multiple training comment texts from multiple preset platforms, processing each training comment text with sentiment labels based on a local sentiment dictionary, and obtaining a label data set; inputting the label data set into the original sentiment classification model, training the original sentiment classification model, and obtaining a trained sentiment classification model. By adopting this technical solution, adding a memory unit to participate in the calculation when calculating the parameters of the gate unit can improve the accuracy of the model, and by evaluating the accuracy of the trained sentiment classification model, the accuracy of determining the sentiment tendency of the original comment text can be improved.

[0122] Figure 51 is a schematic diagram of a structure of a sentiment classification device applied to original comment text provided by an embodiment of the present disclosure. The sentiment classification device applied to original comment text can be understood as the above electronic device or a part of the functional modules in the above electronic device. Figure 5 As shown, the sentiment classification device 50 applied to the original comment text includes:

[0123] The first acquisition module 501 is used to acquire the original comment text and the platform identifier carried in the original comment text, and perform preliminary data processing on the original comment text to obtain the comment text to be input; wherein the platform identifier carried in the original comment text is used to represent the platform from which the original comment text comes;

[0124] An input module 502 is used to input the comment text to be input into the trained sentiment classification model, and convert the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained by training multiple training comment texts in multiple preset platforms;

[0125] The processing module 503 is used to perform weighted processing on the first vector value based on the random weighted layer in the trained sentiment classification model and the platform identifier carried in the original comment text to obtain a second vector value;

[0126] The output module 504 is used to perform sentiment classification processing on the second vector value based on the classification layer in the trained sentiment classification model, and output a sentiment value; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text.

[0127] In one example, the processing module 503 is specifically configured to:

[0128] Based on the random weighted layer in the trained sentiment classification model, the platform logo carried in the original comment text is obtained;

[0129] Based on the random weighted layer in the trained sentiment classification model, the weight value and bias value corresponding to the platform identifier are obtained according to the platform identifier;

[0130] Based on the random weighted layer in the trained sentiment classification model, the first vector value is weighted according to the weight value and the bias value to obtain the second vector value.

[0131] In one example, the processing module 503 is specifically configured to:

[0132] Based on the random weighted layer in the trained sentiment classification model, a product value of the first vector value and the weight value is calculated to obtain a third vector value;

[0133] Based on the randomly weighted layer in the trained sentiment classification model, the sum of the third vector value and the bias value is calculated to obtain the second vector value.

[0134] In one example, the first acquisition module 501 is specifically configured to:

[0135] Acquire the original review text, and identify attribute information in the original review text; wherein the number of attribute information is at least one;

[0136] The information entropy value of the attribute information is calculated. If the information entropy value is less than a first threshold, the attribute information is deleted to obtain the comment text to be input.

[0137] In one example, the first acquisition module 501 is specifically configured to:

[0138] Acquire the original review text, and identify attribute information in the original review text; wherein the number of attribute information is at least one;

[0139] The null value ratio of the attribute information is calculated. If the null value ratio is greater than a second threshold, the attribute information is deleted to obtain the comment text to be input.

[0140] The output module 504 is used to combine the second vector value with the memory unit of the previous time step based on the classification layer in the trained sentiment classification model, perform sentiment classification processing on the second vector value, and output the sentiment value.

[0141] The device provided in this embodiment can execute the method of any of the above embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.

[0142] Figure 6 is a schematic diagram of the structure of an original emotion classification model training device provided by an embodiment of the present disclosure. The original emotion classification model training device can be understood as the above electronic device or a part of the functional modules in the above electronic device. Figure 6 As shown, the training device 60 of the original sentiment classification model includes:

[0143] The second acquisition module 601 is used to obtain multiple training comment texts from multiple preset platforms, and perform sentiment labeling on each training comment text based on a local sentiment dictionary to obtain a label data set; wherein the label data set represents the training comment text and the sentiment value carried by the training comment text; wherein the sentiment value is used to represent the sentiment tendency of the training comment text.

[0144] The training module 602 is used to input the label data set into the original sentiment classification model, train the original sentiment classification model, and obtain a trained sentiment classification model; wherein the trained sentiment classification model is used to determine the sentiment tendency of the original comment text; the original comment text is obtained from a preset platform.

[0145] The device provided in this embodiment can execute the method of any of the above embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.

[0146] An embodiment of the present disclosure further provides an electronic device, which includes: a memory, in which a computer program is stored; and a processor, which is used to execute the computer program. When the computer program is executed by the processor, the method of any of the above embodiments can be implemented.

[0147] For example, Figure 7 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 7 , which shows a schematic diagram of the structure of an electronic device 1000 suitable for implementing the embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0148] like Figure 7 As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0149] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0150] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 1009, or installed from a storage device 1008, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0151] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0152] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0153] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0154] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains the original comment text, and obtains the platform identifier carried in the original comment text, performs preliminary data processing on the original comment text, and obtains the comment text to be input; wherein, the platform identifier carried in the original comment text is used to characterize the platform from which the original comment text comes; inputs the comment text to be input into the trained sentiment classification model, and converts the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein, the trained sentiment classification model is obtained after training with multiple training comment texts in multiple preset platforms; based on the random weighting layer in the trained sentiment classification model, the first vector value is weighted according to the platform identifier carried in the original comment text to obtain a second vector value; based on the classification layer in the trained sentiment classification model, the second vector value is sentimentally classified and outputted; wherein, the sentiment value is used to characterize the sentiment tendency of the original comment text.

[0155] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0156] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0157] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0158] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0159] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0160] The embodiments of the present disclosure also provide a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any of the above embodiments can be implemented. The execution method and beneficial effects are similar and will not be repeated here.

[0161] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device 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 device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0162] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A sentiment classification method applied to original comment text, characterized in that: The method comprises: Obtaining the original comment text and the platform identifier carried in the original comment text, performing preliminary data processing on the original comment text to obtain the comment text to be input; wherein the platform identifier carried in the original comment text is used to characterize the platform from which the original comment text comes; Input the comment text to be input into the trained sentiment classification model, and convert the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained by training multiple training comment texts in multiple preset platforms; Based on the random weighted layer in the trained sentiment classification model, the first vector value is weighted according to the platform identifier carried in the original comment text to obtain a second vector value; Based on the classification layer in the trained sentiment classification model, sentiment classification processing is performed on the second vector value, and a sentiment value is output; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text.

2. The method according to claim 1, characterized in that The step of performing weighted processing on the first vector value based on the random weighted layer in the trained sentiment classification model according to the platform identifier carried in the original comment text to obtain the second vector value includes: Based on the random weighted layer in the trained sentiment classification model, obtaining the platform identifier carried in the original comment text; Based on the random weighted layer in the trained sentiment classification model, and according to the platform identifier, obtaining a weight value and a bias value corresponding to the platform identifier; Based on the random weighted layer in the trained sentiment classification model, the first vector value is weighted according to the weight value and the bias value to obtain the second vector value.

3. The method according to claim 2, characterized in that The step of performing weighted processing on the first vector value based on the random weighted layer in the trained sentiment classification model according to the weight value and the bias value to obtain the second vector value includes: Based on the random weighted layer in the trained sentiment classification model, calculating the product value of the first vector value and the weight value to obtain a third vector value; Based on the randomly weighted layer in the trained sentiment classification model, a sum of the third vector value and the bias value is calculated to obtain the second vector value.

4. The method according to claim 1, characterized in that: The initial data processing of the original comment text to obtain the comment text to be input includes: Acquire the original review text, and identify attribute information in the original review text; wherein the number of the attribute information is at least one; The information entropy value of the attribute information is calculated. If the information entropy value is less than a first threshold, the attribute information is deleted to obtain the comment text to be input.

5. The method according to claim 1 or 4, characterized in that: The initial data processing of the original comment text to obtain the comment text to be input includes: Acquire the original review text, and identify attribute information in the original review text; wherein the number of the attribute information is at least one; The null value ratio of the attribute information is calculated. If the null value ratio is greater than a second threshold, the attribute information is deleted to obtain the comment text to be input.

6. The method according to claim 1, characterized in that The performing sentiment classification processing on the second vector value based on the classification layer in the trained sentiment classification model and outputting the sentiment value comprises: Based on the classification layer in the trained sentiment classification model, the second vector value is combined with the memory unit of the previous time step, sentiment classification processing is performed on the second vector value, and a sentiment value is output.

7. A training method for an original sentiment classification model, characterized in that: Applied to sentiment classification of original review text, the method comprises: Acquire multiple training review texts from multiple preset platforms, perform sentiment labeling on each of the training review texts based on a local sentiment dictionary, and obtain a label data set; wherein the label data set represents the training review texts and the sentiment values ​​carried by the training review texts; wherein the sentiment values ​​are used to represent the sentiment tendency of the training review texts; The label data set is input into the original sentiment classification model, and the original sentiment classification model is trained to obtain a trained sentiment classification model; wherein the trained sentiment classification model is used to determine the sentiment tendency of the original comment text; and the original comment text is obtained from a preset platform.

8. A sentiment classification device applied to original comment text, characterized in that: The device comprises: The first acquisition module is used to acquire the original comment text and the platform identifier carried in the original comment text, and perform preliminary data processing on the original comment text to obtain the comment text to be input; wherein the platform identifier carried in the original comment text is used to represent the platform from which the original comment text comes; An input module, used for inputting the comment text to be input into the trained sentiment classification model, and converting the comment text to be input into a first vector value based on the embedding layer in the trained sentiment classification model; wherein the trained sentiment classification model is obtained by training multiple training comment texts in multiple preset platforms; A processing module, configured to perform weighted processing on the first vector value based on the random weighted layer in the trained sentiment classification model and according to the platform identifier carried in the original comment text to obtain a second vector value; The output module is used to perform sentiment classification processing on the second vector value based on the classification layer in the trained sentiment classification model, and output a sentiment value; wherein the sentiment value is used to characterize the sentiment tendency of the original comment text.

9. A training device for an original sentiment classification model, characterized in that: Applied to sentiment classification of original comment text, the device comprises: The second acquisition module is used to acquire multiple training review texts from multiple preset platforms, and perform sentiment labeling on each of the training review texts based on a local sentiment dictionary to obtain a label data set; wherein the label data set represents the training review texts and the sentiment values ​​carried by the training review texts; wherein the sentiment values ​​are used to represent the sentiment tendency of the training review texts; A training module is used to input the label data set into the original sentiment classification model, train the original sentiment classification model, and obtain a trained sentiment classification model; wherein the trained sentiment classification model is used to determine the sentiment tendency of the original comment text; the original comment text is obtained from a preset platform.

10. An electronic device, characterized in that: include: A processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the method according to any one of claims 1 to 6 or the method according to claim 7.

Citation Information

Patent Citations

  • A distinguishing method and device for real user comments

    CN109933648A

  • Fine-grained emotion analysis method and device, computer equipment and storage medium

    CN110516245A

  • Aspect-level sentiment analysis method adopting bidirectional long-short-term memory network

    CN112434161A

  • Multi-source cross-domain emotion classification method and system, medium and equipment

    CN113343673A

  • Network viewpoint data early warning method and device and medium

    CN118245659A