A bad review classification method, device and equipment based on a bert model and a medium
By using a BERT-based negative feedback classification method, the problem of inaccurate extraction of negative feedback topics from customer review information in existing technologies is solved, enabling accurate identification of customer dissatisfaction levels and improvement of service quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA PETROLEUM & CHEMICAL CORP
- Filing Date
- 2022-12-29
- Publication Date
- 2026-06-02
AI Technical Summary
Existing short text classification technologies struggle to accurately extract negative review topics from customer feedback information, resulting in poor service quality improvement.
We adopted a negative review classification method based on the BERT model. Through data integration, cleaning, sentiment annotation, model fine-tuning and topic extraction, we removed positive sentiment data and used Jieba word segmentation and word pair topic model to extract negative review topics.
It enables the extraction of a wide range of thematic content from customer feedback information, improving gas station service quality and customer satisfaction. It can accurately identify the degree of customer dissatisfaction and guide service improvement and employee training.
Smart Images

Figure CN116483994B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data technology, and in particular to a difference classification method, apparatus, electronic device, and computer-readable storage medium based on the BERT model. Background Technology
[0002] With the development of big data technology, data analysis and machine learning can be used to mine the value of data and extract useful information from high-quality data. For example, to obtain genuine customer feedback and needs, it is necessary to extract effective evaluation data from customer review information. However, to understand customers' true needs and improve service quality, it is necessary to extract negative review topics from customer review information to grasp the degree of customer dissatisfaction.
[0003] Existing short text classification technologies mainly focus on sentiment classification and topic-specific extraction, typically implemented in isolation. They either perform sentiment classification or topic-specific extraction based on predefined themes. In practical applications, some previously unknown information may need to be classified. Relying solely on known themes can lead to overly simplistic thematic classification, resulting in lower accuracy when negatively categorizing users. Summary of the Invention
[0004] To address the aforementioned problems, embodiments of the present invention provide a difference classification method, apparatus, electronic device, and computer-readable storage medium based on the BERT model.
[0005] In a first aspect, embodiments of the present invention provide a difference classification method based on the BERT model, including:
[0006] The preset evaluation information is integrated and cleaned to obtain effective evaluation data. The effective evaluation data is then labeled with sentiment to obtain evaluation labeled data.
[0007] The pre-trained BERT sentiment classification model is trained using the aforementioned evaluation and annotation data to obtain the first fine-tuned BERT sentiment classification model;
[0008] The first fine-tuned BERT sentiment classification model is used to classify the preset first data to be evaluated to obtain the first classification evaluation data, and the classification error data in the first classification evaluation data is extracted.
[0009] Add data labels to the misclassified data to obtain classification label data, and use the classification label data and the evaluation label data to train the pre-trained BERT sentiment classification model to obtain a second fine-tuned BERT sentiment classification model;
[0010] The second fine-tuned BERT sentiment classification model is used to classify the preset second data to be evaluated into sentiment data, and the positive sentiment data in the second category evaluation data is removed to obtain the negative sentiment data.
[0011] The negative sentiment data is segmented using a preset Jieba segmentation mode to obtain negative segmented data. A pre-built word pair topic model is used to extract topics from the negative segmented data to obtain negative review topics. The preset evaluation information is then classified into negative categories based on the negative review topics.
[0012] According to an embodiment of the present invention, the step of integrating and cleaning the preset evaluation information to obtain effective evaluation data includes:
[0013] Extract the evaluation content and rating star rating from the preset evaluation information;
[0014] The evaluation content and the evaluation star rating are stored in the preset data analysis module according to the preset questionnaire type, so as to obtain each evaluation data file corresponding to each questionnaire type;
[0015] Each evaluation data file is integrated according to the questionnaire type to obtain an integrated evaluation data file;
[0016] The meaningless data in the integrated evaluation data file is cleaned to obtain the effective evaluation data.
[0017] According to an embodiment of the present invention, training a pre-trained BERT sentiment classification model using the evaluation labeled data to obtain a first fine-tuned BERT sentiment classification model includes:
[0018] The evaluation annotation data is input into the pre-trained BERT model to obtain the evaluation sentiment data;
[0019] The loss value of the pre-trained BERT model is calculated based on the evaluation sentiment data and the preset loss function.
[0020] The model parameters of the pre-trained BERT model are tuned according to the loss value until the loss value is less than a preset loss threshold. The pre-trained BERT model is then used as the first fine-tuned BERT sentiment classification model.
[0021] According to an embodiment of the present invention, the step of using the first fine-tuned BERT sentiment classification model to perform sentiment classification on the preset first data to be evaluated to obtain first classification evaluation data includes:
[0022] The first data to be evaluated is segmented into words and labeled to obtain updated evaluation data;
[0023] The updated evaluation data is input into the first fine-tuned BERT sentiment classification model to obtain the word segmentation vector representation corresponding to each word in the updated evaluation data;
[0024] The word segmentation vector representation is input into a preset fully connected layer to obtain the complete vector representation of the whole sentence in the updated evaluation data;
[0025] The complete vector representation is input into a preset classification layer to obtain the first classification evaluation data.
[0026] According to an embodiment of the present invention, the step of segmenting the negative sentiment data using a preset Jieba segmentation mode to obtain negative segmented data includes:
[0027] A directed acyclic graph is constructed from the prefix dictionary in the Jieba segmentation mode to represent the negative sentiment data;
[0028] The path probability of the directed acyclic graph is calculated using a preset dynamic programming algorithm and preset word frequency weights.
[0029] The word with the highest probability along the path is selected as the negative segmentation word;
[0030] The negative segmentation vocabulary is compiled into negative segmentation data.
[0031] According to an embodiment of the present invention, the step of extracting topics from the negative word segmentation data using a pre-built word pair topic model to obtain negative review topics includes:
[0032] The negative word segmentation data is divided into word pairs to obtain segmented word pairs;
[0033] The topic distribution probability of the segmented word pairs is calculated using the word pair topic model.
[0034] The topic with the highest probability in the topic distribution is selected as the negative review topic.
[0035] According to an embodiment of the present invention, before extracting topics from the negative word segmentation data using a pre-built word pair topic model to obtain negative review topics, the method further includes:
[0036] Set the number of topics in the word pair topic model;
[0037] Calculate the joint probability distribution of topics based on the number of topics and the negative word segmentation data;
[0038] The prior parameters of the joint probability distribution are sampled according to a preset Gibbs sampling algorithm until the prior parameters converge, thus obtaining the word pair topic model.
[0039] Secondly, embodiments of the present invention provide a difference classification device based on a BERT model, characterized in that it includes:
[0040] The data sentiment annotation module is used to integrate and clean the preset evaluation information to obtain effective evaluation data, and to perform sentiment annotation on the effective evaluation data to obtain evaluation annotation data.
[0041] The first model training module is used to train the pre-trained BERT sentiment classification model using the evaluation labeled data to obtain the first fine-tuned BERT sentiment classification model.
[0042] The sentiment classification module is used to classify the preset first data to be evaluated using the first fine-tuned BERT sentiment classification model to obtain the first classification evaluation data and extract the classification error data from the first classification evaluation data.
[0043] The second model training module is used to add data labels to the misclassified data to obtain classification label data, and use the classification label data and the evaluation label data to train the pre-trained BERT sentiment classification model to obtain the second fine-tuned BERT sentiment classification model.
[0044] The positive sentiment data removal module is used to classify the preset second data to be evaluated using the second fine-tuned BERT sentiment classification model to obtain the second category evaluation data, and remove the positive sentiment data in the second category evaluation data to obtain the negative sentiment data;
[0045] The negative sentiment classification module is used to segment the negative sentiment data using a preset Jieba segmentation mode to obtain negative segmented data, extract the topic from the negative segmented data using a pre-built word pair topic model to obtain negative review topics, and classify the preset evaluation information based on the negative review topics.
[0046] Thirdly, embodiments of the present invention provide an electronic device, which includes:
[0047] processor;
[0048] Memory used to store the processor's executable instructions;
[0049] The processor is configured to execute the instructions to implement a difference classification method based on the BERT model as described in the first aspect above.
[0050] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a difference classification method based on a BERT model as described in the first aspect above.
[0051] Compared with the prior art, the above-mentioned technical solution of the present invention has the following beneficial effects:
[0052] This invention, through customer questionnaires, extracts evaluation information from the questionnaires, performs intelligent data integration and cleaning, and uses a sentiment classification model to accurately predict the sentiment of the processed evaluation data. Positive sentiment data is removed from the sentiment classification data, resulting in negative sentiment data. Finally, the theme of negative reviews is extracted from the negative sentiment data. This method can extract information on any theme without requiring manual review of all evaluation information or pre-setting themes. This allows for a broader extraction of customer evaluation themes, ultimately understanding the degree of customer dissatisfaction with various aspects of the gas station. Based on the evaluation classification, improvements can be made to relevant gas station facilities, and employees can receive training to address existing problems, thereby improving the overall service quality of the gas station. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 The flowchart of the difference classification method based on the BERT model according to Embodiment 1 of the present invention is shown.
[0055] Figure 2 A schematic diagram of the cleaning process for integrating evaluation information according to Embodiment 1 of the present invention is shown.
[0056] Figure 3 A flowchart illustrating the emotion classification process according to Embodiment 1 of the present invention is shown;
[0057] Figure 4 The diagram shows the functional modules of the BERT model-based differential classification device according to Embodiment 3 of the present invention.
[0058] Figure 5 This diagram shows the structural composition of an electronic device that implements the differential classification method based on the BERT model according to Embodiment 5 of the present invention. Detailed Implementation
[0059] The present disclosure will be further described below with reference to the embodiments shown in the accompanying drawings.
[0060] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0061] This invention proposes a BERT-based negative review classification method based on big data technology. Based on BERT model theory, and combined with text segmentation and topic extraction methods, a BERT sentiment classification model is trained to extract various negative review topics from negative review data. Compared to traditional methods, deep learning-based seismic facies analysis technology can better understand customers' true needs and improve service quality. It has great potential and application prospects in the evaluation of customer feedback questionnaires and the topic classification of customer comments.
[0062] Example 1
[0063] like Figure 1 As shown, this invention proposes a difference classification method based on the BERT model, including the following steps:
[0064] S1. Perform data integration and data cleaning on the preset evaluation information to obtain effective evaluation data, and perform sentiment annotation on the effective evaluation data to obtain evaluation annotation data.
[0065] In this embodiment of the invention, the evaluation information is obtained through customer questionnaires, mainly including customer-input evaluation content and customer rating stars. Data is integrated for different questionnaire types, and meaningless characters and data are cleaned. The valid evaluation data refers to the valid evaluation data obtained after data integration and cleaning.
[0066] In this embodiment of the invention, the reference Figure 2 As shown, the process of integrating and cleaning the preset evaluation information to obtain effective evaluation data includes:
[0067] S21. Extract the evaluation content and rating star rating from the preset evaluation information;
[0068] S22. Store the evaluation content and the evaluation star rating into the preset data analysis module according to the preset questionnaire type to obtain each evaluation data file corresponding to each questionnaire type;
[0069] S23. Integrate the data of each evaluation data file according to the questionnaire type to obtain an integrated evaluation data file;
[0070] S24. Perform data cleaning on the meaningless data in the integrated evaluation data file to obtain the effective evaluation data.
[0071] In detail, a questionnaire survey was conducted to evaluate various aspects of the gas station from different customers. The evaluation content and star ratings were obtained, and the data was stored in the data analysis module (i.e., in a pandas module) according to different questionnaire types. The data in the pandas module is represented by three columns: serial number, star rating, and input content. The questionnaire types include structured, open-ended, and semi-structured questionnaires. Different pandas data files were obtained for each questionnaire type. For example, for a structured questionnaire, the evaluation content and star ratings were extracted and stored in the pandas module, resulting in a pandas data file, i.e., the evaluation data file. Therefore, different pandas data files were obtained based on different questionnaire types.
[0072] Specifically, pandas evaluation data files are integrated according to different questionnaire types to obtain all customer evaluations and star ratings for gas stations, i.e., the integrated evaluation data file. After data integration, a preset removal procedure is used to clean the integrated evaluation data file of meaningless characters and data, obtaining the valid evaluation data from the evaluation information.
[0073] In this embodiment of the invention, the evaluation data contains both positive and negative reviews. It is necessary to use the BERT algorithm to remove the positive reviews. The BERT algorithm is supervised when performing sentiment classification, that is, each piece of data in the original data during model training is labeled, that is, each piece of data has a label indicating positive or negative sentiment. However, the evaluation data itself is unlabeled, or in other words, the star rating selected by the customer and the evaluation content entered by the customer are not completely equivalent. Therefore, it is necessary to perform sentiment annotation on the valid evaluation data to obtain evaluation annotation data, that is, to label the evaluation content with positive and negative labels, and use the evaluation annotation data to train the BERT model.
[0074] S2. The pre-trained BERT sentiment classification model is trained using the evaluation and annotation data to obtain the first fine-tuned BERT sentiment classification model.
[0075] In this embodiment of the invention, the first fine-tuned BERT sentiment classification model is trained using labeled data to train a pre-trained BERT model, thereby fine-tuning the model parameters so that the first fine-tuned BERT sentiment classification model can have a better classification effect on comment data.
[0076] In this embodiment of the invention, training the pre-trained BERT sentiment classification model using the evaluation labeled data to obtain a first fine-tuned BERT sentiment classification model includes:
[0077] The evaluation annotation data is input into the pre-trained BERT model to obtain the evaluation sentiment data;
[0078] The loss value of the pre-trained BERT model is calculated based on the evaluation sentiment data and the preset loss function.
[0079] The model parameters of the pre-trained BERT model are tuned according to the loss value until the loss value is less than a preset loss threshold. The pre-trained BERT model is then used as the first fine-tuned BERT sentiment classification model.
[0080] In detail, the BERT model is a bidirectional encoder, a type of bidirectional deep neural network. It's based on the transformer's encoding part, with the addition of a bidirectional encoding mechanism. The transformer incorporates a multi-head self-attention mechanism in its encoding part, resulting in better performance in computer translation. This multi-head attention mechanism helps to better identify connections between words, thus more accurately reflecting word similarity. However, the transformer only focuses on unidirectional connections, such as left-to-right or right-to-left connections. To improve word or sentence comprehension, BERT added a bidirectional mechanism and increased network depth. Increasing network depth can lead to training result degradation; therefore, the concept of residuals was incorporated into the network. This involves directly merging the output of the previous network segment with the output of the next, thus preserving more original detailed information while adding new features.
[0081] Specifically, the pre-trained BERT model has English, Chinese, and multiple language versions. Based on network depth, there are basic versions (BERT-base) and deep network versions (BERT-large). We chose the Chinese version. Based on the amount of data, we initially chose the basic version (BERT-base), but later, due to the increase in the amount of labeled data after iteration, we switched to the deep network version (BERT-large).
[0082] Furthermore, we will transfer the BERT sentiment classification model trained on large datasets to our manually labeled data to fine-tune the model's parameters. Existing available BERT models are all pre-trained models, meaning they are trained on large amounts of data. However, their original data still differs from our data. To obtain better model performance, we need to transfer the pre-trained models to our dataset. This means training the pre-trained model using our labeled data, continuously fine-tuning the model parameters based on the loss value, until the loss value is less than a preset loss threshold. Only then will the pre-trained BERT model at this point be used as the first fine-tuned BERT sentiment classification model, enabling it to achieve better classification results on the comment data.
[0083] S3. Use the first fine-tuned BERT sentiment classification model to perform sentiment classification on the preset first data to be evaluated, obtain the first classification evaluation data, and extract the classification error data from the first classification evaluation data.
[0084] In this embodiment of the invention, the trained first fine-tuned BERT sentiment classification model is used to classify the evaluation data, thereby obtaining the classification of the sentiment category in the evaluation data, that is, whether the first classified evaluation data is data with positive sentiment or data with negative sentiment.
[0085] In this embodiment of the invention, the reference Figure 3 As shown, the step of using the first fine-tuned BERT sentiment classification model to perform sentiment classification on the preset first data to be evaluated, and obtaining the first classification evaluation data, includes:
[0086] S31. Perform word segmentation and annotation on the first data to be evaluated to obtain updated evaluation data;
[0087] S32. Input the updated evaluation data into the first fine-tuned BERT sentiment classification model to obtain the word segmentation vector representation corresponding to each word in the updated evaluation data;
[0088] S33. Input the word segmentation vector representation into a preset fully connected layer to obtain the complete vector representation of the whole sentence in the updated evaluation data;
[0089] S34. Input the complete vector representation into a preset classification layer to obtain the first classification evaluation data.
[0090] In detail, the first data to be evaluated is converted into the input form of the BERT model. The [CLS] symbol is added before the sentence and the [SEP] symbol is added at the end of the sentence. The subword tokenizer is used for word segmentation. The processed text is then input into the BERT model to obtain the vector representation of the sentence (each character in the sentence has a vector representation). The [CLS] vector representation is taken through the BertPooler (fully connected layer) module. After passing through MLP and tanh (activation function) operations, a vector representation of the entire sentence is obtained. Finally, the classification layer is passed to obtain the classification result.
[0091] Specifically, BERT is a pre-trained model that outputs a vector for each word in a sentence. First, a special symbol [CLS] is added at the beginning of the sentence. BERT also outputs a vector corresponding to this [CLS], which is used for sentiment classification. Because BERT uses a self-attention mechanism, which considers both the overall context and focuses on key words, the vector corresponding to [CLS] actually embeds information from the entire sentence, with key words receiving greater weight. Therefore, inputting the BERT output vector into a fully connected layer yields the classification result.
[0092] Furthermore, after classifying the first data to be evaluated using the first fine-tuned BERT sentiment classification model, resulting in the first category of evaluation data, this data may contain misclassified data—data where the sentiment category and the star rating in the comments do not match. Our evaluation data includes star ratings and input ratings. Generally, we default to 4-star and 5-star ratings as positive reviews, and 1-star, 2-star, and 3-star ratings as negative reviews. Therefore, we need to extract the data where the sentiment category and star rating in the comments do not match, add labels, manually screen and label the misclassified data, and then retrain the BERT model with these labeled data and our original manually labeled data. This allows for fine-tuning of the BERT model's parameters and further improves its performance.
[0093] S4. Add data labels to the misclassified data to obtain classification label data. Use the classification label data and the evaluation label data to train the pre-trained BERT sentiment classification model to obtain the second fine-tuned BERT sentiment classification model.
[0094] In this embodiment of the invention, the classification label data is used to add labels to erroneous data where the sentiment category and the star rating in the comments are not equal. For example, if the evaluation content is "good service attitude" and the corresponding sentiment category is positive, but the star rating of the comment corresponding to this evaluation content is 2 stars, it means that the sentiment category and the star rating of the comment are not equal. The data that is misclassified by the model is labeled by manual screening. These labels, along with the original manually labeled evaluation data, are used to retrain the BERT model, thereby adjusting the parameters of the BERT model and improving its performance again.
[0095] In this embodiment of the invention, the second fine-tuned BERT sentiment classification model utilizes the original labeled evaluation data and the erroneous data obtained after classifying the evaluation data according to the first fine-tuned BERT sentiment classification model, which shows a mismatch between the sentiment category and the star rating of the comments. The erroneous data with added labels and the original labeled evaluation data are used to retrain the pre-trained BERT sentiment classification model, and the parameters of the BERT model are fine-tuned, thereby further improving the performance of the BERT model and making the BERT model more accurate in sentiment classification prediction.
[0096] In detail, the steps of training the pre-trained BERT sentiment classification model using the classification label data and the evaluation label data to obtain the second fine-tuned BERT sentiment classification model are the same as those in S2, which involve training the pre-trained BERT sentiment classification model using the evaluation label data to obtain the first fine-tuned BERT sentiment classification model. These steps will not be repeated here.
[0097] S5. Use the second fine-tuned BERT sentiment classification model to classify the preset second data to be evaluated into sentiment data, obtain the second category evaluation data, remove the positive sentiment data in the second category evaluation data, and obtain the negative sentiment data.
[0098] In this embodiment of the invention, the second classification evaluation data is obtained by further classifying the evaluation data using a second fine-tuned BERT sentiment classification model. The resulting classification of the evaluation data includes both positive and negative sentiment data in the second classification evaluation data, and the sentiment category corresponds to the rating star, thus obtaining a more accurate sentiment classification of the evaluation content.
[0099] In detail, the step of using the second fine-tuned BERT sentiment classification model to classify the preset second data to be evaluated to obtain the second category evaluation data is the same as the step of using the first fine-tuned BERT sentiment classification model to classify the preset first data to be evaluated to obtain the first category evaluation data in S3, and will not be repeated here.
[0100] In the embodiments of the present invention, positive and positive evaluations are eliminated by using sentiment category analysis, and various themes are extracted from the negative evaluation data, so as to understand the real demands of customers, and improve the service quality, improve the gas station environment, enhance the diversity of goods, etc. according to the real demands of customers. Therefore, positive sentiment data needs to be eliminated from the second classification evaluation data to obtain negative sentiment data, and the negative sentiment data is analyzed to obtain negative evaluation data, and various themes are extracted from the negative evaluation data for analysis.
[0101] S6. Use the preset Jieba word segmentation mode to segment the negative sentiment data to obtain negative segmented data, use the pre-constructed word-pair topic model to extract topics from the negative segmented data to obtain negative evaluation topics, and classify the preset evaluation information according to the negative evaluation topics.
[0102] In the embodiments of the present invention, the Jieba word segmentation mode is to segment text data, and Jieba word segmentation has a full mode, an accurate mode, and a search engine mode. The full mode presents all possible word segmentations; the search engine mode will segment the words as short as possible to improve the recall rate. In order to improve the accuracy of topic extraction, the accurate mode is adopted. The accurate mode mainly uses high-frequency word segmentation. That is, when a long word has several word segmentation methods, the long word is split using the word with the highest frequency, and specific words are added to the dictionary according to the results of manual observation data, so as to obtain a more ideal word segmentation result.
[0103] In the embodiments of the present invention, the use of the preset Jieba word segmentation mode to segment the negative sentiment data to obtain negative segmented data includes:
[0104] Use the prefix dictionary in the Jieba word segmentation mode to construct a directed acyclic graph for the negative sentiment data;
[0105] Calculate the path probability of the directed acyclic graph through the preset dynamic programming algorithm and preset word frequency weights;
[0106] Select the vocabulary with the largest path probability as the negative segmented vocabulary;
[0107] Collect the negative segmented vocabulary as the negative segmented data.
[0108] Specifically, the prefix dictionary refers to the loop of all parts before the last character of a word in the statistical dictionary. For example, for the word "service", its prefix in the statistical dictionary is "fu". According to the position of each word in a sentence, the directed acyclic graph of the negative sentiment data can be constructed based on the prefix dictionary. Each node in the directed acyclic graph is weighted, and the weight is the word frequency of each word in the prefix dictionary. That is, calculate the path probability of each path in the directed acyclic graph, and select the vocabulary with the largest path probability as the word segmentation result.
[0109] Specifically, the precise mode in Jieba's word segmentation model separates each sentence with the most accurate precision, making it suitable for text analysis. For example, in negative sentiment data, which includes phrases like "poor surrounding environment" and "poor staff attitude," the precise mode in Jieba's word segmentation model can segment sentences in the negative sentiment data into "surrounding / environment / poor" and "staff / attitude / poor." Using the precise mode in Jieba's word segmentation model results in more ideal word segmentation results.
[0110] Furthermore, in order to understand the true needs of customers, it is necessary to extract negative review topics based on the ideal word segmentation effect to obtain more ideal topics. Therefore, it is necessary to extract negative review topics from the evaluation data to obtain topic data.
[0111] In this embodiment of the invention, the Biterm Topic Model (BTM) can directly extract topics from the original comment data, and it has a better topic extraction effect on short texts compared to the previously used topic extraction model (LDA). When the BTM directly extracts topics from the original text, it attempts to extract the words we want into the topic model. We fine-tune the model, that is, extract topics according to our ideal word segmentation effect, which means that we can retain the specific words we want to keep in the topic, thereby obtaining a more ideal topic.
[0112] In this embodiment of the invention, the step of using a pre-built word pair topic model to extract topics from the negative word segmentation data to obtain negative review topics includes:
[0113] The negative word segmentation data is divided into word pairs to obtain segmented word pairs;
[0114] The topic distribution probability of the segmented word pairs is calculated using the word pair topic model.
[0115] The topic with the highest probability in the topic distribution is selected as the negative review topic.
[0116] In detail, the BTM model is an unsupervised statistical learning model that improves upon the LDA topic model. It consists of three layers of Bayesian probabilistic generation model: the outermost text corpus layer, the middle document layer, and the inner keyword layer. The BTM model mainly obtains the topic information of the text set by learning the parameters of two variables.
[0117] Specifically, the word pairs are called Bi-terms. Since each comment contains a small amount of content, each comment can be regarded as an independent text unit. Any two different words form a Bi-term. For example, from "staff attitude is bad", we can extract the Bi-terms "staff", "work attitude", "personnel attitude", "personnel attitude", and "attitude is bad". By using the word pair topic model to learn the parameters, we can obtain the topic distribution and the word distribution under the topic. Then, we select the topic with the highest probability from the topic distribution probability as the negative review topic.
[0118] In this embodiment of the invention, the evaluation information is classified according to the negative review topics, that is, the evaluation information is classified according to multiple topics extracted from the negative review data, so as to understand the real needs of customers, improve service quality based on the real needs of customers, improve customer loyalty, and accurately recall some customers with high transaction volume.
[0119] Example 2
[0120] To better understand the present invention, a second embodiment is provided below to further explain the situation of constructing a word pair topic model before extracting topics from the word segmentation data.
[0121] In this embodiment of the invention, before extracting topics from the negative word segmentation data using a pre-built word pair topic model to obtain negative review topics, the method further includes:
[0122] Set the number of topics in the word pair topic model;
[0123] Calculate the joint probability distribution of topics based on the number of topics and the negative word segmentation data;
[0124] The prior parameters of the joint probability distribution are sampled according to a preset Gibbs sampling algorithm until the prior parameters converge, thus obtaining the word pair topic model.
[0125] In detail, before building the BTM topic model, it is necessary to select the number of topics. The selection of the number of topics has a great impact on the performance of the model. Therefore, it is necessary to first determine the optimal number of topics for the model. Based on the experimental results, we set the default value to 20 topics and 4 topic words.
[0126] Specifically, the prior parameters Φ and θ of the BTM model are inferred using the Gibbs sampling algorithm. Gibbs sampling is an efficient Markov chain-Monte Carlo (MCMC) sampling algorithm that utilizes the conditional distribution of each variable to sample from the joint distribution. Before performing Gibbs sampling, the initial state of the Markov chain is randomly selected. Then, the conditional probability of each word pair is calculated. The conditional probability is obtained by applying the rules of the Markov chain to the joint probability of the entire data. The prior parameters are sampled according to the joint probability distribution until the prior parameters converge, resulting in the BTM topic model.
[0127] Example 3
[0128] like Figure 4 As shown in the figure, this embodiment also provides a functional block diagram of a difference classification device based on the BERT model.
[0129] The BERT-based differential classification device 100 described in this embodiment can be installed in an electronic device. Depending on the functions implemented, the BERT-based differential classification device 100 may include a data sentiment annotation module 101, a first model training module 102, a sentiment classification module 103, a second model training module 104, a positive sentiment data removal module 105, and a differential classification module 106. The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, stored in the memory of the electronic device.
[0130] In this embodiment, the functions of each module / unit are as follows:
[0131] The data sentiment annotation module 101 is used to integrate and clean the preset evaluation information to obtain effective evaluation data, and to perform sentiment annotation on the effective evaluation data to obtain evaluation annotation data.
[0132] The first model training module 102 is used to train the pre-trained BERT sentiment classification model using the evaluation annotation data to obtain the first fine-tuned BERT sentiment classification model.
[0133] The emotion classification module 103 is used to classify the preset first data to be evaluated using the first fine-tuned BERT emotion classification model to obtain the first classification evaluation data, and to extract the classification error data in the first classification evaluation data.
[0134] The second model training module 104 is used to add data labels to the misclassified data to obtain classification label data, and use the classification label data and the evaluation label data to train the pre-trained BERT sentiment classification model to obtain a second fine-tuned BERT sentiment classification model.
[0135] The positive sentiment data removal module 105 is used to classify the preset second data to be evaluated using the second fine-tuned BERT sentiment classification model to obtain the second classification evaluation data, and remove the positive sentiment data in the second classification evaluation data to obtain the negative sentiment data.
[0136] The negative sentiment classification module 106 is used to segment the negative sentiment data using a preset Jieba segmentation mode to obtain negative segmented data, extract the topic from the negative segmented data using a pre-built word pair topic model to obtain negative review topics, and classify the preset evaluation information based on the negative review topics.
[0137] In detail, each module in the BERT model-based difference classification device 100 described in this embodiment of the invention uses the same technical means as the BERT model-based difference classification method described in Embodiment 1 and Embodiment 2, and can produce the same technical effect, which will not be repeated here.
[0138] Example 4
[0139] like Figure 5 As shown, this embodiment also provides a computer electronic device, which may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and capable of running on the processor 10, such as a difference classification program based on the BERT model.
[0140] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 11 (e.g., executing a differential classification program based on the BERT model) and calls data stored in the memory 11 to perform various functions of the electronic device and process data.
[0141] The memory 11 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 11 can include both internal and external storage units of the electronic device. The memory 11 can be used not only to store application software and various types of data installed on the electronic device, such as the code of a differential classification program based on the BERT model, but also to temporarily store data that has been output or will be output.
[0142] The communication bus 12 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0143] The communication interface 13 is used for communication between the aforementioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish communication connections between the electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), or, optionally, a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.
[0144] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0145] For example, although not shown, the electronic device may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0146] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0147] The difference classification program based on the BERT model stored in the memory 11 of the electronic device is a combination of multiple instructions. When run in the processor 10, it can achieve the following:
[0148] The preset evaluation information is integrated and cleaned to obtain effective evaluation data. The effective evaluation data is then labeled with sentiment to obtain evaluation labeled data.
[0149] The pre-trained BERT sentiment classification model is trained using the aforementioned evaluation and annotation data to obtain the first fine-tuned BERT sentiment classification model;
[0150] The first fine-tuned BERT sentiment classification model is used to classify the preset first data to be evaluated to obtain the first classification evaluation data, and the classification error data in the first classification evaluation data is extracted.
[0151] Add data labels to the misclassified data to obtain classification label data, and use the classification label data and the evaluation label data to train the pre-trained BERT sentiment classification model to obtain a second fine-tuned BERT sentiment classification model;
[0152] The second fine-tuned BERT sentiment classification model is used to classify the preset second data to be evaluated into sentiment data, and the positive sentiment data in the second category evaluation data is removed to obtain the negative sentiment data.
[0153] The negative sentiment data is segmented using a preset Jieba segmentation mode to obtain negative segmented data. A pre-built word pair topic model is used to extract topics from the negative segmented data to obtain negative review topics. The preset evaluation information is then classified into negative categories based on the negative review topics.
[0154] Specifically, the specific implementation method of the processor 10 for the above instructions can be referred to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, and will not be repeated here.
[0155] Furthermore, if the modules / units integrated into the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0156] Example 5
[0157] This embodiment provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the difference classification method based on the BERT model as described above.
[0158] This program code can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 Steps of a specified function in one or more processes.
[0159] Storage media include permanent and non-permanent, removable and non-removable media, and can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by computing devices.
[0160] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations according to this application. When the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.
[0161] It should be understood that the terms used in this way can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in a sequence other than those illustrated or described herein.
[0162] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0163] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0164] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0165] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0166] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0167] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0168] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0169] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A difference classification method based on the BERT model, characterized in that, The method includes: The preset evaluation information is integrated and cleaned to obtain effective evaluation data. The effective evaluation data is then labeled with sentiment to obtain evaluation labeled data. The pre-trained BERT sentiment classification model is trained using the aforementioned evaluation and annotation data to obtain the first fine-tuned BERT sentiment classification model; The first fine-tuned BERT sentiment classification model is used to classify the preset first data to be evaluated to obtain the first classification evaluation data, and the classification error data in the first classification evaluation data is extracted. Add data labels to the misclassified data to obtain classification label data, and use the classification label data and the evaluation label data to train the pre-trained BERT sentiment classification model to obtain a second fine-tuned BERT sentiment classification model; The second fine-tuned BERT sentiment classification model is used to classify the preset second data to be evaluated into sentiment data, and the positive sentiment data in the second category evaluation data is removed to obtain the negative sentiment data. The negative sentiment data is segmented using a preset Jieba segmentation mode to obtain negative segmented data. A pre-constructed word-pair topic model is then used to extract topics from the negative segmented data to obtain negative review topics. Based on these negative review topics, the preset evaluation information is categorized into negative reviews. The word-pair topic model, from the outside in, includes a text corpus layer, a document layer, and a keyword layer. The step of using the pre-constructed word-pair topic model to extract topics from the negative segmented data to obtain negative review topics includes: dividing the negative segmented data into word pairs to obtain segmented word pairs; calculating the topic distribution probability of the segmented word pairs using the word-pair topic model; and selecting the topic with the highest probability among the topic distribution probabilities as the negative review topic.
2. The difference classification method based on the BERT model as described in claim 1, characterized in that, The process of integrating and cleaning the preset evaluation information to obtain effective evaluation data includes: Extract the evaluation content and rating star rating from the preset evaluation information; The evaluation content and the evaluation star rating are stored in the preset data analysis module according to the preset questionnaire type, so as to obtain each evaluation data file corresponding to each questionnaire type; Each evaluation data file is integrated according to the questionnaire type to obtain an integrated evaluation data file; The meaningless data in the integrated evaluation data file is cleaned to obtain the effective evaluation data.
3. The difference classification method based on the BERT model as described in claim 1, characterized in that, The step of training the pre-trained BERT sentiment classification model using the evaluation labeled data to obtain the first fine-tuned BERT sentiment classification model includes: The evaluation labeling data is input into the pre-trained BERT sentiment classification model to obtain the evaluation sentiment data; The loss value of the pre-trained BERT sentiment classification model is calculated based on the evaluated sentiment data and the preset loss function. The model parameters of the pre-trained BERT sentiment classification model are tuned according to the loss value until the loss value is less than a preset loss threshold. The pre-trained BERT sentiment classification model is then used as the first fine-tuned BERT sentiment classification model.
4. The difference classification method based on the BERT model as described in claim 1, characterized in that, The step of using the first fine-tuned BERT sentiment classification model to perform sentiment classification on the preset first data to be evaluated, and obtaining the first classification evaluation data, includes: The first data to be evaluated is segmented into words and labeled to obtain updated evaluation data; The updated evaluation data is input into the first fine-tuned BERT sentiment classification model to obtain the word segmentation vector representation corresponding to each word in the updated evaluation data; The word segmentation vector representation is input into a preset fully connected layer to obtain the complete vector representation of the whole sentence in the updated evaluation data; The complete vector representation is input into a preset classification layer to obtain the first classification evaluation data.
5. The difference classification method based on the BERT model as described in claim 1, characterized in that, The step of segmenting the negative sentiment data using a preset Jieba segmentation mode to obtain negative segmented data includes: A directed acyclic graph is constructed from the prefix dictionary in the Jieba segmentation mode to represent the negative sentiment data; The path probability of the directed acyclic graph is calculated using a preset dynamic programming algorithm and preset word frequency weights. The word with the highest probability along the path is selected as the negative segmentation word; The negative segmentation vocabulary is compiled into negative segmentation data.
6. The difference classification method based on the BERT model as described in claim 1, characterized in that, Before extracting topics from the negative word segmentation data using a pre-built word pair topic model to obtain negative review topics, the method further includes: Set the number of topics in the word pair topic model; Calculate the joint probability distribution of topics based on the number of topics and the negative word segmentation data; The prior parameters of the joint probability distribution are sampled according to a preset Gibbs sampling algorithm until the prior parameters converge, thus obtaining the word pair topic model.
7. A difference classification device based on the BERT model, characterized in that, The device includes: The data sentiment annotation module is used to integrate and clean the preset evaluation information to obtain effective evaluation data, and to perform sentiment annotation on the effective evaluation data to obtain evaluation annotation data. The first model training module is used to train the pre-trained BERT sentiment classification model using the evaluation labeled data to obtain the first fine-tuned BERT sentiment classification model. The sentiment classification module is used to classify the preset first data to be evaluated using the first fine-tuned BERT sentiment classification model to obtain the first classification evaluation data and extract the classification error data from the first classification evaluation data. The second model training module is used to add data labels to the misclassified data to obtain classification label data, and use the classification label data and the evaluation label data to train the pre-trained BERT sentiment classification model to obtain the second fine-tuned BERT sentiment classification model. The positive sentiment data removal module is used to classify the preset second data to be evaluated using the second fine-tuned BERT sentiment classification model to obtain the second category evaluation data, and remove the positive sentiment data in the second category evaluation data to obtain the negative sentiment data; The negative sentiment classification module is used to segment the negative sentiment data using a preset Jieba segmentation mode to obtain negative segmented data, extract topics from the negative segmented data using a pre-built word pair topic model to obtain negative review topics, and classify the preset evaluation information based on the negative review topics. The word pair topic model includes, from the outside in, a text corpus layer, a document layer, and a keyword layer. The step of extracting topics from the negative segmented data using the pre-built word pair topic model to obtain negative review topics includes: dividing the negative segmented data into word pairs to obtain segmented word pairs; calculating the topic distribution probability of the segmented word pairs using the word pair topic model; and selecting the topic with the highest probability among the topic distribution probabilities as the negative review topic.
8. An electronic device comprising: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the difference classification method based on the BERT model as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the difference classification method based on the BERT model as described in any one of claims 1 to 6.