Power supply service risk identification method based on natural language processing
Through natural language processing technology, automatic classification, sentiment analysis and intention identification of power companies' customer demands, combined with risk assessment algorithms, the problem of inefficiency and inaccuracy of information when dealing with customer demands is solved, and efficient risks are achieved Identification and early warning have improved the quality of power supply services and customer satisfaction.
Patent Information
- Application Number
- CN202411153998.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-10
AI Technical Summary
Power companies face inefficiency and inaccuracy of information when handling customer demands, especially when customer scale is expanded and the amount of demand data is increased, it is difficult to achieve automated processing and efficient management.
The risk identification method of power supply service based on natural language processing is adopted. By collecting customer demand data from multiple channels, pre-processing and inputting pre-trained semantic analysis model for text classification, sentiment analysis and intention identification, and quantitative analysis is carried out in combination with risk assessment algorithms. Priority sorting to achieve automated risk identification and early warning.
It significantly improves the efficiency and accuracy of customer demand processing, can accurately identify and respond to high-risk items in real time, avoid potential service risks, and improves power supply service quality and customer satisfaction.
Smart Images

Figure CN119107088A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a method for identifying risks of power supply services based on natural language processing. Background Art
[0002] With the growing demand for electricity in modern society, the importance of power supply service quality and customer satisfaction has become increasingly prominent. Customers may encounter various problems and demands in the process of using electricity, such as unstable power supply quality, electricity bill disputes, power safety hazards, customer service attitude, and power infrastructure failures. The timely resolution of these problems is not only directly related to the daily life and production activities of customers, but also affects the reputation and service level of power companies. Therefore, power companies need to establish an effective processing mechanism to quickly respond to and resolve customer needs and complaints.
[0003] Traditionally, customers submit their complaints through various channels such as telephone hotlines, emails, text messages, and online service platforms. These complaint data are usually unstructured text data, and processing and analyzing these data requires a lot of manpower and time. Manual processing is not only inefficient, but also difficult to ensure the accuracy and timeliness of information. With the expansion of customer scale and the increase in the amount of complaint data, the challenges faced by power companies are also increasing. How to automate and efficiently manage customer complaints has become an urgent problem to be solved. Summary of the invention
[0004] In view of this, the present invention proposes a power supply service risk identification method based on natural language processing, which uses natural language processing and deep learning technology to automatically classify, sentimentally analyze and identify intentions of customer demand data from multiple channels, and combines risk assessment algorithms for quantitative analysis and priority sorting, to achieve efficient and timely risk identification and early warning, so as to improve the quality of power supply services and customer satisfaction.
[0005] The technical solution of the present invention is implemented as follows: The present invention provides a method for identifying power supply service risks based on natural language processing, comprising:
[0006] S1 collects customer demand data from all channels and pre-processes the customer demand data;
[0007] S2 inputs the pre-processed customer demand data into the pre-trained semantic analysis model for processing to obtain text classification results, sentiment analysis results, and intent recognition results;
[0008] S3 uses the risk identification algorithm to conduct quantitative assessment based on the text classification results, sentiment analysis results, and intent recognition results to obtain risk scores and risk levels;
[0009] S4 sorts the customer demand data according to risk score and risk level, responds to the first k customer demand data with an early warning mechanism, and processes the customer demand data starting from k+1 in sequence.
[0010] Based on the above solution, preferably, step S1 includes:
[0011] S11 collects customer demand data from all channels, including telephone hotlines, online channels, email systems, offline channels, SMS platforms, and third-party platforms. Customer demand data includes demand tickets, demand content, customer information, historical demands, and channel information.
[0012] S12 divides customer demand data from different channels into voice, video and text categories according to format;
[0013] S13 converts the voice and video customer demand data into text, thereby obtaining unified text customer demand data;
[0014] S14 integrates customer demand data into one database, unifies the data format, and standardizes field names and data types according to its metadata;
[0015] S15 cleans customer demand data, including removing duplicate data, processing missing data, and correcting obviously erroneous data.
[0016] Based on the above solution, preferably, step S2 includes:
[0017] S21 builds a semantic analysis model, including feature extraction network, semantic analysis network and classification recognition network;
[0018] S22 obtains historical demand data and historical processing information thereof, the historical processing information including historical feedback, generates historical demand data according to the historical feedback to obtain historical generated data, and produces a sample set by combining the historical demand data and the historical generated data;
[0019] S23 iteratively trains the semantic analysis model using the sample set until the model converges, thereby obtaining a pre-trained semantic analysis model;
[0020] S24 inputs the preprocessed customer demand data into the pre-trained semantic analysis model for processing to obtain text classification results, sentiment analysis results, and intent recognition results.
[0021] Based on the above solution, preferably, step S22 includes:
[0022] S221 Historical demand data includes historical customer demand data and corresponding historical labels. Historical labels include historical text classification results, historical sentiment analysis results, and historical intent recognition results. Historical processing information includes historical feedback, which is divided into positive feedback and negative feedback.
[0023] S222 selects the historical demand data with positive feedback as the first data set, and selects the historical demand data with negative feedback as the second data set;
[0024] S223 performs a positive adjustment on the historical label of the second data set to form a pseudo correct label, updates the historical label of the second data set to the pseudo correct label, and generates a second generated data set;
[0025] S224 uses the first data set as a first sample set, and uses the second data set and the second generated data set to form a sample pair as a second sample set. The first sample set and the second sample set are combined to form a sample set.
[0026] Based on the above solution, preferably, step S23 includes:
[0027] S231 sets an alternating training strategy, sets the batch size to n, and sets the maximum number of iterations to T;
[0028] S232 sets the number of iterations t=1;
[0029] S233 randomly samples from the first sample set according to the batch size to obtain a first training sample;
[0030] S234 uses the first training sample to train the semantic analysis model, and uses the first loss function to back-propagate and update the model;
[0031] S235 randomly selects from the second sample set according to the batch size to obtain a second training sample;
[0032] S236 trains the semantic analysis model again using the second training sample, and back-propagates and updates the model using the second loss function;
[0033] S237 determines whether the number of iterations t is equal to T. If so, the iteration ends and the trained semantic analysis model is obtained. If not, t=t+1 is set and the process returns to step S233.
[0034] Based on the above solution, preferably, the first loss function is:
[0035]
[0036] The second loss function is:
[0037]
[0038] CL(f(x i ), f(x j ))=(1-d(r, r′))·max(0, m-||f(x i )-f(x j )||)+d(r,r′)·||f(x i )-f(x j )||
[0039] In the formula, represents the cross entropy loss of the text classification result, y is the actual text classification label, is the text classification result predicted by the model, represents the mean square error loss of the sentiment analysis result, s is the true sentiment analysis label, is the sentiment analysis result predicted by the model, represents the focal loss of the intent recognition result, z is the true intent recognition label, is the intention recognition result predicted by the model, ω1, ω2, ω3 represent the learnable weights of the three tasks, σ v represents the learnable parameters of each task, ω4 is the weight of the contrast loss, CL(f(x i ), f(x j )) represents the contrast loss, (x i , x j ) represents a second training sample, d(r, r′) represents the similarity of the sample pair, r is the original label, r′ is the pseudo correct label, m represents the boundary hyperparameter, f(·) represents the model output, and ||·|| represents the norm.
[0040] Based on the above scheme, preferably, the feature extraction network adopts a lightweight BERT network, the semantic analysis network adopts a trapezoidal bidirectional LSTM network, and the classification network is divided into three task heads, which are used for text classification, sentiment analysis and intent recognition respectively, and each task head adopts a multi-layer fully connected layer.
[0041] Based on the above solution, preferably, step S3 includes:
[0042] S31 text classification results include power supply quality, electricity bill, electricity safety, customer service, and power facilities. Sentiment analysis results include positive, neutral, and negative. Intent recognition results include consultation, suggestion, and complaint.
[0043] S32 sets the basic score R of each category of the text classification result, determines the sentiment coefficient S according to the classification of the sentiment analysis result, determines the intention score I according to the intention recognition result, and introduces the interaction score E to represent the interaction effect of the text classification combination and the sentiment analysis result;
[0044] S33 calculates the risk score based on R, S, I, E and the risk score calculation formula;
[0045] S34 sets the risk level classification rules and maps the risk score values to corresponding risk levels. The risk levels are divided into low risk, medium-low risk, medium risk, medium-high risk, high risk and extremely high risk.
[0046] Based on the above scheme, preferably, the risk score calculation formula is:
[0047] D = α × log (R × S + 1) + β × I γ +δ×(R 0.5 ×S×E)
[0048] Where D is the risk score, R is the basic score of the text classification result, S is the sentiment coefficient of the sentiment analysis result, I is the intention score of the intention recognition result, E is the interaction score, α is the nonlinear logarithmic weight, β is the nonlinear exponential weight, γ is the nonlinear coefficient of the intention score, and δ is the weight of the interaction effect.
[0049] Based on the above solution, preferably, step S4 includes:
[0050] S41 performs a first sorting of the customer demand data from high to low according to the risk level, and performs a second sorting of the customer demand data in the first sorting from large to small according to the risk score, to obtain a risk sorting list;
[0051] S42 uses the first k customer demand data in the risk ranking list as warning data, marks them as high priority, sends real-time warning notifications, and puts them into the rapid response queue;
[0052] S43 processes the remaining customer demand data starting from k+1 in sequence according to the sorted order.
[0053] Compared with the prior art, the present invention has the following beneficial effects:
[0054] (1) By collecting customer demand data from multiple channels, using pre-trained semantic analysis models to perform comprehensive text classification, sentiment analysis, and intent recognition, and quantifying risk levels through risk scoring algorithms, combined with ranking and early warning mechanisms, the efficiency and accuracy of customer demand processing have been significantly improved overall;
[0055] (2) Iteratively train the semantic analysis model using expanded and diverse historical data until the model converges. This method can capture the subtle differences in customer demand texts and improve the accuracy of text classification, sentiment analysis, and intent recognition. By adjusting the historical labels of negative feedback data, the model's adaptability and processing accuracy for complex or biased samples are improved, thereby improving the overall semantic analysis effect;
[0056] (3) Through the risk scoring calculation formula and the two-tier ranking and early warning mechanism, the risk level of customer requests is comprehensively assessed, and high-risk items are handled first. This scoring and early warning mechanism can identify and respond to high-risk requests in near real time, thereby avoiding potential service risks. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] 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, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0059] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] like Figure 1 As shown, the present invention provides a method for identifying power supply service risks based on natural language processing, comprising:
[0061] S1 collects customer demand data from all channels and pre-processes the customer demand data;
[0062] S2 inputs the pre-processed customer demand data into the pre-trained semantic analysis model for processing to obtain text classification results, sentiment analysis results, and intent recognition results;
[0063] S3 uses the risk identification algorithm to conduct quantitative assessment based on the text classification results, sentiment analysis results, and intent recognition results to obtain risk scores and risk levels;
[0064] S4 sorts the customer demand data according to risk score and risk level, responds to the first k customer demand data with an early warning mechanism, and processes the customer demand data starting from k+1 in sequence.
[0065] Specifically, in one embodiment of the present invention, step S1 includes:
[0066] S11 collects customer demand data from all channels, including telephone hotlines, online channels, email systems, offline channels, SMS platforms, and third-party platforms. Customer demand data includes demand tickets, demand content, customer information, historical demands, and channel information.
[0067] S12 divides customer demand data from different channels into voice, video and text categories according to format;
[0068] S13 converts the voice and video customer demand data into text, thereby obtaining unified text customer demand data;
[0069] S14 integrates customer demand data into one database, unifies the data format, and standardizes field names and data types according to its metadata;
[0070] S15 cleans customer demand data, including removing duplicate data, processing missing data, and correcting obviously erroneous data.
[0071] First, it is necessary to collect customer demand data from various channels. For power supply services, the channels include telephone hotlines, online channels (such as online customer service, social media, etc.), email systems, offline channels (such as feedback forms of physical service outlets, etc.), SMS platforms, and third-party platforms, such as 95598, 12398, 12345, grid cloud phones, social apps, etc. to collect demand data. These demand data include demand work orders, specific demand content, customer information, and channel information. When collecting, historical demands are automatically captured based on customer information.
[0072] Since the data is collected from various channels in various forms, including video, voice and text, in order to facilitate processing, the data needs to be initially divided into video data, voice data and text data.
[0073] In order to unify the data format, the video data and voice data are first converted. For example, ASR is used to recognize voice and convert the voice content into text. FFmpeg is used to extract the audio file in the video, and then the audio is converted into text. Finally, all customer demand data are organized into unified text data according to data items. That is, one demand forms one data. There may be a situation where a customer makes multiple demands at the same time. At this time, the demands are checked for duplication. If the data content is inconsistent, they are still distinguished as two data.
[0074] Choose the relational database MySQL to store data. First, design the table structure and determine the structure and fields of each data table. The fields should include at least customer_name, contact_info, complaint_text, channel, submission_date, complaint_id, complaint_type, status, and resolution.
[0075] According to the metadata standardization requirements, ensure that all field names are consistent across data sources, for example, uniformly map different field names of each channel to standardized field names. Ensure that the data type of each field is consistent. Some example field mapping tables in this embodiment are shown in Table 1.
[0076] Table 1 Example field mapping table
[0077] Original field name Standardize field names Data Types name customer_name VARCHAR(255) contact contact_info VARCHAR(255) content complaint_text TEXT source channel VARCHAR(255) date submission_date VARCHAR(255) id complaint_id VARCHAR(255) type complaint_type VARCHAR(255) status status VARCHAR(255) resolution resolution TEXT
[0078] Use the standardized data to import it into the database in batches.
[0079] After database integration, data cleaning is required to ensure data validity, including:
[0080] De-duplicate data: Detect and delete duplicate records to ensure that each claim data is unique.
[0081] Handling missing data: For missing fields, complete or mark them. If the missing of important fields may affect subsequent analysis, consider completing them appropriately or abandoning the record.
[0082] Correct obvious errors in data: Identify and correct obvious errors in data, such as incorrect contact format, inconsistent date formats, etc.
[0083] Specifically, in one embodiment of the present invention, step S2 includes:
[0084] S21 builds a semantic analysis model, including feature extraction network, semantic analysis network and classification recognition network;
[0085] S22 obtains historical demand data and historical processing information thereof, the historical processing information including historical feedback, generates historical demand data according to the historical feedback to obtain historical generated data, and produces a sample set by combining the historical demand data and the historical generated data;
[0086] S23 iteratively trains the semantic analysis model using the sample set until the model converges, thereby obtaining a pre-trained semantic analysis model;
[0087] S24 inputs the preprocessed customer demand data into the pre-trained semantic analysis model for processing to obtain text classification results, sentiment analysis results, and intent recognition results.
[0088] In this embodiment, the feature extraction network adopts a lightweight BERT network, the semantic analysis network adopts a trapezoidal bidirectional LSTM network, and the classification network is divided into three task heads, which are used for text classification, sentiment analysis, and intent recognition respectively. Each task head adopts a multi-layer fully connected layer.
[0089] In this embodiment, step S22 includes:
[0090] S221 Historical demand data includes historical customer demand data and corresponding historical labels. Historical labels include historical text classification results, historical sentiment analysis results, and historical intent recognition results. Historical processing information includes historical feedback, which is divided into positive feedback and negative feedback.
[0091] S222 selects the historical demand data with positive feedback as the first data set, and selects the historical demand data with negative feedback as the second data set;
[0092] S223 performs a positive adjustment on the historical label of the second data set to form a pseudo correct label, updates the historical label of the second data set to the pseudo correct label, and generates a second generated data set;
[0093] S224 uses the first data set as a first sample set, and uses the second data set and the second generated data set to form a sample pair as a second sample set. The first sample set and the second sample set are combined to form a sample set.
[0094] Specifically, step S23 includes:
[0095] S231 sets an alternating training strategy, sets the batch size to n, and sets the maximum number of iterations to T;
[0096] S232 sets the number of iterations t=1;
[0097] S233 randomly samples from the first sample set according to the batch size to obtain a first training sample;
[0098] S234 uses the first training sample to train the semantic analysis model, and uses the first loss function to back-propagate and update the model;
[0099] S235 randomly selects from the second sample set according to the batch size to obtain a second training sample;
[0100] S236 trains the semantic analysis model again using the second training sample, and back-propagates and updates the model using the second loss function;
[0101] S237 determines whether the number of iterations t is equal to T. If so, the iteration ends and the trained semantic analysis model is obtained. If not, t=t+1 is set and the process returns to step S233.
[0102] Let’s take a specific example to illustrate the training:
[0103] First, a sample set needs to be constructed, which involves obtaining historical data and screening and processing it to form a high-quality training data set.
[0104] 1. Obtain and prepare data
[0105] Historical demand data: includes the customer’s historical demand content and demand labels (text classification results, sentiment analysis results, and intent recognition results).
[0106] Historical processing information: including the processing feedback of these historical demands, which are divided into positive feedback (customer satisfaction or successful resolution) and negative feedback (customer dissatisfaction or unresolved). In the scenario of power supply services, for example, the customer demand classification, sentiment analysis and intent recognition given by the system accurately reflect the user's true intention, and the user confirms that the model output is correct. If the system misclassifies customer needs, sentiment analysis incorrectly identifies the customer's emotions or the intent recognition is not in place, the user feedback model output is wrong.
[0107] 2. Data screening and labeling
[0108] Filter data: Filter out all historical demand data with positive feedback as the first data set. Filter out all historical demand data with negative feedback as the second data set.
[0109] Generate pseudo-correct labels: Adjust the historical labels in the second dataset to form pseudo-correct labels. Adjusting labels can help the model learn more correct patterns and identify errors, improving overall performance.
[0110] When adjusting labels, pseudo-correct labels can be generated through logical rules or manual annotation, and adjustments can be made based on the specific content of historical feedback. It is possible to adjust only the text classification label, or all three labels may be adjusted.
[0111] Specifically, historical feedback includes text feedback, which is submitted through online forms, chat windows, feedback generators, etc. Text feedback can be open-ended, such as "The system misunderstood my intention. I came to report a problem, not to consult." Rating system, through star ratings or satisfaction surveys, customers rate different aspects of the service. Telephone feedback, through telephone surveys or customer service representatives record customer feedback, the content usually needs to be manually sorted and analyzed.
[0112] For historical feedback, it is necessary to analyze the feedback content and map the analysis results with the corresponding labels. Specifically, create a dictionary of keywords and phrases to automatically classify according to the actual content of customer feedback. If it involves obvious expressions such as "consultation", the label can be adjusted accordingly. Use a sentiment dictionary or sentiment analysis model to annotate the emotional state of customer feedback to identify the dissatisfaction expressed by the customer. For keywords such as "anger" and "dissatisfaction", the sentiment analysis can be adjusted. Determine the actual intention mentioned by the customer, such as "repair" and "appeal", to correct the intent label. After analyzing customer feedback, generate a pseudo-correct label that is consistent with actual expectations. For example, if the feedback indicates an intent recognition error, a new intent label is generated. If the feedback involves multiple aspects (such as mentioning classification and sentiment recognition errors at the same time), multiple labels need to be adjusted simultaneously.
[0113] 3. Constructing a sample set
[0114] The first sample set is directly formed from the first data set.
[0115] Second sample set: formed by sample pairs consisting of the second data set and the second generated data set.
[0116] Final sample set: The first sample set and the second sample set are combined to form a complete training sample set.
[0117] Afterwards, it is necessary to build the semantic analysis model used in this embodiment. The semantic analysis model consists of three parts: feature extraction network, semantic analysis network and classification network.
[0118] The feature extraction network uses lightweight BERT, whose structure is:
[0119] In the input layer, the text is converted into word embeddings and input into the BERT model. Word embedding is the sum of character embedding, position embedding, and segment embedding.
[0120] Multi-layer transformer encoder. Compared with the original BERT, the lightweight BERT reduces the number of layers of the transformer encoder. Each layer of the encoder includes a multi-head self-attention mechanism, a feedforward neural network, a residual connection, and layer regularization.
[0121] The output layer outputs a context-dependent word vector representation. For a given text input, it outputs the corresponding feature vector.
[0122] The semantic analysis network uses a trapezoidal bidirectional LSTM, and its structure is:
[0123] Multi-layer bidirectional LSTM, each layer consists of two parts, forward LSTM and backward LSTM, the forward LSTM processes the sequence from left to right, and the backward LSTM processes the sequence from right to left. The layers are connected in a ladder structure, that is, the input size of each layer is reduced layer by layer, and the output of the bidirectional LSTM is spliced together to obtain the global context information of each word, that is, the output obtains the context representation at the word level.
[0124] The classification network uses multiple task heads, which are divided into text classification tasks, sentiment analysis tasks, and intent recognition tasks. The task heads all use multiple fully connected layers, and the number of neurons in the last layer is determined according to the number of categories of each task.
[0125] When the semantic analysis model is iteratively trained using sample sets, it is a multi-task learning as a whole. When the samples are screened and labeled, they are divided into two sample sets. This embodiment adopts an alternating training method for training. The first sample set is to let the model learn the classification of correct instances, and the second sample set is to let the model learn the characteristics of wrong examples. Specifically in training:
[0126] Initialize model parameters, such as lightweight BERT, bidirectional LSTM, and multi-task head weights. Set loss function weights and optimizer, initial learning rate, etc. Set alternating training strategy, set batch size to n, and set maximum number of iterations to T.
[0127] The first step is to randomly sample n data from the first sample set (positive feedback cases) to form the first training sample.
[0128] The second step is to use the first loss function to train the model, back-propagate and update the model parameters.
[0129] The third step is to randomly sample n data from the second sample set (including negative feedback cases with pseudo-correct labels) to form the second training sample.
[0130] Step 4: Use the second loss function to train the model, backpropagate and update the model parameters.
[0131] Step 5: Check whether the maximum number of iterations T is reached. If so, train the results and output the optimized model. If not, increase the number of iterations t=t+1 and return to the first step to continue training.
[0132] During training, the Adam optimizer is used to update the gradient. The learning rate is adjusted dynamically to smooth the training process. The small batch stochastic gradient descent method is used to improve the generalization ability of the model.
[0133] During training, the first loss function is:
[0134]
[0135] In the formula, Represents the cross entropy loss of the text classification result, which is used for text classification tasks. y is the actual text classification label. is the text classification result predicted by the model, which measures the difference between the probability distribution of the model output and the true label distribution; represents the mean square error loss of the sentiment analysis result, which is used for sentiment analysis tasks, s is the true sentiment analysis label, is the sentiment analysis result predicted by the model, which measures the difference between the continuous sentiment score output by the model and the true score; represents the focal loss of the intent recognition result, which is used for the intent recognition task, z is the actual intent recognition label, is the intention recognition result predicted by the model, which balances the imbalance problem between different categories; ω1, ω2, ω3 represent the learnable weights of the three tasks, σ v Represents the learnable parameters of each task, which are used to adjust the weight of each task loss.
[0136] The first loss function combines the main loss functions of different tasks, enabling the model to optimize text classification, sentiment analysis, and intent recognition at the same time. Through the learnable weights ω1, ω2, ω3 and the learnable parameters σ that adjust the loss of each task v , the model can adaptively adjust the contribution of each task according to the characteristics of the data and tasks. This design encourages the model to focus on multiple different tasks during training, effectively avoiding overfitting or bias of a single task.
[0137] The second loss function is:
[0138]
[0139] CL(f(x i ), f(x j ))=(1-d(r, r′))·max(0, m-||f(x i )-f(x j )||)+d(r,r′)·||f(x i )-f(x j )||
[0140] Where ω4 is the weight of the contrast loss, CL(f(x i ), f(x j )) represents the contrast loss, (x i , x j ) represents a second training sample, d(r, r′) represents the similarity of the sample pair, r is the original label, r′ is the pseudo correct label, m represents the boundary hyperparameter, f(·) represents the model output, and ||·|| represents the norm.
[0141] Specifically, in the contrast loss, r and r' refer to which label is adjusted when the label is adjusted. If the text classification label is adjusted in the sample pair, r refers to the text classification label y, and r' refers to the adjusted pseudo-correct label. If the text classification label and sentiment analysis label are adjusted at the same time in the sample pair, r includes the text classification label y and the sentiment analysis label s, and r' refers to the pseudo-correct label after adjusting the two labels at the same time. When calculating d(r, r'), the similarity between the two labels is weighted averaged and used as the similarity of the sample pair.
[0142] In this embodiment, contrastive loss is introduced to enable the model to learn how to better distinguish similar and dissimilar samples, thereby improving the model's discrimination ability. Contrastive loss enables the model to consider the similarity between sample pairs during training, and promotes the model's ability to learn to correct errors from negative feedback samples. Contrastive learning enhances the model's ability to handle complex samples and boundary samples, and avoids the model making consistent errors on negative feedback samples.
[0143] In this embodiment, when training the model, an alternating training strategy is used. The first loss function is used for training first, and then the second loss function is used for training. At the same time, positive feedback and negative feedback samples are combined, and alternating cycles are performed. By sampling from positive feedback and negative feedback samples respectively, the model can learn different types of sample distributions and improve the generalization ability of the model. The first loss function emphasizes the overall effect of the model on the three tasks, while the second loss function introduces contrastive learning, especially for optimizing difficult and erroneous samples. By gradually adjusting the weights of each task and the contrastive learning weights in each loss function cycle, the model learns basic tasks in the early stage and optimizes difficult samples and boundary samples in the later stage, and finally obtains a more stable and robust model.
[0144] After the model is trained, input the preprocessed customer demand data to obtain text classification results, sentiment analysis results, and intent recognition results.
[0145] Specifically, in one embodiment of the present invention, step S3 includes:
[0146] S31 text classification results include power supply quality, electricity bill, electricity safety, customer service, and power facilities. Sentiment analysis results include positive, neutral, and negative. Intent recognition results include consultation, suggestion, and complaint.
[0147] S32 sets the basic score R of each category of the text classification result, determines the sentiment coefficient S according to the classification of the sentiment analysis result, determines the intention score I according to the intention recognition result, and introduces the interaction score E to represent the interaction effect of the text classification combination and the sentiment analysis result;
[0148] S33 calculates the risk score based on R, S, I, E and the risk score calculation formula;
[0149] S34 sets the risk level classification rules and maps the risk score values to corresponding risk levels. The risk levels are divided into low risk, medium-low risk, medium risk, medium-high risk, high risk and extremely high risk.
[0150] In this embodiment, each text classification result is assigned a basic score based on its importance and historical data, such as: power supply quality: 10; electricity bill: 5; electricity safety: 15; customer service: 7; power facilities: 8. The sentiment coefficient is determined based on the classification of the sentiment analysis results, such as: positive: 0.5; neutral: 1; negative: 2. The intention score is determined based on the intention recognition results, such as: consultation: 1; suggestion: 2; complaint: 3. The interaction score E is introduced to represent the interaction effect of the text classification combination and the sentiment analysis results, and to measure the incremental score brought by the joint action of text classification and sentiment analysis. For example, the combination of power safety and negative may have an additional incremental score of 2.5.
[0151] The risk score is calculated using the risk score calculation formula:
[0152] D = α × log (R × S + 1) + β × I γ +δ×(R 0.5 ×S×E)
[0153] Where D is the risk score, R is the basic score of the text classification result, S is the sentiment coefficient of the sentiment analysis result, I is the intention score of the intention recognition result, E is the interaction score, α is the nonlinear logarithmic weight, β is the nonlinear exponential weight, y is the nonlinear coefficient of the intention score, and δ is the weight of the interaction effect.
[0154] In this formula, the first part is the nonlinear logarithmic part, which is used to nonlinearly scale the product of the base score and the sentiment intensity. The logarithmic transformation helps to compress the large value range while providing enough nuance at low values, which makes the difference between high risk and low risk more significant. The second part is the nonlinear exponential part, which is used to nonlinearly scale the intent recognition results and emphasize their importance. Higher intent scores such as complaints need to be amplified, so an exponential function is used to enhance the influence of higher intent scores. The third part is the interaction effect part, which is used to combine the incremental scores brought by text classification and sentiment analysis, and smooth the influence of the base score through square roots. The combination of the base score and sentiment analysis can reflect more diverse actual scenarios, and the square root transformation is used to prevent the base score from over-amplifying its influence. Among them, α controls the influence of the product of the base score and sentiment analysis on the overall score, β highlights the importance of the intent score and amplifies higher intents, γ defines the nonlinear growth rate of the intent recognition score, and δ adjusts the influence of the interaction effect part to prevent it from being over-amplified or reduced.
[0155] Let's take a specific example to illustrate:
[0156] The customer's complaint text is: There have been frequent power outages recently, and the power facilities are often under maintenance. In addition, the customer service attitude is very poor, and I am very worried about safety issues.
[0157] After processing using the trained semantic analysis model, the text classification results are power supply quality (frequent power outages), power facilities (frequent maintenance), power safety (worrying about safety issues), customer service (poor handling attitude), the sentiment analysis result is negative, and the intent recognition result is complaint.
[0158] According to the settings, the basic score R of the text classification result is power supply quality 10 + power facilities 8 + power safety 15 + customer service 7 = 40, that is, R = 40, sentiment coefficient S = 2, intention score I = 3, interaction score E: consider the interaction effect between each classification result and the sentiment analysis result. For example, the interaction score corresponding to negative power supply quality is 4, negative power facilities is 3, negative power safety is 5, and negative customer service is 4. That is, E = (4 + 3 + 5 + 4) / 4 = 4, set the weight parameters α = 1.5, β = 0.5, γ = 2, δ = 1, calculate R × S + 1 = 42 × 2 + 1 = 81, log (R × S + 1) = log (81) ≈ 4.39, Iγ = I 2 =9, R 0 . 5 ×S×E=6.32×2×4=50.56. Substituting the calculated value into the risk scoring formula, we get D≈61.645.
[0159] Risk level classification: 0≤D<10 is low risk; 10≤D<20 is medium-low risk; 20≤D<30 is medium risk; 30≤D<40 is medium-high risk; 40≤D<50 is high risk; D≥50 is extremely high risk.
[0160] Final assessment: The risk score is 61.645, which is at the “extremely high risk” level.
[0161] Specifically, in one embodiment of the present invention, step S4 includes:
[0162] S41 performs a first sorting of the customer demand data from high to low according to the risk level, and performs a second sorting of the customer demand data in the first sorting from large to small using the risk score to obtain a risk sorting list.
[0163] Specifically, this two-level ranking ensures that high-risk and high-scoring claims are addressed first.
[0164] S42 uses the first k customer demand data in the risk ranking list as warning data, marks them as high priority, sends real-time warning notifications, and includes them in the quick response queue.
[0165] When determining the k value, it is necessary to ensure that the customer demand data of extremely high risk and high risk in the risk ranking list is included.
[0166] S43 processes the remaining customer demand data starting from k+1 in the sorted order. This method ensures the reasonable allocation of resources, and high-risk and more urgent demands can be processed first.
[0167] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. Power supply service risk identification method based on natural language processing, It is characterized in that include: S1 collects customer demand data from all channels and pre-processes the customer demand data; S2 inputs the pre-processed customer demand data into the pre-trained semantic analysis model for processing to obtain text classification results, sentiment analysis results, and intent recognition results; S3 uses the risk identification algorithm to conduct quantitative assessment based on the text classification results, sentiment analysis results, and intent recognition results to obtain risk scores and risk levels; S4 sorts the customer demand data according to risk score and risk level, responds to the first k customer demand data with an early warning mechanism, and processes the customer demand data starting from k+1 in sequence.
2. The method for identifying power supply service risks based on natural language processing according to claim 1, It is characterized in that Step S1 includes: S11 collects customer demand data from all channels, including telephone hotlines, online channels, email systems, offline channels, SMS platforms, and third-party platforms. Customer demand data includes demand tickets, demand content, customer information, historical demands, and channel information. S12 divides customer demand data from different channels into voice, video and text categories according to format; S13 converts the voice and video customer demand data into text, thereby obtaining unified text customer demand data; S14 integrates customer demand data into one database, unifies the data format, and standardizes field names and data types according to its metadata; S15 cleans customer demand data, including removing duplicate data, processing missing data, and correcting obviously erroneous data.
3. The method for identifying power supply service risks based on natural language processing according to claim 1, It is characterized in that Step S2 includes: S21 builds a semantic analysis model, including feature extraction network, semantic analysis network and classification recognition network; S22 obtains historical demand data and historical processing information thereof, the historical processing information including historical feedback, generates historical demand data according to the historical feedback to obtain historical generated data, and produces a sample set by combining the historical demand data and the historical generated data; S23 iteratively trains the semantic analysis model using the sample set until the model converges, thereby obtaining a pre-trained semantic analysis model; S24 inputs the preprocessed customer demand data into the pre-trained semantic analysis model for processing to obtain text classification results, sentiment analysis results, and intent recognition results.
4. The method for identifying power supply service risks based on natural language processing according to claim 3, It is characterized in that Step S22 includes: S221 Historical demand data includes historical customer demand data and corresponding historical labels. Historical labels include historical text classification results, historical sentiment analysis results, and historical intent recognition results. Historical processing information includes historical feedback, which is divided into positive feedback and negative feedback. S222 selects the historical demand data with positive feedback as the first data set, and selects the historical demand data with negative feedback as the second data set; S223 performs a positive adjustment on the historical label of the second data set to form a pseudo correct label, updates the historical label of the second data set to the pseudo correct label, and generates a second generated data set; S224 uses the first data set as a first sample set, and uses the second data set and the second generated data set to form a sample pair as a second sample set. The first sample set and the second sample set are combined to form a sample set.
5. The method for identifying power supply service risks based on natural language processing according to claim 4, It is characterized in that Step S23 includes: S231 sets an alternating training strategy, sets the batch size to n, and sets the maximum number of iterations to T; S232 sets the number of iterations t=1; S233 randomly samples from the first sample set according to the batch size to obtain a first training sample; S234 uses the first training sample to train the semantic analysis model, and uses the first loss function to back-propagate and update the model; S235 randomly selects from the second sample set according to the batch size to obtain a second training sample; S236 trains the semantic analysis model again using the second training sample, and back-propagates and updates the model using the second loss function; S237 determines whether the number of iterations t is equal to T. If so, the iteration ends and the trained semantic analysis model is obtained. If not, t=t+1 is set and the process returns to step S233.
6. The method for identifying power supply service risks based on natural language processing according to claim 5, It is characterized in that The first loss function is: The second loss function is: CL(f(x i ),f(x j ))=(1-d(r,r′))·max(0,m-||f(x i )-f(x j )||)+d(r,r′)·||f(x i )-f(x j )|| In the formula, Represents the cross entropy loss of the text classification result, y is the actual text classification label, is the text classification result predicted by the model, represents the mean square error loss of the sentiment analysis result, s is the true sentiment analysis label, is the sentiment analysis result predicted by the model, represents the focal loss of the intent recognition result, z is the true intent recognition label, is the intention recognition result predicted by the model, ω 1 ,ω 2 ,ω 3 represents the learnable weights of the three tasks, σ v represents the learnable parameters for each task, ω 4 is the weight of the contrast loss, CL(f(x i ),f(x j )) represents the contrast loss, (x i ,x j ) represents a second training sample, d(r,r′) represents the similarity of the sample pair, r is the original label, r′ is the pseudo correct label, m represents the boundary hyperparameter, f(·) represents the model output, and ‖·‖ represents the norm.
7. The method for identifying power supply service risks based on natural language processing according to claim 3, It is characterized in that The feature extraction network uses a lightweight BERT network, the semantic analysis network uses a trapezoidal bidirectional LSTM network, and the classification network is divided into three task heads, which are used for text classification, sentiment analysis, and intent recognition respectively. Each task head uses multiple layers of fully connected layers.
8. The method for identifying power supply service risks based on natural language processing according to claim 1, It is characterized in that Step S3 includes: S31 text classification results include power supply quality, electricity bill, electricity safety, customer service, and power facilities. Sentiment analysis results include positive, neutral, and negative. Intent recognition results include consultation, suggestion, and complaint. S32 sets the basic score R of each category of the text classification result, determines the sentiment coefficient S according to the classification of the sentiment analysis result, determines the intention score I according to the intention recognition result, and introduces the interaction score E to represent the interaction effect of the text classification combination and the sentiment analysis result; S33 calculates the risk score based on R, S, I, E and the risk score calculation formula; S34 sets the risk level classification rules and maps the risk score values to corresponding risk levels. The risk levels are divided into low risk, medium-low risk, medium risk, medium-high risk, high risk and extremely high risk.
9. The method for identifying power supply service risks based on natural language processing according to claim 8, It is characterized in that The risk score calculation formula is: D=α×log(R×S+1)+β×I γ +δ×(R 0.5 ×S×E) Where D is the risk score, R is the basic score of the text classification result, S is the sentiment coefficient of the sentiment analysis result, I is the intention score of the intention recognition result, E is the interaction score, α is the nonlinear logarithmic weight, β is the nonlinear exponential weight, γ is the nonlinear coefficient of the intention score, and δ is the weight of the interaction effect.
10. The method for identifying power supply service risks based on natural language processing according to claim 8, It is characterized in that Step S4 includes: S41 performs a first sorting of the customer demand data from high to low according to the risk level, and performs a second sorting of the customer demand data in the first sorting from large to small according to the risk score, to obtain a risk sorting list; S42 uses the first k customer demand data in the risk ranking list as warning data, marks them as high priority, sends real-time warning notifications, and puts them into the rapid response queue; S43 processes the remaining customer demand data starting from k+1 in sequence according to the sorted order.
Citation Information
Patent Citations
Positioning method and system based on binary classification technology
CN109889981A
Client complaint risk early warning system
CN114386785A
Automatic judgment method for appeal upgrading public opinion risk
CN114819602A
Multi-label classification model training method and device, electronic equipment and storage medium
CN115098688A
Sample expansion method and device, equipment, storage medium and product
CN115859108A
Cited By
Intelligent question-answering multi-knowledge-base classification optimization method and system for power industry
CN119782534A
NLP-based violation speech processing method and apparatus, and computer device
CN121051246A
NLP-based illegal speech processing method and device, and computer equipment
CN121051246B
